You are on page 1of 23

Binary Operations

F1

SIMATIC S7

Siemens AG 2008. All rights reserved.

Date:
File:

30.07.16
PRO1_07E.1

SITRAIN Training for


Automation and Industrial Solutions

Objectives
Upon completion of the chapter the participant will

SIMATIC S7

Siemens AG 2008. All rights reserved.

...

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:
File:

30.07.16
PRO1_07E.2

SITRAIN Training for


Automation and Industrial Solutions

Binary Logic Operations: AND, OR


LAD

I 0.0

I 0.1

FBD

Q 8.0

I 0.0

&

I 0.1

Q 8.2
I 0.2

I 0.3

SIMATIC S7

Siemens AG 2008. All rights reserved.

Q 8.0
=
Q 8.1
=

Q 8.1

I 0.2

STL

>=1

I 0.3

Date:
File:

30.07.16
PRO1_07E.3

Q 8.2
=

A
A
=
=

I 0.0
I 0.1
Q 8.0
Q 8.1

O
O
=

I 0.2
I 0.3
Q 8.2

SITRAIN Training for


Automation and Industrial Solutions

Binary Logic Operations: Exclusive OR (XOR)


LAD

I 0.4

I 0.5

FBD

I 0.4
Q 8.0

I 0.4

I 0.5

&

I 0.5
I 0.4

>=1

I 0.5

I 0.5

Siemens AG 2008. All rights reserved.

Q 8.0
=

&

I 0.4

SIMATIC S7

STL

Date:
File:

30.07.16
PRO1_07E.4

XOR

Q 8.0
=

A
AN
O
AN
A
=

I 0.4
I 0.5

X
X
=

I 0.4
I 0.5
Q8.0

I 0.4
I 0.5
Q8.0

SITRAIN Training for


Automation and Industrial Solutions

Sensors and Symbols


Process

The
sensor
is a ...

NO
contact

The sensor
is ...

Interpretation in the PLC Program

Voltage
present
at input?

Signal
state
at
input

activated
1

yes

Check
for signal state 1

Check
for signal state 0

Symbol /
Instruction

Result of
check

Symbol /
Instruction

LAD:

Yes
1

LAD:

NO contact
not
activated

no

0
FBD:

NC
contact

no

not
activated

yes

A I x.y

SIMATIC S7

Siemens AG 2008. All rights reserved.

No
0

Date:
File:

30.07.16
PRO1_07E.5

FBD:

Yes
1

&
No
0

STL:

No
0

NC contact

&

activated

Result of
check

Yes
1

Yes
1

STL:
AN I x.y

No
0

SITRAIN Training for


Automation and Industrial Solutions

First Check, Signal State, Result of Check and Result of Logic Operation

I 1.0

AN I 1.1

M 4.0

Q 8.0

Q 8.1

I 2.0

SIMATIC S7

Siemens AG 2008. All rights reserved.

Date:
File:

30.07.16
PRO1_07E.6

First Check

M 3.4

Result of Logic
Operation

:
:
=

Result of Check

Signal State

Example 3

First Check

Result of Logic
Operation

Result of Check

Signal State

Example 2

First Check

Result of Logic
Operation

Result of Check

Signal State

Example 1

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!
Hardware
S1

S2

E
1.0
I1.0

S1

EI1.1
1.1

EI1.0
1.0

Programmable controller

E 1.1
I1.1

Programmable controller

Q 4.0

I 1.0

I 1.1

I 1.0

I 1.1

E I1.1
1.1

Programmable controller

Q 4.0

Light

Q 4.0

S2

EI1.0
1.0

Q 4.0

Light

Software

S1

S2

Light

Q 4.0

I 1.0

I 1.1

Q 4.0

LAD

I 1.0

FBD

Siemens AG 2008. All rights reserved.

&

I 1.0
Q 4.0

I 1.1

STL

SIMATIC S7

&

Q 4.0

I 1.1

....... I 1.0
....... I 1.1
....... Q 4.0

....... I 1.0
....... I 1.1
....... Q 4.0

Date:
File:

I 1.0

30.07.16
PRO1_07E.7

&
Q 4.0

I 1.1
....... I 1.0
....... I 1.1
....... Q 4.0

SITRAIN Training for


Automation and Industrial Solutions

Assignment, Setting, Resetting


LAD

I 1.0

I 1.1

FBD

Q 8.0

( )

Assignment

I 1.0

&

I 1.3

Q 8.1

(S )

Set

I 1.2

&

SIMATIC S7

Siemens AG 2008. All rights reserved.

A I 1.0
A I 1.1
= Q 8.0

A I 1.2
A I 1.3
S Q 8.1

Q 8.1

(R )

Reset

Q 8.1
S

I 1.3

I 1.4

Q 8.0
=

I 1.1

I 1.2

STL

I 1.5

I 1.4
I 1.5

Date:
File:

30.07.16
PRO1_07E.8

>=1

Q 8.1
R

O I 1.4
O I 1.5
R Q 8.1

SITRAIN Training for


Automation and Industrial Solutions

Setting and Resetting a Flip Flop

LAD
M 5.7

I1.2
Dominant
Reset

FBD

SR

M 5.7
Q

Q 9.3

I1.2

SR
Q9.3

I1.3
I1.3

Dominant
Set

STL

M 5.7

I1.3
R

RS

M 5.7
Q

Q 9.3

I1.3

RS
Q9.3

I1.2
I1.2

SIMATIC S7

Siemens AG 2008. All rights reserved.

Date:
File:

30.07.16
PRO1_07E.9

A
S
A
R
A
=

I 1.2
M 5.7
I 1.3
M 5.7
M 5.7
Q 9.3

A
R
A
S
A
=

I 1.3
M 5.7
I 1.2
M 5.7
M 5.7
Q 9.3

SITRAIN Training for


Automation and Industrial Solutions

Midline Output Coil

LAD

I 1.0

I 1.1

STL

M 20.7

I 2.0

I 2.1

Q 4.0

( )

( )

FBD

I 1.0

&

Siemens AG 2008. All rights reserved.

I
I
M
M
I
I
Q

1.0
1.1
20.7
20.7
2.0
2.1
4.0

M 20.7

I 1.1

SIMATIC S7

A
A
=
A
A
A
=

&
I 2.0

Q 4.0

I 2.1

Date:
File:

30.07.16
PRO1_07E.10

SITRAIN Training for


Automation and Industrial Solutions

Instructions that Affect the RLO

LAD

NOT

I 0.0

FBD

Q 8.0

I0.1

( )

NOT

I 0.0

&

I 0.1

STL

Q 8.0
=

A I 0.0
A I 0.1
NOT
= Q 8.0

Examples:
STAT 0 Bit memory

CLR

not available

not available

CLR
= M 0.0

STAT 1 Bit memory

SET

SIMATIC S7

Siemens AG 2008. All rights reserved.

not available

not available

Date:
File:

30.07.16
PRO1_07E.11

SET
= M 0.1

SITRAIN Training for


Automation and Industrial Solutions

Exercise 2: Programming the Operating Mode Section (FC 15)

DI

DO

I 0.0

T_System_ON

I 0.1

T_System_OFF L_SYSTEM

Q 4.1

I 0.2
I 0.3

T_Jog_RIGHT

Q 4.2
Q 4.3

I 0.4

S_M/A_ModeSelect

I 0.5

T_M/A_Accept

T_Jog_LEFT

L_MAN
L_AUTO

-15V...+15V

AI2

AO1

-15V...+15V
AO2

AI1

AI1

AI2

0 8 1 5

SIMATIC S7

Siemens AG 2008. All rights reserved.

Date:
File:

30.07.16
PRO1_07E.12

AI1

AI2

AO1

AO2

SITRAIN Training for


Automation and Industrial Solutions

Exercise 2: "FC_Mode" (FC 15), Solution Hints


Network 1:

Indicator Light System ON

Q 4.1
SR

Network 2:

ON-Condition

OFF-Condition

Indicator Light MAN Mode

Q 4.2
SR

Network 3:

ON-Conditions

OFF-Conditions

Indicator Light AUTO Mode

Q 4.3
SR

SIMATIC S7

Siemens AG 2008. All rights reserved.

ON-Conditions

OFF-Conditions

Date:
File:

30.07.16
PRO1_07E.13

SITRAIN Training for


Automation and Industrial Solutions

Exercise 3: Conveyor in AUTO Mode (Expanding FC 16)


Conv. Start

Transport Phase

Conv. Stop

Prox.Sens.Bay 1
I 8.5
Mom.Cont.Bay 1
I 8.1
Prox.Sens.Bay 2
I 8.6
Mom.Cont.Bay 2
I 8.2
Light Barrier
I 8.0
Run Conveyor
RIGHT
Q8.5

SIMATIC S7

Siemens AG 2008. All rights reserved.

Date:
File:

30.07.16
PRO1_07E.14

SITRAIN Training for


Automation and Industrial Solutions

Exercise 3: "FC_ConvMotor" (FC 16), Solution Hints


Network x

Jog RIGHT in MANUAL mode


Conditions for JOGGING
RIGHT
in MANUAL mode

Network y

M 16.2

Run Conveyor RIGHT in AUTO mode


M 16.4

Conditions for
Run Conveyor RIGHT
in AUTO mode

Network z

>=1

Q 8.5

Run Conveyor RIGHT

M 16.4

Siemens AG 2008. All rights reserved.

Memory bit for


Run Conveyor RIGHT
in AUTO mode

Control Run Conveyor RIGHT


M 16.2

SIMATIC S7

Memory bit for


Jog RIGHT
In MANUAL mode

Date:
File:

30.07.16
PRO1_07E.15

SITRAIN Training for


Automation and Industrial Solutions

RLO Edge Detection


LAD
I 1.0

I 1.1

FBD

M1.0

M8.0

P
I 1.0

I 1.1

M1.1

I 1.0

&

STL

M1.0

M8.0

I 1.1
M8.1

I 1.0

&

M1.1

M8.1

I 1.1

A
A
FP
=

I 1.0
I 1.1
M1.0
M8.0

A
A
FN
=

I 1.0
I 1.1
M1.1
M8.1

I 1.0
I 1.1
& -RLO
M8.0
OB1 Cycle

OB1 Cycle

M8.1
OB1 Cycle

SIMATIC S7

Siemens AG 2008. All rights reserved.

Date:
File:

OB1 Cycle

30.07.16
PRO1_07E.16

SITRAIN Training for


Automation and Industrial Solutions

Signal Edge Detection


LAD
I 1.0

I 1.1
POS Q

M1.0

M_BIT

I 1.0

I 1.1
NEG Q

M1.1

M_BIT

FBD

M1.0

I 1.1
POS
M_BIT

M1.1

I 1.1
NEG
M_BIT

M8.0

M8.1

I 1.0

I 1.0

STL
&
M8.0

=
I 1.0

&
M8.1

A
A
A
FP
M1.0
)
=
M8.0
A
A
A
FN
M1.1
)
=
M8.1

I 1.0
(
I 1.1

I 1.0
(
I 1.1

I 1.1
M8.0
OB1 Cycle

M8.1
OB1 Cycle

SIMATIC S7

Siemens AG 2008. All rights reserved.

Date:
File:

30.07.16
PRO1_07E.17

SITRAIN Training for


Automation and Industrial Solutions

Exercise 4: Integrating the Edge Detection in FC 16

Conv. Start

Transport Phase

Conv. Stop
Part at
Light barrier

Start condition
in AUTO mode

Light Barrier
(I 8.0)

Run Conveyor
RIGHT
(Q8.5)

SIMATIC S7

Siemens AG 2008. All rights reserved.

Date:
File:

30.07.16
PRO1_07E.18

SITRAIN Training for


Automation and Industrial Solutions

Exercise 5: Controlling Indicator Lights + Horn (FC 14)

"BAY1"
(I 8.5)

in MANUAL mode:
2Hz pulsed honking
while conveyor jogging

"BAY2"
(I 8.6)

"Horn"
(Q 8.7)

"L_Bay1"
(Q 8.1)

"L_Bay2"
(Q 8.2)

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

SIMATIC S7

Siemens AG 2008. All rights reserved.

Date:
File:

30.07.16
PRO1_07E.19

SITRAIN Training for


Automation and Industrial Solutions

If You Want to Know More

SIMATIC S7

Siemens AG 2008. All rights reserved.

Date:
File:

30.07.16
PRO1_07E.20

SITRAIN Training for


Automation and Industrial Solutions

Additional Exercise 6: Optimizing the Operating Mode Section (FC 15)


OLD: without edge detection
T_System_ON
(I 0.0)
T_System_OFF
(I 0.1, NC contact)
L_SYSTEM
(Q4.1)

NEW: with edge detection


T_System_ON
(I 0.0)
T_System_OFF
(I 0.1, NC contact)
L_SYSTEM
(Q 4.1)

SIMATIC S7

Siemens AG 2008. All rights reserved.

Date:
File:

30.07.16
PRO1_07E.21

SITRAIN Training for


Automation and Industrial Solutions

Unconditional Jump (Regardless of the RLO)


LAD

Network 1

FBD

NEW1

( JMP )
Network 2
:
:
:
:
Network x

SIMATIC S7

NEW1
JMP

....
Network 2
:
:
:
:
Network x

Network 1

JU NEW1
Network 2
:
:
:
:
Network x

NEW1

NEW1

M5.5

Network 1

STL

I 4.7

Siemens AG 2008. All rights reserved.

M69.0

( )

M5.5
I 4.7

Date:
File:

&

M69.0
=

30.07.16
PRO1_07E.22

NEW1:

AN M5.5
AN I 4.7
=
M69.0

SITRAIN Training for


Automation and Industrial Solutions

Conditional Jump (Dependent on RLO)

LAD

Jump if
RLO=1

Jump if
RLO=0

SIMATIC S7

I 0.0

I 0.2

Siemens AG 2008. All rights reserved.

I 0.1

I 0.3

FBD

NEW1

I 0.0

(JMP)

I 0.1

I 0.2

NEW2

(JMPN)

Date:
File:

I 0.3

30.07.16
PRO1_07E.23

&

&

STL

NEW1
JMP

A I 0.0
A I 0.1
JC NEW1

NEW2
JMPN

A I 0.2
A I 0.3
JCN NEW2

SITRAIN Training for


Automation and Industrial Solutions

You might also like