You are on page 1of 21

Binary Operations

I 0.0 I 0.1 Q 8.0

Q 8.1 I 1.0 & M8.0


M1.0
I 1.1 P =

I 1.0 &
M1.1 M8.1
I 1.1 N =

M0.0
I 1.2 Q 9.3
SR
S Q

I 1.3
R

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.1
Objectives

Upon completion of this 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
... be able to use and program edge detections for problem solving

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.2
Binary Logic Operations: AND, OR

Circuit Diagram LAD FBD STL

S1 (I 0.0)
I 0.0 I 0.1 Q 8.0 I 0.0 & Q 8.0 A I 0.0
= A I 0.1
AND S2 (I 0.1) I 0.1
= Q 8.0
Q 8.1 Q 8.1 = Q 8.1
=

L1 L2
(Q 8.0) (Q 8.1)

S3
(I 0.2) I 0.2 Q 8.2
Q 8.2 O I 0.2
S4 I 0.2 >=1
OR = O I 0.3
(I 0.3) I 0.3 = Q 8.2
I 0.3

L3 (Q 8.2)

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.3
Binary Logic Operations: Exclusive OR (XOR)

LAD FBD STL

I 0.4 & A I 0.4


I 0.4 I 0.5 Q 8.0 Q 8.0 AN I 0.5
I 0.5 >=1 O
=
AN I 0.4
I 0.4 & A I 0.5
I 0.4 I 0.5 I 0.5 = Q8.0

Q 8.0 X I 0.4
I 0.4 XOR X I 0.5
=
I 0.5 = Q8.0

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.4
Normally Open and Normally Closed Contacts, Sensors and Symbols

Process Interpretation in PLC program

The The sensor Voltage Signal Check for Check for


sensor is ... present state signal state “1” signal state “0”
is a ... at at
input? input Symbol / Result of Symbol / Result of
Instruction check Instruction check

NO activated
contact LAD: LAD:
Yes 1 “Yes“ “No”
1 0
“NO contact” “NC contact”

not No
activated 0 “No” “Yes”
0 1
FBD: FBD:

& &
NC activated No
contact 0 “No” “Yes”
0 1

not STL: STL:


activated Yes 1 “Yes” “No”
A I x.y 1 AN I x.y 0

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.5
Exercise
Goal: In all three examples, the light should be on when S1 is activated and S2 is not activated!

Hardware

S1 S2 S1 S2 S1 S2

II1.0
1.0 II1.1
1.1 II1.0
1.0 II1.1
1.1. II1.0
1.0 II1.1
1.1
Programmable controller Programmable controller Programmable controller
Q 4.0 Q 4.0 Q 4.0

Light Light Light

Software
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
LAD

I 1.0 & I 1.0 & I 1.0 &

FDB
I 1.1 Q 4.0 I 1.1 Q 4.0 I 1.1 Q 4.0

....... I 1.0 ....... I 1.0 ....... I 1.0


STL ....... I 1.1 ....... I 1.1 ....... I 1.1
....... Q 4.0 ....... Q 4.0 ....... Q 4.0

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.6
Result of Logic Operation, First Check, and Examples

Example 1 Example 2 Example 3

Result of Check

Result of Check

Result of Check
Result of Logic

Result of Logic

Result of Logic
Signal State

Signal State

Signal State
First Check

First Check

First Check
Operation

Operation

Operation
:
:
= M 3.4

A I 1.0 0 1 1

AN I 1.1 0 1 0

A M 4.0 0 1 1

= Q 8.0

= Q 8.1

A I 2.0 0 1 0

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.7
Assignment, Setting, Resetting

LAD FBD STL

I 1.0 I 1.1 Q 8.0 A I 1.0


I 1.0 A I 1.1
& Q 8.0
Assignment ( ) = Q 8.0
I 1.1 =

I 1.2 I 1.3
Q 8.1 I 1.2 A I 1.2
& Q 8.1
Set (S) A I 1.3
I 1.3 S S Q 8.1

I 1.4 Q 8.1
(R) I 1.4 O I 1.4
>=1 Q 8.1 O I 1.5
Reset I 1.5 R R Q 8.1
I 1.5

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.8
Setting / Resetting a Flip Flop

LAD FBD STL

M5.7 M5.7
I 1.2 Q 9.3 A I 1.2
SR SR S M 5.7
Dominant S Q I 1.2 S
Reset A I 1.3
Q9.3 R M 5.7
I 1.3
R Q = A M 5.7
R I 1.3 = Q 9.3

M5.7 M5.7
I 1.3 Q 9.3 A I 1.3
Dominant RS RS R M 5.7
R Q I 1.3 R
Set A I 1.2
Q9.3 S M 5.7
I 1.2
Q = A M 5.7
S I 1.2 S = Q 9.3

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.9
Midline Output Coil

LAD STL

I 1.0 I 1.1 M5.7 I 2.0 I 2.1 M 1.1 Q 4.0


( ) NOT ( ) ( ) A I 1.0
A I 1.1
= M 5.7
A M 5.7
FBD A I 2.0
A I 2.1
NOT
I 1.0 & = M 1.1
M5.7
A M 1.1
I 1.1 &
= Q 4.0
I 2.0 M1.1 Q 4.0
I 2.1 =

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.10
Instructions that Affect the RLO

LAD FBD STL

A I 0.0
I 0.0 I 0.1
Q8.0 I 0.0 & A I 0.1
NOT Q8.0
NOT ( ) I 0.1 = NOT
= Q8.0

