You are on page 1of 23

Date: 2/4/2012

File: PRO1_07E.1
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Binary Operations
F1
Date: 2/4/2012
File: PRO1_07E.2
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Objectives
Upon completion of the chapter the participant will

... understand the difference between real connected NC contacts
and NO contacts, and programmed symbols

... be able to explain the terms Result of Logic Operation (RLO),
Status (STAT) and First Check

... be able to program basic binary logic operations


Date: 2/4/2012
File: PRO1_07E.3
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Binary Logic Operations: AND, OR
I 0.2
I 0.3
>=1
=
Q 8.2
O I 0.2
O I 0.3
= Q 8.2
I 0.0 I 0.1
Q 8.0
Q 8.1
LAD

=
Q 8.0
&
I 0.0
I 0.1
=
Q 8.1
FBD
A I 0.0
A I 0.1
= Q 8.0
= Q 8.1
STL
I 0.2
I 0.3
Q 8.2
L3 (Q 8.2)
S3
(I 0.2)
S4
(I 0.3)
OR
AND
L1
(Q 8.0)
S1 (I 0.0)
S2 (I 0.1)
L2
(Q 8.1)
Circuit Diagram
Date: 2/4/2012
File: PRO1_07E.4
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Binary Logic Operations: Exclusive OR (XOR)
I 0.4
I 0.5
XOR
=
Q 8.0
I 0.4 I 0.5
I 0.4 I 0.5
Q 8.0
LAD

>=1
=
Q 8.0
&
I 0.4
I 0.5
&
I 0.4
I 0.5
FBD
A I 0.4
AN I 0.5
O
AN I 0.4
A I 0.5
= Q8.0
STL
X I 0.4
X I 0.5
= Q8.0
Date: 2/4/2012
File: PRO1_07E.5
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Sensors and Symbols
Signal
state
at
input
Check
for signal state 1
Symbol /
Instruction
Result of
check
Check
for signal state 0
Symbol /
Instruction
Result of
check
yes
Voltage
present
at input?
no
yes
no
The
sensor
is a ...
The sensor
is ...
1
0
0
1
Yes
1
LAD:
NO contact
&
FBD:
A I x.y
STL:
AN I x.y
STL:
&
FBD:
LAD:
NC contact
No
0
Yes
1
No
0
No
0
Yes
1
Yes
1
No
0
Process Interpretation in the PLC Program
activated
not
activated
activated
not
activated
NO
contact
NC
contact
Date: 2/4/2012
File: PRO1_07E.6
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Exercise 1: Sensors and Symbols
Task: In all three examples, the light should be on when S1 is activated and S2 is not activated!
I 1.0 I 1.1 Q 4.0 I 1.0 I 1.1 Q 4.0
....... I 1.0
....... I 1.1
....... Q 4.0
Q 4.0
I 1.0
I 1.1
&
Q 4.0
I 1.0
I 1.1
&
Q 4.0
I 1.0
I 1.1
&
....... I 1.0
....... I 1.1
....... Q 4.0
....... I 1.0
....... I 1.1
....... Q 4.0
Software
E 1.0
S1
E 1.1
S2
E 1.0
S1
E 1.1
S2
E 1.0
S1
E 1.1
S2
Q 4.0
Programmable controller
Light Light Light
Q 4.0
Programmable controller
Q 4.0
Programmable controller
FBD
STL
LAD
Hardware
I 1.0 I 1.1 Q 4.0
I1.0 I1.0 I1.0 I1.1 I1.1 I1.1
Date: 2/4/2012
File: PRO1_07E.7
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Exercise 2: Add Conveyor Master Control Logic
Start Stop
ON
R
R
Hard Wire Circuit
CPU
Digital
Input
Module
1



2



3



4
.
.
Start
Stop
I0.0
CPU
Digital
Output
Module
1



2



3



