Micro1 07E Bin Operat

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

SIMATIC S7-1200 Basic Course

Contents 7
7. Binary Operations .................................................................................................. 7-2
7.1. Task Description: The Conveyor Model as Distribution Conveyor ....................................... 7-3
7.2. Sensors and Check Symbols ................................................................................................ 7-4
7.3. Binary Logic Operations: AND, OR....................................................................................... 7-5
7.3.1. Binary Logic Operations: Exclusive OR (XOR)..................................................................... 7-6
7.3.2. Theory Exercise 1: Sensor and Check Symbols .................................................................. 7-7
7.4. Assignment, Set, Reset, NOT ............................................................................................... 7-8
7.4.1. Flip Flops............................................................................................................................... 7-9
7.5. Task Description: "FC_Mode" (FC15)................................................................................. 7-10
7.5.1. Exercise 2: Programming the "FC_Mode" (FC15) Block .................................................... 7-11
7.5.2. Task Description: Parts Transportation when "P_Operation" (Q4.0) is Switched On ........ 7-12
7.5.3. Exercise 3: Expanding "FC_ConvMotor" (FC16) ................................................................ 7-13
7.6. Task Description: Parts Transportation THROUGH the Light Barrier ................................ 7-14
7.6.1. Operand Edge Evaluations ................................................................................................. 7-15
7.6.2. RLO Edge Evaluation ......................................................................................................... 7-16
7.6.3. Exercise 4: Integrating an Edge Evaluation in "FC_ConvMotor" (FC16)............................ 7-17
7.7. Task Description: Controlling the Indicator Lights .............................................................. 7-18
7.7.1. Exercise 5: Commissioning "FC_Indicate" (FC14) ............................................................. 7-19
7.8. Additional Information ......................................................................................................... 7-20
7.8.1. Additional Exercise 6: Optimizing "FC_Mode" (FC15)........................................................ 7-21
7.8.2. Setting / Resetting Bit Fields ............................................................................................... 7-22
7.8.3. Jump Instructions JMP, JMPN, RET................................................................................... 7-23

TIA-MICRO1 - Binary Operations


Training Document V13.01.01 7-1
SIMATIC S7-1200 Basic Course

7. Binary Operations

At the end of the chapter the participant will …

... understand the difference between ‘real’ NC contacts and


NO contacts connected in the hardware, and programmed
check symbols

... be able to explain the terms Result of Logic Operation


(RLO) and Status (STAT)

... be able to program basic binary logic operations

… be able to carry out simple troubleshooting

TIA-MICRO1 - Binary Operations


7-2 Training Document V13.01.01
SIMATIC S7-1200 Basic Course

7.1. Task Description: The Conveyor Model as Distribution Conveyor

4711

DI 0V
I 0.0 S_OperationON
S_OperationOFF
"B_Bay1" "B_Bay2" "B_LB"
I 0.1 (NC) -10V +10V (I 8.5) (I 8.6) (I8.0)
Poti
I 0.2 S_Right

I 0.3 S_Left
DO
P_Operation Q 4.0 "K_Left"
"K_Right"
(Q 8.6)
(Q 8.5)

"S_Bay1" "S_Bay2"
(I 8.1) (I 8.2)
"P_Bay1" "P_Bay2"
(Q 8.1) (Q 8.2)

The Conveyor Model as Distribution Conveyor


The distribution conveyor is used to transport parts from Bay 1 or 2 to the light barrier bay.
Operation (Simulator LED "P_Operation", Q4.0) can be switched on via the simulator switch
"S_OperationON" (I 0.0) and switched off via the simulator switch "S_OperationOFF" (I 0.1, NC).
• When "P_Operation" (Q4.0) is switched off...
…the conveyor motor can be jogged to the right via the simulator switch "S_Right" (I 0.2) and
jogged to the left via the simulator switch "S_Left" (I 0.3).

• When "P_Operation" (Q4.0.) is switched on...