Examples:
STAT 0 - Bit memory
CLR
CLR not available not available = M 0.0

STAT 1 - Bit memory

not available not available


SET
SET
= M 0.1

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.11
Exercise: Mode Section of the Distribution Conveyor

DI DO Q 8....
Q 4....
I 0.0 T_System_ON .0
I 0.1 T_System_OFF L_SYSTEM .1
I 0.2 T_Jog_RT L_MAN .2
V
I 0.3 T_Jog_LT L_AUTO .3
I 0.4 S_M/A_Mode_Select .4
I 0.5 T_M/A_Accept .5
-15V...+15V -15V...+15V
AI2 AO1
I 0.6 .6 AI1 AO2

I 0.7 .7

AI1 AI2
Weight V

0 8 1 5 AI1 AI2 AO1 AO2

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.12
Exercise: Mode Section (FC 15), Solution Hints
Network 1: LED for System ON
Q 8.1 (Q 4.1)
SR
ON-condition S

OFF-condition R OUT

Network 2: LED for MANUAL mode


Q 8.2 (Q 4.2)
SR
ON-conditions S

OFF-conditions R OUT

Network 3: LED for AUTO mode


Q 8.3 (Q 4.3)
SR
ON-conditions S

OFF-conditions R OUT

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.13
Exercise: Conveyor Operation in AUTO Mode (1)

Conv. Start Transport Phase Conv. Stop

Prox.Sens.Bay 1
I 16.5 (I 8.5)

M.C.Sw. Bay 1
I 16.1 (I 8.1)

Prox.Sens.Bay 2
I 16.6 (I 8.6)

M.C.Sw. Bay 2
I 16.2 (I 8.2)

Light barrier
(I 16.0 / I 8.0)

Run Conveyor
RIGHT
(Q20.5 / Q8.5)

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.14
Exercise: Conveyor Operation in AUTO Mode (1), Solution Hints
Network x Jog RIGHT in MANUAL mode

Conditions for JOGGING


RIGHT M 16.2 Memory bit for
Jog RIGHT
in MANUAL mode = in MANUAL mode

Network y Run Conveyor RIGHT in AUTO mode

M 16.3
Conditions for
S Memory bit for
Run Conveyor RIGHT Jog RIGHT
in AUTO mode R in AUTO mode

Network z Control Run Conveyor RIGHT

M 16.2 >=1 Q 20.5


(Q 8.5) Run Conveyor RIGHT

M 16.3 =

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.15
RLO - Edge Detection
LAD FBD STL

A I 1.0
I 1.0 I 1.1 M1.0 M8.0 I 1.0 &
M1.0 M8.0 A I 1.1
P FP M1.0
I 1.1 P = = M8.0

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


& M8.1 A I 1.1
M1.1
N FN M1.1
I 1.1 N = = M8.1

OB1-Cycle
I 1.0

I 1.1

RLO
Example
M1.0

M1.1

M8.0
M8.1

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.16
Signal - Edge Detection
LAD FBD STL

I 1.1 I 1.0 & A I 1.0


I 1.0 M8.0 I 1.1 A (
POS POS M8.0 A I 1.1
Q
M1.0 M_BIT = FP
M1.0 M_BIT M1.0
)
I 1.1 I 1.0 =
I 1.0 M8.1 &
I 1.1 M8.0
NEG A I 1.0
Q NEG M8.1
A (
M1.1 M_BIT M1.1 M_BIT = A I 1.1
FN
M1.1
I 1.0 )
=
I 1.1 M8.1

Example M1.0

M1.1
OB1-Cycle
M8.0

M8.1

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.17
Exercise: Conveyor Operation in AUTO Mode (2)

Conv. Start Transport Phase Conv. Stop

Part at
light barrier
Start condition
in AUTO mode

Light barrier
(I 16.0 / I 8.0)

Run Conveyor
RIGHT
(Q20.5 / Q8.5)

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.18
Exercise: Optimizing the Mode Section FC 15
OLD: without edge detection
T_System_ON
(I 0.0)

T_System_OFF
(I 0.1, NC)

L_System
(Q8.1 / Q4.1)

NEW: with edge detection


T_System_ON
(I 0.0)

T_System_OFF
(I 0.1, NC)

L_System
(Q8.1, Q4.1)

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.19
Unconditional Jump (Independent of RLO)

LAD FBD STL

Network 1 Network 1 Network 1


NEW1 NEW1
( JMP ) .... JMP JU NEW1

Network 2 Network 2 Network 2


: : :
: : :
: : :
: : :
Network x Network x Network x

NEW1 NEW1

M5.5 I 4.7 M69.0 NEW1: AN M5.5


M5.5 & M69.0
( ) AN I 4.7
I 4.7 = = M69.0

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.20
Conditional Jump (Dependent on RLO)

LAD FBD STL

I 0.0 I 0.1 NEW1 I 0.0 & A I 0.0


Jump if NEW1 A I 0.1
RLO=1 (JMP) I 0.1 JMP JC NEW1

Jump if I 0.2 I 0.3 I 0.2 & A I 0.2


NEW2 NEW2
RLO=0 A I 0.3
(JMPN) I 0.3 JMPN JCN NEW2

SIMATIC® S7 Date: 03.09.2018 SITRAIN Training for


Automation and Drives
Siemens AG 2003. All rights reserved. File: SERV1_09E.21

You might also like