4
.
.
I0.1
M
Q4.1
ON
Date: 2/4/2012
File: PRO1_07E.8
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Assignment, Setting, Resetting
(S)
Q 8.1
I 1.2 I 1.3
I 1.2
&
S
Q 8.1
I 1.3
I 1.4
>=1
R
Q 8.1
I 1.5
A I 1.2
A I 1.3
S Q 8.1
O I 1.4
O I 1.5
R Q 8.1
I 1.0
&
=
Q 8.0
I 1.1
A I 1.0
A I 1.1
= Q 8.0
Assignment
Set
Reset
(R)
Q 8.1
I 1.4
I 1.5
( )
Q 8.0
I 1.0 I 1.1
LAD FBD STL
Date: 2/4/2012
File: PRO1_07E.9
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Setting and Resetting a Flip Flop
SR
R Q
S I1.2
I1.3
M 5.7
=
Q9.3
Dominant
Reset
SR
S Q
R
I1.2
I1.3
M 5.7
Q 9.3
A I 1.2
S M 5.7
A I 1.3
R M 5.7
A M 5.7
= Q 9.3
RS
S
Q
R I1.3
I1.2
M 5.7
=
Q9.3
Dominant
Set
RS
R Q
S
I1.3
I1.2
M 5.7
Q 9.3
A I 1.3
R M 5.7
A I 1.2
S M 5.7
A M 5.7
= Q 9.3
LAD FBD STL
Date: 2/4/2012
File: PRO1_07E.10
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Midline Output Coil
LAD
I 1.0 I 1.1
( )
M 20.7 I 2.0 I 2.1
( )
Q 4.0
A I 1.0
A I 1.1
= M 20.7
A M 20.7
A I 2.0
A I 2.1
= Q 4.0
STL
I 1.0
I 1.1
&
&
I 2.0
I 2.1
M 20.7
Q 4.0
=
FBD
Date: 2/4/2012
File: PRO1_07E.11
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Result of Logic Operation, First Check, and Examples
A I 1.0
AN I 1.1
A M 4.0
= Q 8.0
= Q 8.1
A I 2.0
:
:
= M 3.4
Example 1
S
i
g
n
a
l

S
t
a
t
e

0
0
0
0
R
e
s
u
l
t

o
f

C
h
e
c
k

R
e
s
u
l
t

o
f

L
o
g
i
c


O
p
e
r
a
t
i
o
n

F
i
r
s
t

C
h
e
c
k

S
i
g
n
a
l

S
t
a
t
e

R
e
s
u
l
t

o
f

C
h
e
c
k

R
e
s
u
l
t

o
f

L
o
g
i
c

O
p
e
r
a
t
i
o
n

F
i
r
s
t

C
h
e
c
k

1
Example 2
1
1
1
S
i
g
n
a
l

S
t
a
t
e

R
e
s
u
l
t

o
f

C
h
e
c
k

R
e
s
u
l
t

o
f

L
o
g
i
c

O
p
e
r
a
t
i
o
n

F
i
r
s
t

C
h
e
c
k

1
Example 3
0
1
0
Date: 2/4/2012
File: PRO1_07E.12
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Instructions that Affect the RLO
=
Q 8.0
&


I 0.0
I 0.1
A I 0.0
A I 0.1
NOT
= Q 8.0
( )
Q 8.0
NOT
I 0.0 I0.1
LAD FBD STL
NOT
STAT 0 Bit memory
not available not available CLR
CLR
= M 0.0
Examples:
not available not available
SET
SET
= M 0.1
STAT 1 Bit memory
Date: 2/4/2012
File: PRO1_07E.13
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Exercise 3: Programming the Operating Mode Section (FC 15)
V
AI1 AI2 AO1 AO2
AI2
AI1
-15V...+15V -15V...+15V
AI1
AI2 AO1
AO2
V
DI
I 0.0
I 0.1
I 0.2
I 0.3
I 0.4
I 0.5
DO
Q 4.1
Q 4.2
Q 4.3
S_M/A_ModeSelect
T_System_ON
T_M/A_Accept
T_System_OFF
T_Jog_RIGHT
T_Jog_LEFT
L_SYSTEM
L_MAN
L_AUTO
0 8 1 5
Date: 2/4/2012
File: PRO1_07E.14
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Exercise 3: "FC_Mode" (FC 15), Solution Hints
SR
S
R Q
Network 1: Indicator Light System ON
ON-Condition
OFF-Condition
SR
S
R Q
Network 2: Indicator Light MAN Mode
ON-Conditions
OFF-Conditions
SR
S
R Q
Network 3: Indicator Light AUTO Mode
ON-Conditions
OFF-Conditions
Q 4.1
Q 4.2
Q 4.3
Date: 2/4/2012
File: PRO1_07E.15
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Exercise 4: Conveyor in AUTO Mode (Expanding FC 16)
Mom.Cont.Bay 1
I 8.1
Prox.Sens.Bay 1
I 8.5
Run Conveyor
RIGHT
Q8.5
Light Barrier
I 8.0

Conv. Start Conv. Stop Transport Phase
Mom.Cont.Bay 2
I 8.2
Prox.Sens.Bay 2
I 8.6
Date: 2/4/2012
File: PRO1_07E.16
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Exercise 4: "FC_ConvMotor" (FC 16), Solution Hints
=
Conditions for JOGGING
RIGHT
In MANUAL mode
Conditions for
Run Conveyor RIGHT
in AUTO mode
M 16.4
M 16.2 Memory bit for
Jog RIGHT
In MANUAL mode
Memory bit for
Run Conveyor RIGHT
in AUTO mode
=
Network x Jog RIGHT in MANUAL mode
Network y Run Conveyor RIGHT in AUTO mode
Network z Control Run Conveyor RIGHT

Q 8.5
Run Conveyor RIGHT
>=1 M 16.2
M 16.4
S
R
Date: 2/4/2012
File: PRO1_07E.17
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
RLO Edge Detection
A I 1.0
A I 1.1
FP M1.0
= M8.0

A I 1.0
A I 1.1
FN M1.1
= M8.1

P
I 1.0 I 1.1 M1.0 M8.0
N
I 1.0 I 1.1 M1.1 M8.1
I 1.0
I 1.1 P =
&
M1.0 M8.0
I 1.0
I 1.1 N =
&
M1.1 M8.1
LAD FBD STL
I 1.0
I 1.1
& -RLO
M8.0
M8.1
OB1 Cycle OB1 Cycle
OB1 Cycle OB1 Cycle
Date: 2/4/2012
File: PRO1_07E.18
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
A I 1.0
A (
A I 1.1
FP
M1.0
)
=
M8.0
A I 1.0
A (
A I 1.1
FN
M1.1
)
=
M8.1

Signal Edge Detection
STL
I 1.1
=
M8.0
POS
M_BIT M1.0
&
I 1.0
I 1.1
=
M8.1
NEG
M_BIT M1.1
&
I 1.0
FBD LAD
I 1.1
M8.0
POS
M_BIT
M1.0
Q
I 1.0
I 1.1
M8.1
NEG
M_BIT
M1.1
Q
I 1.0
I 1.0
I 1.1
OB1 Cycle
OB1 Cycle
M8.0
M8.1
Date: 2/4/2012
File: PRO1_07E.19
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Exercise 5: Integrating the Edge Detection in FC 16
Run Conveyor
RIGHT
(Q8.5)
Light Barrier
(I 8.0)

Conv. Start Conv. Stop Transport Phase
Start condition
in AUTO mode
Part at
Light barrier
Date: 2/4/2012
File: PRO1_07E.20
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Exercise 6: Optimizing the Operating Mode Section (FC 15)
T_System_ON
(I 0.0)
T_System_OFF
(I 0.1, NC contact)
L_SYSTEM
(Q4.1)
OLD: without edge detection
T_System_ON
(I 0.0)
T_System_OFF
(I 0.1, NC contact)
L_SYSTEM
(Q 4.1)
NEW: with edge detection
Date: 2/4/2012
File: PRO1_07E.21
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Unconditional Jump (Regardless of the RLO)
( JMP )
NEW1
Network 1
Network 2
:
:
:
:
Network x
NEW1
( )
M69.0
I 4.7 M5.5
LAD
NEW1
JMP
....
NEW1
&


M5.5
I 4.7
=
M69.0
Network 1
Network 2
:
:
:
:
Network x
FBD
Network 1

JU NEW1


Network 2
:
:
:
:
Network x


NEW1: AN M5.5
AN I 4.7
= M69.0
STL
Date: 2/4/2012
File: PRO1_07E.22
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Conditional Jump (Dependent on RLO)
A I 0.0
A I 0.1
JC NEW1
A I 0.2
A I 0.3
JCN NEW2
Jump if
RLO=1
Jump if
RLO=0
NEW2
I 0.2 I 0.3
(JMPN)
NEW1
I 0.0 I 0.1
(JMP)
& I 0.0
I 0.1 JMP
NEW1
JMPN
I 0.2
I 0.3
NEW2
&
LAD FBD STL
Date: 2/4/2012
File: PRO1_07E.23
SIMATIC S7
Siemens AG 2006. All rights reserved.
SITRAIN Training for
Automation and Industrial Solutions
Exercise 7: Putting Indicator Lights + Horn (FC 14) into Operation
"L_Bay2"
(Q 8.2)
"L_Bay1"
(Q 8.1)
"Horn"
(Q 8.7)
"BAY1"
(I 8.5)
"BAY2"
(I 8.6)
in MANUAL mode:
2Hz pulsed honking
while conveyor jogging
in AUTO mode:
- Constant light at both bays when a new part can be placed (both bays empty)
- 1Hz flashing light at the bay where the part is placed and the conveyor has not yet been started
- 2Hz flashing light at both bays during conveyor movement