...parts are transported from Bay 1 or 2 through the light barrier. For this, the part must be placed
on the conveyor at exactly one of the two bays and the associated bay pushbutton pressed.
The indicator lights at Bays 1 and 2 show...
...a continuous light when a new part can be placed on the conveyor (conveyor motor is stopped
and both proximity sensors are free)
...a 1Hz flashing light at the bay on which a part is detected by the associated proximity sensor,
however, only as long as the conveyor has not yet been started (if parts are placed on the
conveyor at both proximity sensors, neither indicator light can light up)
...a 2Hz flashing light as long as the conveyor motor is running.
The indicator light at the light barrier bay shows a 2Hz flashing light as long as the conveyor
motor is running and continuous light when the setpoint quantity has been reached.

TIA-MICRO1 - Binary Operations


Training Document V13.01.01 7-3
SIMATIC S7-1200 Basic Course

7.2. Sensors and Check Symbols

Process Interpretation in the PLC Program

The The sensor Voltage Signal Check Check


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

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

not no “NO contact” “NC contact”


activated 0 “No” “Yes”
0 1

NC activated FBD: FBD:


no 0 “No” “Yes”
contact
& 0 & 1

not
activated yes 1 “Yes” “No”
1 0

Sensors of the Process


The use of normally open or normally closed contacts for the sensors in a controlled process
depends on the safety regulations for that process. Normally closed contacts are always used for
limit switches and safety switches, so that dangerous conditions do not arise if a wire break
occurs in the sensor circuit. Normally closed contacts are also used for switching off machinery
for the same reason.

Check Symbols of the Program


In LAD, a symbol with the name "NO contact" is used for checking for signal state "1" and a
symbol with the name "NC contact" to check for signal state "0". It makes no difference whether
the process signal "1" is supplied by an activated NO contact or a non-activated NC contact.
The "NO contact" symbol delivers the result of check or result of logic operation (RLO) "1" when
the checked operand has state or status "1".
The "NC contact" symbol delivers the result of check or result of logic operation (RLO) "1" when
the checked operand has state or status "0".

TIA-MICRO1 - Binary Operations


7-4 Training Document V13.01.01
SIMATIC S7-1200 Basic Course

7.3. Binary Logic Operations: AND, OR

AND FBD

LAD
Change the
operation

Change the
operation FBD

OR LAD

AND and OR Logic Operations


With the AND and OR logic operations, basically all binary operands can be queried, even
outputs. Instead of individual operands, the results of other logic operations can also be further
logically linked. Also, the logic operations can also be combined.
All inputs of the logic operations can be programmed as check for signal state or Status '0' and
'1', regardless of whether a hardware NO contact or NC contact is connected in the process.

AND Logic Operation


For an AND logic operation, the result of logic operation (RLO) = '1',
when all input signals have Status '1'.

OR Logic Operation
For an OR logic operation, the result of logic operation (RLO) = '1', when at least one input signal
has Status '1'.

TIA-MICRO1 - Binary Operations


Training Document V13.01.01 7-5
SIMATIC S7-1200 Basic Course

7.3.1. Binary Logic Operations: Exclusive OR (XOR)

FBD

LAD

XOR Logic Operation


With the XOR logic operation, basically all binary operands can be queried, even outputs. Instead
of individual operands, the results of other logic operations can also be further logically linked.
Also, the logic operations can also be combined.
All inputs of the logic operations can be programmed as check for signal state or Status '0' and
'1', regardless of whether a hardware NO contact or NC contact is connected in the process.

• For an XOR logic operation with 2 inputs, the result of logic operation (RLO) = '1', when one
and only one of the two input signals has Status '1'.
• For an XOR logic operation with more than 2 operands, the RLO ...
− = '1', when an uneven number of checked operands has Status '1'
− = '0', when an even number of checked operands has Status '1'.

XOR in the Programming Languages FBD and LAD


In the LAD programming language, there is no explicit XOR logic operation. It must be generated
by programming the discrete instructions shown in the picture above.

