Table of Contents
Ladder Logic (LAD) for S7-300 and S7-400
Programming
10
Reference Manual, 04/2017, A5E41524738-AA
10.8
Call Block from a Library ............................................................................................................ 118
10.9
Important Notes on Using MCR Functions ................................................................................ 119
10.10
---(MCR<) Master Control Relay On ......................................................................................... 120
10.11
---(MCR>) Master Control Relay Off ......................................................................................... 122
10.12
---(MCRA) Master Control Relay Activate ................................................................................. 124
10.13
---(MCRD) Master Control Relay Deactivate ............................................................................ 125
10.14
---(RET) Return ......................................................................................................................... 126
11
Shift and Rotate Instructions ................................................................................................................. 127
11.1
Shift Instructions......................................................................................................................... 127
11.1.1
Overview of Shift Instructions .................................................................................................... 127
11.1.2
SHR_I Shift Right Integer .......................................................................................................... 128
11.1.3
SHR_DI Shift Right Double Integer........................................................................................... 130
11.1.4
SHL_W Shift Left Word ............................................................................................................. 131
11.1.5
SHR_W Shift Right Word .......................................................................................................... 133
11.1.6
SHL_DW Shift Left Double Word .............................................................................................. 134
11.1.7
SHR_DW Shift Right Double Word ........................................................................................... 135
11.2
Rotate Instructions ..................................................................................................................... 137
11.2.1
Overview of Rotate Instructions ................................................................................................. 137
11.2.2
ROL_DW Rotate Left Double Word0 ........................................................................................ 137
11.2.3
ROR_DW Rotate Right Double Word ....................................................................................... 139
12
Status Bit Instructions ............................................................................................................................ 141
12.1
Overview of Statusbit Instructions.............................................................................................. 141
12.2
OV ---| |--- Exception Bit Overflow .......................................................................................... 142
12.3
OS ---| |--- Exception Bit Overflow Stored ............................................................................... 143
12.4
UO ---| |--- Exception Bit Unordered ....................................................................................... 145
12.5
BR ---| |--- Exception Bit Binary Result ................................................................................... 146
12.6
==0 ---| |--- Result Bit Equal 0 ................................................................................................. 147
12.7
<>0 ---| |--- Result Bit Not Equal 0 .......................................................................................... 148
12.8
>0 ---| |--- Result Bit Greater Than 0 ....................................................................................... 149
12.9
<0 ---| |--- Result Bit Less Than 0 ............................................................................................ 150
12.10
>=0 ---| |--- Result Bit Greater Equal 0 .................................................................................... 151
12.11
<=0 ---| |--- Result Bit Less Equal 0 ........................................................................................ 152
13
Timer Instructions ................................................................................................................................... 153
13.1
Overview of Timer Instructions .................................................................................................. 153
13.2
Location of a Timer in Memory and Components of a Timer .................................................... 154
13.3
S_PULSE Pulse S5 Timer ........................................................................................................ 157
13.4
S_PEXT Extended Pulse S5 Timer........................................................................................... 159
13.5
S_ODT On-Delay S5 Timer ...................................................................................................... 161
13.6
S_ODTS Retentive On-Delay S5 Timer .................................................................................... 163
13.7
S_OFFDT Off-Delay S5 Timer .................................................................................................. 165
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
13
1
Bit Logic Instructions
1.1
Overview of Bit Logic Instructions
Description
Bit logic instructions work with two digits, 1 and 0. These two digits form the base of a number
system called the binary system. The two digits 1 and 0 are called binary digits or bits. In
the world
of contacts and coils, a 1 indicates activated or energized, and a 0 indicates not activated or not
energized.
The bit logic instructions interpret signal states of 1 and 0 and combine them according to Boolean
logic. These combinations produce a result of 1 or 0 that is called the "result of logic operation"
(RLO).
The logic operations that are triggered by the bit logic instructions perform a variety of functions.
There are bit logic instructions to perform the following functions:
•
---| |--- Normally Open Contact (Address)
•
---| / |--- Normally Closed Contact (Address)
•
---(SAVE) Save RLO into BR Memory
•
XOR Bit Exclusive OR
•
---( )
Output Coil
•
---( # )--- Midline Output
•
---|NOT|--- Invert Power Flow
The following instructions react to an RLO of 1:
•
---( S ) Set Coil
•
---( R ) Reset Coil
•
SR Set-Reset Flip Flop
•
RS
Reset-Set Flip Flop
Other instructions react to a positive or negative edge transition to perform the following functions:
•
---(N)--- Negative RLO Edge Detection
•
---(P)--- Positive RLO Edge Detection
•
NEG Address Negative Edge Detection
•
POS Address Positive Edge Detection
•
Immediate Read
•
Immediate Write
Bit Logic Instructions
1.2 ---| |--- Normally Open Contact (Address)
Ladder Logic (LAD) for S7-300 and S7-400 Programming
14
Reference Manual, 04/2017, A5E41524738-AA
1.2
---| |--- Normally Open Contact (Address)
Symbol
---| |---
Parameter
Data Type
Memory Area
Description
BOOL
I, Q, M, L, D, T, C
Checked bit
Description
---| |--- (Normally Open Contact) is closed when the bit value stored at the specified is
equal to "1". When the contact is closed, ladder rail power flows across the contact and the result
of logic operation (RLO) = "1".
Otherwise, if the signal state at the specified
is "0", the contact is open. When the
contact is open, power does not flow across the contact and the result of logic operation (RLO) =
"0".
When used in series,
---| |--- is linked to the RLO bit by AND logic. When used in parallel, it is
linked to the RLO by OR logic.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
-
-
-
-
-
X
X
X
1
Example
I 0.0
I 0.1
I 0.2
Power flows if one of the following conditions exists:
The signal state is "1" at inputs I0.0 and I0.1
Or the signal state is "1" at input I0.2
Bit Logic Instructions
1.3 ---| / |--- Normally Closed Contact (Address)
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
15
1.3
---| / |--- Normally Closed Contact (Address)
Symbol
---| / |---
Parameter
Data Type
Memory Area
Description
BOOL
I, Q, M, L, D, T, C
Checked bit
Description
---| / |---
(Normally Closed Contact) is closed when the bit value stored at the specified
is equal to "0". When the contact is closed, ladder rail power flows across the contact and the result
of logic operation (RLO) = "1".
Otherwise, if the signal state at the specified
is "1", the contact is opened. When the
contact is opened, power does not flow across the contact and the result of logic operation (RLO) =
"0".
When used in series, ---| / |--- is linked to the RLO bit by AND logic. When used in parallel, it is
linked to the RLO by OR logic.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
-
-
-
-
-
X
X
X
1
Example
I 0.0
I 0.1
I 0.2
Power flows if one of the following conditions exists:
The signal state is "1" at inputs I0.0 and I0.1
Or the signal state is "0" at input I0.2
1.4
XOR Bit Exclusive OR
For the XOR function, a network of normally open and normally closed contacts must be created as
shown below.
Bit Logic Instructions
1.5 --|NOT|-- Invert Power Flow
Ladder Logic (LAD) for S7-300 and S7-400 Programming
16
Reference Manual, 04/2017, A5E41524738-AA
Symbols
Parameter
Data Type
Memory Area
Description
BOOL
I, Q, M, L, D, T, C
Scanned bit
BOOL
I, Q, M, L, D, T, C
Scanned bit
Description
XOR (Bit Exclusive OR) creates an RLO of "1" if the signal state of the two specified bits is
different.
Example
I 0.0
I 0.0
I 0.1
Q 4.0
I 0.1
The output Q4.0 is "1" if (I0.0 = "0" AND I0.1 = "1") OR (I0.0 = "1" AND I0.1 = "0").
1.5
--|NOT|-- Invert Power Flow
Symbol
---|NOT|---
Description
---|NOT|--- (Invert Power Flow) negates the RLO bit.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
-
-
-
-
-
-
1
X
-
Bit Logic Instructions
1.6 ---( ) Output Coil
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
17
Example
I 0.0
NOT
I 0.2
I 0.1
Q 4.0
The signal state of output Q4.0 is "0" if one of the following conditions exists:
The signal state is "1" at input I0.0
Or the signal state is "1" at inputs I0.1 and I0.2.
1.6
---( ) Output Coil
Symbol
---( )
Parameter
Data Type
Memory Area
Description
BOOL
I, Q, M, L, D
Assigned bit
Description
---( ) (Output Coil) works like a coil in a relay logic diagram. If there is power flow to the coil (RLO
= 1), the bit at location
is set to "1". If there is no power flow to the coil (RLO = 0), the
bit at location
is set to "0". An output coil can only be placed at the right end of a ladder
rung. Multiple output elements (max. 16) are possible (see example). A negated output can be
created by using the ---|NOT|--- (invert power flow) element.
MCR (Master Control Relay) dependency
MCR dependency is activated only if an output coil is placed inside an active MCR zone. Within an
activated MCR zone, if the MCR is on and there is power flow to an output coil; the addressed bit is
set to the current status of power flow. If the MCR is off, a logic "0" is written to the specified
address regardless of power flow status.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
-
-
-
-
-
0
X
-
0
Bit Logic Instructions
1.7 ---( # )--- Midline Output
Ladder Logic (LAD) for S7-300 and S7-400 Programming
18
Reference Manual, 04/2017, A5E41524738-AA
Example
I 0.0
I 0.1
I 0.2
Q 4.0
Q 4.1
I 0.3
The signal state of output Q4.0 is "1" if one of the following conditions exists:
The signal state is "1" at inputs I0.0 and I0.1
Or the signal state is "0" at input I0.2.
The signal state of output Q4.1 is "1" if one of the following conditions exists:
The signal state is "1" at inputs I0.0 and I0.1
Or the signal state is "0" at input I0.2 and "1" at input I0.3
If the example rungs are within an activated MCR zone:
When MCR is on, Q4.0 and Q4.1 are set according to power flow status as described above.
When MCR is off (=0), Q4.0 and Q4.1 are reset to 0 regardless of power flow.
0>
Dostları ilə paylaş: