06 binary operations
TRANSCRIPT
Date: 05/03/23File: PRO1_07E.1
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Binary Operations
I 0.0 I 0.1 Q 8.0
Q 8.1 I 1.0
I 1.1 P =
&M1.0 M8.0
T4
S_ODT
TV
S Q
BCD
BI
R
I 0.7
I 0.5
S5T#35s
Q8.5
MW0
QW12
Date: 05/03/23File: PRO1_07E.2
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
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: 05/03/23File: PRO1_07E.3
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
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.0A 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: 05/03/23File: PRO1_07E.4
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Binary Logic Operations: Exclusive OR (XOR)
I 0.4
I 0.5XOR
=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.4AN I 0.5OAN I 0.4A I 0.5= Q8.0
STL
X I 0.4X I 0.5= Q8.0
Date: 05/03/23File: PRO1_07E.5
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Normally Open and Normally Closed Contacts. Sensors and Symbols
Signalstateat input
Check for signal state “1”
Symbol /Instruction
Result ofcheck
Check for signal state “0”
Symbol /Instruction
Result ofcheck
yes
Voltagepresentat input?
no
yes
no
The sensoris a ...
The sensoris ...
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
notactivated
activated
notactivated
NOcontact
NCcontact
Date: 05/03/23File: PRO1_07E.6
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Exercise 0: NO and NC ContactsTask: 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.0Programmable controller
LightLight Light
Q 4.0Programmable controller
Q 4.0Programmable controller
FBD
STL
LAD
Hardware
I 1.0 I 1.1 Q 4.0
I1.0 I1.0I1.0 I1.1I1.1I1.1
Date: 05/03/23File: PRO1_07E.7
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Assignment, Setting, Resetting
(S)Q 8.1I 1.2 I 1.3
I 1.2 &
SQ 8.1
I 1.3
I 1.4 >=1
RQ 8.1
I 1.5
A I 1.2A I 1.3S Q 8.1
O I 1.4O I 1.5R Q 8.1
I 1.0 &
=Q 8.0
I 1.1
A I 1.0A I 1.1= Q 8.0Assignment
Set
Reset(R)
Q 8.1I 1.4
I 1.5
( )Q 8.0I 1.0 I 1.1
LAD FBD STL
Date: 05/03/23File: PRO1_07E.8
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Setting / Resetting a Flip Flop
SR
R Q
SI1.2
I1.3
M 5.7
=
Q9.3DominantReset
SRS Q
R
I1.2
I1.3
M 5.7Q 9.3 A I 1.2
S M 5.7A I 1.3R M 5.7A M 5.7= Q 9.3
RS
S Q
RI1.3
I1.2
M 5.7
=
Q9.3
DominantSet
RSR Q
S
I1.3
I1.2
M 5.7Q 9.3 A I 1.3
R M 5.7A I 1.2S M 5.7A M 5.7= Q 9.3
LAD FBD STL
Date: 05/03/23File: PRO1_07E.9
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
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.0A I 1.1= M 20.7A M 20.7A I 2.0A 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: 05/03/23File: PRO1_07E.10
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Instructions that Affect the RLO
=Q 8.0&I 0.0
I 0.1
A I 0.0 A I 0.1NOT = Q 8.0
( ) Q 8.0
NOTI 0.0 I0.1
LAD FBD STL
NOT
STAT 0 – Bit memory
not available not availableCLRCLR = M 0.0
Examples:
not available not availableSET SET = M 0.1
STAT 1 – Bit memory
Date: 05/03/23File: PRO1_07E.11
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Exercise 1: Mode Section of the Distribution Conveyor (FC15)
V
0 8 1 5 AI1 AI2 AO1 AO2
AI2AI1
-15V...+15V -15V...+15V
AI1AI2 AO1
AO2
V
DI
I 0.0
I 0.1I 0.2I 0.3I 0.4I 0.5I 0.6I 0.7
DO
.0
.1
.2
.3
.4
.5
.6
.7
AUTO / MANUAL
System_ON
Accept
SystemMANUAL
AUTO
System_OFF
Q 4....
Jog_RIGHT
Jog_LEFT
Weight
Date: 05/03/23File: PRO1_07E.12
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Exercise 2: Programming the Conveyor for AUTO Mode (FC16)
Pushbutton Bay 1I 8.1
Prox.Sens.Bay 1I 8.5
Run Conveyor RIGHT
Q8.5
Light BarrierI 8.0
Conv. Start Conv. StopTransport Phase
Pushbutton Bay 2I 8.2
Prox.Sens.Bay 2I 8.6
Date: 05/03/23File: PRO1_07E.13
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
RLO – Edge Detection
A I 1.0 A I 1.1
FP M1.0= M8.0
A I 1.0A I 1.1FN M1.1= M8.1
PI 1.0 I 1.1 M1.0 M8.0
NI 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
I 1.0
I 1.1
RLO
M1.0
M8.0M8.1
M1.1
LAD FBD STL
OB1 Cycle
Example
Date: 05/03/23File: PRO1_07E.14
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
A I 1.0 A (
A I 1.1FP
M1.0)=
M8.0A I 1.0A (A I 1.1FN
M1.1)=
M8.1
Example
Signal – Edge Detection
I 1.0
I 1.1
M1.0
M8.0
M8.1
M1.1OB1 Cycle
STL
I 1.1
=M8.0POS
M_BITM1.0
&I 1.0
I 1.1
=M8.1NEG
M_BITM1.1
&I 1.0
FBDLAD
I 1.1M8.0
POS
M_BITM1.0
Q
I 1.0
I 1.1M8.1
NEG
M_BITM1.1
Q
I 1.0
Date: 05/03/23File: PRO1_07E.15
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Exercise 3: Edge Detection
Run Conveyor RIGHT(Q8.5)
Light Barrier(I 8.0)
Conv. Start Conv. StopTransport Phase
Start conditionin AUTO mode
Part at Light barrier
Date: 05/03/23File: PRO1_07E.16
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Exercise 4: Optimizing the Mode Section FC 15
T_System_ON(I 0.0)
T_System_OFF(I 0.1, NC contact)
L_System_ON(Q4.1)
OLD: without edge detection
T_System_ON(I 0.0)
T_System_OFF(I 0.1, NC contact)
L_System_ON(Q4.1)
NEW: with edge detection
Date: 05/03/23File: PRO1_07E.17
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
If You Want to Know More
Date: 05/03/23File: PRO1_07E.18
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Unconditional Jump (Regardless of the RLO)
( JMP )NEW1
Network 1
Network 2::::Network x
NEW1
( )M69.0I 4.7M5.5
LAD
NEW1JMP....
NEW1
&M5.5I 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: 05/03/23File: PRO1_07E.19
SIMATIC S7Siemens AG 2004. All rights reserved.
SITRAIN Training for Automation and Drives
Conditional Jump (Dependent on RLO)
A I 0.0A I 0.1JC NEW1
A I 0.2A I 0.3JCN NEW2
Jump ifRLO=1
Jump ifRLO=0
NEW2I 0.2 I 0.3
(JMPN)
NEW1I 0.0 I 0.1
(JMP)&I 0.0
I 0.1 JMPNEW1
JMPN
I 0.2
I 0.3NEW2
&
LAD FBD STL