TIA-MICRO1 - Binary Operations


7-6 Training Document V13.01.01
SIMATIC S7-1200 Basic Course

7.3.2. Theory Exercise 1: Sensor and Check Symbols

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

E 1.0
I 1.0 EI 1.1
1.1 E 1.0
I 1.0 E 1.1
I 1.1 EI 1.0
1.0 E I1.1
1.1
Automation system Automation system Automation system
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
FBD
I 1.1 Q 4.0 I 1.1 Q 4.0 I 1.1 Q 4.0

Task
Complete the programs in the picture above so that the following functionality is fulfilled: When
the switch S1 is activated and the switch S2 is not activated, the light should be on in all three
examples.

Note
The terms - "NO contact" and "NC contact" - have different meanings depending on whether they
are used in the process-hardware-context or as check symbols in the software.

TIA-MICRO1 - Binary Operations


Training Document V13.01.01 7-7
SIMATIC S7-1200 Basic Course

7.4. Assignment, Set, Reset, NOT

FBD LAD

NOT

Change the
operation
Change the
operation

Assignment
With an assignment, the specified operand is always assigned the current RLO as status. The
assigned RLO remains available after the assignment and can be assigned to a further operand
or it can be further logically linked.

Set
If RLO = "1", the specified operand is assigned Status '1'; if RLO = "0", the status of the operand
remains unchanged.

Reset
If RLO = "1", the specified operand is assigned Status ' 0'; if RLO = "0", the status of the operand
remains unchanged.

NOT
The NOT instruction inverts the result of logic operation (RLO).
If, in the example shown, the RLO of the AND logic operation = '1', the NOT instruction inverts it
to RLO '0' and the Set instruction is not executed (the status of "Tag_3" (Q20.0) then remains
unchanged).
If the RLO of the AND logic operation = '0', the NOT instruction inverts it to RLO '1' and the Set
instruction is executed ("Tag_3" (Q20.0) is assigned Status '1').

TIA-MICRO1 - Binary Operations


7-8 Training Document V13.01.01
SIMATIC S7-1200 Basic Course

7.4.1. Flip Flops

Dominant Reset Dominant Set

FBD

LAD

Memory Function "Flip Flop"


A flip flop has a Set input and a Reset input. The operand is set or reset, depending on which
input has an RLO = "1".

Priority (Dominancy)
If there is a signal state or RLO = "1" at both inputs at the same time, the priority of the operation
decides whether the operand is set or reset. For that reason, there are different symbols for the
Dominant Set and Dominant Reset memory functions in LAD and FBD.

Note
With a CPU restart, all outputs are reset. That is, they are overwritten with Status '0'.

TIA-MICRO1 - Binary Operations


Training Document V13.01.01 7-9
SIMATIC S7-1200 Basic Course

7.5. Task Description: "FC_Mode" (FC15)

4711
DI 0V
I 0.0 S_OperationON
S_OperationOFF
I 0.1 (NC) -10V +10V
Poti
I 0.2 S_Right

I 0.3 S_Left
DO
P_Operation Q 4.0

Task Description
A mode section for the system is to be programmed in "FC_Mode" (FC15), which controls the
indicator light "P_Operation" (Q4.0). This is then to be linked in "FC_ConvMotor" (FC16) as a
further condition for jogging the conveyor motor.

• Function of the mode section in "FC_Mode" (FC15):


The system or "P_Operation" (Q4.0) is switched on via the simulator switch "S_OperationON"
(I 0.0) and switched off via the simulator switch "S_OperationOFF" (I 0.1, NC).

• Integrate "P_Operation" (Q4.0) in "FC_ConvMotor" (FC16):


The "Jogging the conveyor motor" programmed in FC 16 is now only to be possible when
"P_Operation" (Q4.0) is switched off.

TIA-MICRO1 - Binary Operations


7-10 Training Document V13.01.01
SIMATIC S7-1200 Basic Course

7.5.1. Exercise 2: Programming the "FC_Mode" (FC15) Block

Task
In "FC_Mode" (FC15) which is now to be created, program a mode section for the distribution
conveyor:
The operation or the indicator light "P_Operation" (Simulator LED Q4.0) is switched on via the
simulator switch "S_OperationON" (I 0.0) and is switched off via the simulator switch
"S_OperationOFF" (I 0.1, NC).

What to Do
1. Create the new block "FC_Mode" (FC15).
2. Open the "Instructions" Task Card, program the instructions shown in the picture using drag &
drop and use the absolute addresses shown.
3. Rename the tags used as shown in the picture.
4. In "FC_ConvMotor" (FC16), link the simulator LED "P_Operation" (Q4.0) logically in such a
way that the conveyor motor can only be jogged when this is switched off.
5. Download the modified blocks into the CPU and check the program function.

TIA-MICRO1 - Binary Operations


Training Document V13.01.01 7-11
SIMATIC S7-1200 Basic Course

7.5.2. Task Description: Parts Transportation when "P_Operation" (Q4.0) is


Switched On

Conv. Start Transport Phase Conv. Stop

"B_Bay1"
(I 8.5)

"S_Bay1"
(I 8.1)

"B_Bay2"
(I 8.6)

"S_Bay2"
(I 8.2)

"B_LB"
(I 8.0)

"K_Right"
(Q8.5)

Task Description:
When "P_Operation" (Q4.0) is switched ON, parts are to be transported from Bay 1 or Bay 2 to
the light barrier "B_LB" (I 8.0). The precondition is that a part is only placed on the conveyor at
one of the two bays. If parts are placed on the conveyor at both bays, no transport sequence can
be started.
• The conveyor motor "K_Right" (Q8.5) is started when
− on Bay 1 the proximity sensor "B_Bay1" (I 8.5) is occupied AND on Bay 2 the proximity
sensor "B_Bay2" (I 8.6) is NOT occupied AND the pushbutton at Bay 1 "S_Bay1" (I 8.1) is
pressed
OR
− on Bay 2 the proximity sensor "B_Bay2" (I 8.6) is occupied AND on Bay 1 the proximity
sensor "B_Bay1" (I 8.5) is NOT occupied AND the pushbutton at Bay 2 "S_Bay2" (I 8.2) is
pressed.
• The conveyor motor "K_Right" (Q8.5) is stopped when
− the part has reached the light barrier "B_LB" (I 8.0)
OR
− "P_Operation" (Q4.0) is switched off.

TIA-MICRO1 - Binary Operations


7-12 Training Document V13.01.01
SIMATIC S7-1200 Basic Course

7.5.3. Exercise 3: Expanding "FC_ConvMotor" (FC16)

Network x Jog conveyor motor RIGHT when Operation OFF

"M_Jog_Right"
Conditions for (M16.2) Memory bit for
jogging RIGHT jogging RIGHT
= when "P_Operation" OFF

Network y Memory bit Conveyor motor RIGHT when Operation ON

Conditions for "M_Auto_Right"


Memory bit Conv. motor RIGHT (M16.4)

S Memory bit for


Switch on
Conveyor motor RIGHT
when "P_Operation" ON
Switch off R

Network z Control conveyor motor RIGHT

"M_Jog_Right" >=1 "K_Right"


(M16.2) Conveyor motor RIGHT
(Q8.5)

"M_Auto_Right" =
(M16.4)

Task
Expand the "FC_ConvMotor" (FC16) block with the previously described functions.

Solution Notes
The conveyor motor "K_Right" (Q8.5) must now be controlled under two conditions:
when "P_Operation" (Q4.0) is switched off while jogging RIGHT (in the picture Network x). OR,
when "P_Operation" (Q4.0) is switched on, under the conditions described in the task (in the
picture Network y).
If, in both Network x and y, the result of logic operation of the conditions were each assigned to
the output "K_Right" (Q 8.5), an error in the form of a double assignment would occur. Jogging
the motor RIGHT in manual mode (Network x) would no longer function, since the state assigned
to the output here would then be overwritten in Network y.
The problem can be solved by programming a memory bit for each condition or by first assigning
the results of the logic operations to a memory bit in both Network x and y. These are then used
in the Network to control the conveyor motor.

What to Do
1. Open the "FC_ConvMotor" (FC16) block.
2. Program the required functions in new networks (see picture). Use the memory bits shown in
the picture and provide them with the symbols shown.
3. Modify the already existing network "Jog Right" as described in the solution notes.
4. Download the expanded block into the CPU and check the program function.

TIA-MICRO1 - Binary Operations


Training Document V13.01.01 7-13
SIMATIC S7-1200 Basic Course

7.6. Task Description: Parts Transportation THROUGH the Light


Barrier

Conv. Start Transport Phase Conv. Stop

Part within
light barrier
Start condition
for transports

"B_LB"
(I 8.0)

"K_Right"
(Q8.5)
Up to now NEW

Function Up to Now in FC16


When "P_Operation" (Q4.0 = '0') is switched off, you can jog the conveyor motor "K_Right" (Q8.5)
using the simulator switches "S_Right" (I 0.2) and "S_Left" (I 0.3).
When "P_Operation" (Q4.0) is switched on, the conveyor motor "K_Right" (Q 8.5) is switched on
when a part is placed on the conveyor exactly in front of one of the proximity sensors of Bay 1 or
2, and the occupied bay‘s pushbutton is pressed.
The conveyor motor "K_Right" (Q8.5) is stopped when the part has reached the light barrier or
"P_Operation" (Q4.0) is switched off.

Task Description:
The function of the "FC_ConvMotor" (FC16) to control the conveyor motor when "P_Operation"
(Q4.0) is switched on is to remain fundamentally unchanged. However, the conveyor motor is
only to stop when the part has passed through the light barrier.

TIA-MICRO1 - Binary Operations


7-14 Training Document V13.01.01
SIMATIC S7-1200 Basic Course

7.6.1. Operand Edge Evaluations

"Scan operand for positive "Set operand on positive "Set tag on positive
signal edge" signal edge" signal edge"

(FB Evaluation)

"B_LB"

"M_edge_LB" OB1 OB1 OB1


cycle cycle cycle

Scan Operand for Positive Signal Edge


If the state of the operand at the input to the box changes from '0' to '1' ("rising edge"), RLO '1' is
output at the output to the box for the duration of one program cycle.

Set Operand on Positive Signal Edge


This has the same behavior as with "scan operand for positive signal edge" whereby, however,
the input signal (in the example "B_LB") is output at the output of the box and thus is available for
further logic operations.

Set Tag on Positive Signal Edge


This has the same behavior as with "scan operand for positive signal edge" whereby, however,
the evaluation occurs via a library function block (FB1001/1002) which is passed an instance data
block, or which can also be created as a multiple instance within another FB.

Note:
The instructions compare the current signal state of the input "B_LB" with the signal state in the
previous cycle which is stored in an edge memory bit "M_aux_LB" or in the instance DB
"DB_R_TRIG". When the instruction detects a change from "0" to "1", a positive signal edge
exists. Subsequently, the current signal state is stored in the edge memory bit or in the instance
DB. The status of the edge memory bit and the contents of the IDB must not be overwritten at
another location in the program.

TIA-MICRO1 - Binary Operations


Training Document V13.01.01 7-15
SIMATIC S7-1200 Basic Course

7.6.2. RLO Edge Evaluation

FBD LAD

"B_LB"

"K_Right"

& RLO

"M_Imp_pos" OB1 OB1


cycle cycle
"M_Imp_neg" OB1 OB1
cycle cycle

RLO Edge Evaluation (P_TRIG, N_TRIG)


With an RLO edge evaluation, it is possible to detect whether the status of a logic operation (in
the example an AND RLO) has changed from '0' to '1' (rising or positive edge) or from '1' to '0'
(falling or negative edge). If this is the case the instruction supplies, for the duration of one cycle,
RLO '1' as the result, which can be further logically linked or can be assigned to another operand
(in the example, the memory bit "M_Imp_pos" (M16.1)) as status. In the following cycle, the
instruction then once again supplies '0' as the result even if the AND RLO still is status '1'.
The instruction compares the current result or the RLO of the logic operation with its RLO in the
previous program cycle. This is stored in a so-called edge memory bit for this (in the example
"M_aux"). It must be ensured that the status of this edge memory bit is not overwritten at another
location in the program. For every RLO edge evaluation, a separate edge memory bit must be
used accordingly, even then when the same operand (in the example, AND RLO) is evaluated
once again, for example, in another block!

TIA-MICRO1 - Binary Operations


7-16 Training Document V13.01.01
SIMATIC S7-1200 Basic Course

7.6.3. Exercise 4: Integrating an Edge Evaluation in "FC_ConvMotor" (FC16)

Conv. Start Transport Phase Conv. Stop

Part within
light barrier
Start condition
for transports

"B_LB"
(I 8.0)

"K_Right"
(Q8.5)
Up to now NEW

Task:
When "P_Operation" (Q4.0 = '1') is switched on, the parts are to be transported from Bay 1 or 2
THROUGH the light barrier.

What to Do:
1. Program the necessary changes in "FC_ConvMotor" (FC16), by now linking the result of the
edge evaluation as the reset condition for M16.4 (bit memory for conveyor motor RIGHT)
instead of the light barrier signal "B_LB" (I 8.0) itself. For the necessary edge evaluation of the
light barrier signal use the bit memory "M_aux_LB" (M16.0) as an edge memory bit.
2. Download the modified "FC_ConvMotor (FC16) block into the CPU and check the program
function.

TIA-MICRO1 - Binary Operations


Training Document V13.01.01 7-17
SIMATIC S7-1200 Basic Course

7.7. Task Description: Controlling the Indicator Lights

"B_Bay1" "B_Bay2"
(I 8.5) (I 8.6)

"P_Bay1" "P_Bay2" "P_Bay_LB"


(Q 8.1) (Q 8.2) (Q 8.4)

Task Description
When "P_Operation" (Q4.0) is switched on, the indicators lights are to be controlled as follows:
• The indicator lights "P_Bay1" (Q8.1) and "P_Bay2" (Q8.2) show
− a constant light when a new part can be placed on the conveyor (conveyor motor is
stopped and both proximity sensors are free)
− 1Hz flashing light at the bay where the associated proximity sensor detects a part, but only
as long as the conveyor has not yet been started (if parts are placed on the conveyor at
both proximity sensors, neither indicator light must light up)
− 2Hz flashing light as long as the conveyor motor is running
• The indicator light at the light barrier bay "P_Bay_LB" (Q8.4) shows 2Hz flashing light as long
as the conveyor motor is running.
The described functions are already programmed in the "FC_Indicate" (FC14) block, which is
stored in the "Micro1_Lib" global library. The block still contains errors and is to be commissioned
by you in the next exercise.

TIA-MICRO1 - Binary Operations


7-18 Training Document V13.01.01
SIMATIC S7-1200 Basic Course

7.7.1. Exercise 5: Commissioning "FC_Indicate" (FC14)

Task
The "FC_Indicate" block is to be copied from the "Micro1_Lib" global library into the project and
commissioned.

What to Do
1. Using drag & drop, copy the "FC_Indicate" (FC14) block into the "Program blocks" container
from the "Micro1_Lib" global library (as shown in the picture).
2. Program the call of "FC_Indicate" (FC14) in "OB_Cycle" (OB1)
3. Download all modified blocks into the CPU.
4. Test the program function and correct the block in such a way that the indicator lights are
controlled as required. To do so, use the test function "Monitor block", even if you have
already recognized the error!

TIA-MICRO1 - Binary Operations


Training Document V13.01.01 7-19
SIMATIC S7-1200 Basic Course

7.8. Additional Information

TIA-MICRO1 - Binary Operations


7-20 Training Document V13.01.01
SIMATIC S7-1200 Basic Course

7.8.1. Additional Exercise 6: Optimizing "FC_Mode" (FC15)

OLD: without edge evaluation


"S_OperationON"
(I 0.0)

"S_OperationOFF"
(I 0.1, NC)

"P_Operation"
(Q4.0)

NEW: with edge evaluation


"S_OperationON"
(I 0.0)

"S_OperationOFF"
(I 0.1, NC)

"P_Operation"
(Q4.0)

Function Up to Now of "FC_Mode" (FC15)


"P_Operation" (Q4.0) is switched on with the simulator switch "S_OperationON" (I 0.0) and
switched off with the simulator switch "S_OperationOFF" (I 0.1, NC). If you activate both switches
simultaneously, the operation remains switched off or is switched off if currently on. If, however,
both switches are activated and the OFF switch is let go while the ON switch is activated, the
operation switches back on without the ON switch having to be activated again (see picture,
upper function diagram "OLD: without edge evaluation").

Task:
Expand the functionality of "FC_Mode" (FC15) using edge evaluation so that the ON switch must
be activated every time the operation is switched on (see picture, lower function diagram "NEW:
with edge evaluation"). The criteria for switching on the system is no longer to be the activated
ON switch or its "1" signal, but the function of activating or the "positive edge" of the ON switch
signal.

What to Do:
1. In the set condition for "P_Operation" (Q4.0), insert an edge evaluation of the switch
"S_OperationON" (I 0.0). For the edge evaluation, use the bit memory "M_aux_Op_on"
(M15.0) as edge memory bit.
2. Download the modified "FC_Mode" (FC15) block into the CPU and check whether it fulfils the
desired functions!

TIA-MICRO1 - Binary Operations


Training Document V13.01.01 7-21
SIMATIC S7-1200 Basic Course

7.8.2. Setting / Resetting Bit Fields

7 6 54 3 21 0
MB10 0000 0000
MB11 0000 0000

MB10 1100 0000


MB11 0000 0111

Reset several bits


starting from a
specific address

MB10 0000 0000


MB11 0000 0000

Setting / Resetting a Bit Field RESET_BF


With the operation "Reset bit field" (RESET_BF), several bits starting from a specific address can
be reset. The number of bits which are to be reset can be determined via the Parameter N.
Through the operation, the bit with the lowest address in the bit field must be specified. The bits
are reset in ascending bit and byte address.
The operation is only executed if an RLO ‘1’ exists at input EN. For RLO ‘0’, the operation is not
executed.

TIA-MICRO1 - Binary Operations


7-22 Training Document V13.01.01
SIMATIC S7-1200 Basic Course

7.8.3. Jump Instructions JMP, JMPN, RET

Jump if RLO='1' Jump if RLO='0'

Jump Instructions JMP and JMPN


With the jump instructions JMP and JMPN, the linear execution of the program can be interrupted
within a block and continued in another network. With the jump instruction, a Label is specified
which also identifies the target network. The specified label must be located in the same block
and be unique. Each label can be jumped to from several locations. The jump can take place in
networks with higher (forwards) or lower numbers (backwards).

• JMP:
If RLO ='1', the jump into the target network is executed; if RLO ='0', the jump is not executed
and the linear program execution continues.
• JMPN:
If RLO ='0', the jump into the target network is executed; if RLO ='1', the jump is not executed
and the linear program execution continues.

End Block Execution RET


With the instruction RET the program execution of the entire block is ended. The program
execution is then continued in the calling block with the instruction that follows the call of this
block.

TIA-MICRO1 - Binary Operations


Training Document V13.01.01 7-23

You might also like