12.5
BR ---| |--- Exception Bit Binary Result
Symbol
or negation
/
BR
BR
Description
BR ---| |--- (Exception Bit BR Memory) or BR ---| / |--- (Negated Exception Bit BR Memory)
contact symbols are used to test the logic state of the BR bit in the status word. Used in series, the
result of the scan is linked to the RLO by AND, used in parallel, it is linked to the RLO by OR. The
BR bit is used in the transition from word to bit processing.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
-
-
-
-
-
x
x
x
1
Example
I 0.0
BR
I 0.2
S
Q 4.0
Q4.0 is set if I0.0 is "1" or I0.2 is "0" and in addition to this RLO the logic state of the BR bit is "1".
Status Bit Instructions
12.6 ==0 ---| |--- Result Bit Equal 0
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
147
12.6
==0 ---| |--- Result Bit Equal 0
Symbol
or negation
/
==0
==0
Description
==0 ---| |--- (Result Bit Equal 0) or ==0 ---| / |--- (Negated Result Bit Equal 0) contact symbols are
used to recognize if the result of a math function is equal to "0". The instructions scan the condition
code bits CC 1 and CC 0 in the status word in order to determine the relation of the result to "0".
Used in series, the result of the scan is linked to the RLO by AND, used in parallel, it is linked to the
RLO by OR.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
-
-
-
-
-
x
x
x
1
Examples
SUB_I
EN
OUT
IN2
ENO
IN1
IW2
IW0
MW10
I 0.0
==0
S
Q 4.0
The box is activated by signal state "1" at I0.0. If the value of IW0 is equal to the value of IW2, the
result of the math function "IW0 - IW2" is "0". Q4.0 is set if the function is properly executed and the
result is
equal to "0".
SUB_I
EN
OUT
IN2
ENO
IN1
IW2
IW0
MW10
I 0.0
==0
S
Q 4.0
Q4.0 is set if the function is properly executed and the result is
not equal to "0".
Status Bit Instructions
12.7 <>0 ---| |--- Result Bit Not Equal 0
Ladder Logic (LAD) for S7-300 and S7-400 Programming
148
Reference Manual, 04/2017, A5E41524738-AA
12.7
<>0 ---| |--- Result Bit Not Equal 0
Symbol
or negation
/
<>0
<>0
Description
<>0 ---| |--- (Result Bit Not Equal 0) or <>0 ---| / |--- (Negated Result Bit Not Equal 0) contact
symbols are used to recognize if the result of a math function is not equal to "0". The instructions
scan the condition code bits CC 1 and CC 0 in the status word in order to determine the relation of
the result to "0". Used in series, the result of the scan is linked to the RLO by AND, used in parallel,
it is linked to the RLO by OR.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
-
-
-
-
-
x
x
x
1
Examples
SUB_I
EN
OUT
IN2
ENO
IN1
IW2
IW0
MW10
I 0.0
<>0
S
Q 4.0
The box is activated by signal state "1" at I0.0. If the value of IW0 is different to the value of IW2,
the result of the math function "IW0 - IW2" is not equal to "0". Q4.0 is set if the function is properly
executed and the result is
not equal to "0".
SUB_I
EN
OUT
IN2
ENO
IN1
IW2
IW0
MW10
I 0.0
<>0
S
Q 4.0
Q4.0 is set if the function is properly executed and the result is
equal to "0".
Status Bit Instructions
12.8 >0 ---| |--- Result Bit Greater Than 0
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
149
12.8
>0 ---| |--- Result Bit Greater Than 0
Symbol
or negation
/
>0
>0
Description
>0 ---| |--- (Result Bit Greater Than 0) or >0 ---| / |--- (Negated Result Bit Greater Than Zero)
contact symbols are used to recognize if the result of a math function is greater than "0". The
instructions scan the condition code bits CC 1 and CC 0 in the status word in order to determine
the relation to "0". Used in series, the result of the scan is linked to the RLO by AND, used in
parallel, it is linked to the RLO by OR.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
-
-
-
-
-
x
x
x
1
Example
SUB_I
EN
OUT
IN2
ENO
IN1
IW2
IW0
MW10
I 0.0
>0
S
Q 4.0
The box is activated by signal state "1" at I0.0. If the value of IW0 is higher than the value of IW2,
the result of the math function "IW0 - IW2" is greater than "0". Q4.0 is set if the function is properly
executed and the result is
greater than "0".
SUB_I
EN
OUT
IN2
ENO
IN1
IW2
IW0
MW10
I 0.0
>0
S
Q 4.0
Q4.0 is set if the function is properly executed and the result is
not greater than "0".
Status Bit Instructions
12.9 <0 ---| |--- Result Bit Less Than 0
Ladder Logic (LAD) for S7-300 and S7-400 Programming
150
Reference Manual, 04/2017, A5E41524738-AA
12.9
<0 ---| |--- Result Bit Less Than 0
Symbol
or negation
/
<0
<0
Description
<0 ---| |--- (Result Bit Less Than 0) or <0 ---| / |--- (Negated Result Bit Less Than 0) contact
symbols are used to recognize if the result of a math function is less than "0". The instructions scan
the condition code bits CC 1 and CC 0 in the status word in order to determine the relation of the
result to "0". Used in series, the result of the scan is linked to the RLO by AND, used in parallel, it is
linked to the RLO by OR.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
-
-
-
-
-
x
x
x
1
Example
SUB_I
EN
OUT
IN2
ENO
IN1
IW2
IW0
MW10
I 0.0
<0
S
Q 4.0
The box is activated by signal state "1" at I0.0. If the value of IW0 is lower than the value of IW2,
the result of the math function "IW0 - IW2" is less than "0". Q4.0 is set if the function is properly
executed and the result is
less than "0".
SUB_I
EN
OUT
IN2
ENO
IN1
IW2
IW0
MW10
I 0.0
<0
S
Q 4.0
Q4.0 is set if the function is properly executed and the result is
not less than "0".
Status Bit Instructions
12.10 >=0 ---| |--- Result Bit Greater Equal 0
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
151
12.10 >=0 ---| |--- Result Bit Greater Equal 0
Symbol
or negation
/
>=0
>=0
Description
>=0 ---| |--- (Result Bit Greater Equal 0) or >=0 ---| / |--- (Negated Result Bit Greater Equal 0)
contact symbols are used to recognize if the result of a math function is greater than or equal to
"0". The instructions scan the condition code bits CC 1 and CC 0 in the status word in order to
determine the relation to "0". Used in series, the result of the scan is linked to the RLO by AND,
used in parallel, it is linked to the RLO by OR.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
-
-
-
-
-
x
x
x
1
Example
SUB_I
EN
OUT
IN2
ENO
IN1
IW2
IW0
MW10
I 0.0
>=0
S
Q 4.0
The box is activated by signal state "1" at I0.0. If the value of IW0 is higher or equal to the value of
IW2, the result of the math function "IW0 - IW2" is greater than or equal to "0". Q4.0 is set if the
function is properly executed and the result is
greater than or equal to "0".
SUB_I
EN
OUT
IN2
ENO
IN1
IW2
IW0
MW10
I 0.0
>=0
S
Q 4.0
Q4.0 is set if the function is properly executed and the result is
not greater than or equal to "0".
Status Bit Instructions
12.11 <=0 ---| |--- Result Bit Less Equal 0
Ladder Logic (LAD) for S7-300 and S7-400 Programming
152
Reference Manual, 04/2017, A5E41524738-AA
12.11 <=0 ---| |--- Result Bit Less Equal 0
Symbol
or negation
/
<=0
<=0
Description
<=0 ---| |--- (Result Bit Less Equal 0) or <=0 ---| / |--- (Negated Result Bit Less Equal 0) contact
symbols are used to recognize if the result of a math function is less than or equal to "0". The
instructions scan the condition code bits CC 1 and CC 0 in the status word in order to determine
the relation of the result to "0". Used in series, the result of the scan is linked to the RLO by AND,
used in parallel, it is linked to the RLO by OR.
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
-
-
-
-
-
x
x
x
1
Examples
SUB_I
EN
OUT
IN2
ENO
IN1
IW2
IW0
MW10
I 0.0
<=0
S
Q 4.0
The box is activated by signal state "1" at I0.0. If the value of IW0 is less than or equal to the value
of IW2 the result of the math function "IW0 - IW2" is less than or equal to "0". Q4.0 is set if the
function is well properly executed and the result is
less than or equal to "0".
SUB_I
EN
OUT
IN2
ENO
IN1
IW2
IW0
MW10
I 0.0
<=0
S
Q 4.0
Q4.0 is set if the function is properly executed and the result is
not less than or equal to "0".
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
153
13
Timer Instructions
13.1
Overview of Timer Instructions
Description
- You can find information for setting and selecting the correct time under "Location of a
Timer in Memory and Components of a Timer".
The following timer instructions are available:
•
S_PULSE Pulse S5 Timer
•
S_PEXT Extended Pulse S5 Timer
•
S_ODT On-Delay S5 Timer
•
S_ODTS Retentive On-Delay S5 Timer
•
S_OFFDT Off-Delay S5 Timer
•
---( SP ) Pulse Timer Coil
•
---( SE ) Extended Pulse Timer Coil
•
---( SD ) On-Delay Timer Coil
•
---( SS ) Retentive On-Delay Timer Coil
•
---( SA ) Off-Delay Timer Coil
Timer Instructions
13.2 Location of a Timer in Memory and Components of a Timer
Ladder Logic (LAD) for S7-300 and S7-400 Programming
154
Reference Manual, 04/2017, A5E41524738-AA
13.2
Location of a Timer in Memory and Components of a Timer
Area in Memory
Timers have an area reserved for them in the memory of your CPU. This memory area reserves
one 16-bit word for each timer address. The ladderlogic instruction set supports 256 timers. Please
refer to your CPU’s technical information to establish the number of timer words available.
The following functions have access to the timer memory area:
•
Timer instructions
•
Updating of timer words by means of clock timing. This function of your CPU in the RUN mode
decrements a given time value by one unit at the interval designated by the time base until the
time value is equal to zero.
Time Value
Bits 0 through 9 of the timer word contain the time value in binary code. The time value specifies a
number of units. Time updating decrements the time value by one unit at an interval designated by
the time base. Decrementing continues until the time value is equal to zero. You can load a time
value into the low word of accumulator 1 in binary, hexadecimal, or binary coded decimal (BCD)
format.
You can pre-load a time value using either of the following formats:
•
W#16#wxyz
- Where w = the time base (that is, the time interval or resolution)
- Where xyz = the time value in binary coded decimal format
•
S5T#a
H_b M_c S_d MS
- Where H = hours, M = minutes, S = seconds, and MS = milliseconds;
a, b, c, d are defined by the user.
- The time base is selected automatically, and the value is rounded to the next lower number
with that time base.
The maximum time value that you can enter is 9,990 seconds, or 2H_46M_30S.
S5TIME#4S = 4 seconds
s5t#2h_15m = 2 hours and 15 minutes
S5T#1H_12M_18S = 1 hour, 12 minutes, and 18 seconds
Timer Instructions
13.2 Location of a Timer in Memory and Components of a Timer
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
155
Time Base
Bits 12 and 13 of the timer word contain the time base in binary code. The time base defines the
interval at which the time value is decremented by one unit. The smallest time base is 10 ms; the
largest is 10 s.
Time Base
Binary Code for the Time Base
10 ms
00
100 ms
01
1 s
10
10 s
11
Values that exceed 2h46m30s are not accepted. A value whose resolution is too high for the range
limits (for example, 2h10ms) is truncated down to a valid resolution. The general format for S5TIME
has limits to range and resolution as shown below:
Resolution
Range
0.01 second
10MS to 9S_990MS
0.1 second
100MS to 1M_39S_900MS
1 second
1S to 16M_39S
10 seconds
10S to 2H_46M_30S
Bit Configuration in the Time Cell
When a timer is started, the contents of the timer cell are used as the time value. Bits 0 through 11
of the timer cell hold the time value in binary coded decimal format (BCD format: each set of four
bits contains the binary code for one decimal value). Bits 12 and 13 hold the time base in binary
code.
The following figure shows the contents of the timer cell loaded with timer value 127 and a time
base of 1 second:
x x 1 0
15...
...8 7...
...0
0 0 0 1 0 0 1 0 0 1 1 1
1
2
7
Time value in BCD (0 to 999)
Time base
1 second
Irrelevant: These bits are ignored when the timer is started.
Timer Instructions
13.2 Location of a Timer in Memory and Components of a Timer
Ladder Logic (LAD) for S7-300 and S7-400 Programming
156
Reference Manual, 04/2017, A5E41524738-AA
Reading the Time and the Time Base
Each timer box provides two outputs, BI and BCD, for which you can indicate a word location. The
BI output provides the time value in binary format. The BCD output provides the time base and the
time value in binary coded decimal (BCD) format.
Choosing the right Timer
This overview is intended to help you choose the right timer for your timing job.
t
t
t
t
t
I 0.0
Q 4.0 S_PULSE
Q 4.0 S_PEXT
Q 4.0 S_ODT
Q 4.0 S_ODTS
Q 4.0 S_OFFDT
Timer
Description
S_PULSE
Pulse timer
The maximum time that the output signal remains at 1 is the same as the
programmed time value t. The output signal stays at 1 for a shorter period if the
input signal changes to 0.
S_PEXT
Extended pulse timer
The output signal remains at 1 for the programmed length of time, regardless
of how long the input signal stays at 1.
S_ODT
On-delay timer
The output signal changes to 1 only when the programmed time has elapsed
and the input signal is still 1.
S_ODTS
Retentive on-delay timer
The output signal changes from 0 to 1 only when the programmed time has
elapsed, regardless of how long the input signal stays at 1.
S_OFFDT
Off-delay timer
The output signal changes to 1 when the input signal changes to 1 or while the
timer is running. The time is started when the input signal changes from 1 to 0.
Timer Instructions
13.3 S_PULSE Pulse S5 Timer
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
157
13.3
S_PULSE Pulse S5 Timer
Symbol
S_PULSE
BI
TV
R
BCD
S_IMPULS
DUAL
TW
S
Q
English
German
T no.
T-Nr.
S
Q
R
DEZ
Parameter
English
Parameter
German
Data Type
Memory Area
Description
T no.
T-Nr.
TIMER
T
Timer identification number;
range depends on CPU
S
S
BOOL
I, Q, M, L, D
Start input
TV
TW
S5TIME
I, Q, M, L, D
Preset time value
R
R
BOOL
I, Q, M, L, D
Reset input
BI
DUAL
WORD
I, Q, M, L, D
Remaining time value, integer
format
BCD
DEZ
WORD
I, Q, M, L, D
Remaining time value, BCD
format
Q
Q
BOOL
I, Q, M, L, D
Status of the timer
Description
S_PULSE (Pulse S5 Timer) starts the specified timer if there is a positive edge at the start (S)
input. A signal change is always necessary in order to enable a timer. The timer runs as long as the
signal state at input S is "1", the longest period, however, is the time value specified by input TV.
The signal state at output Q is "1" as long as the timer is running. If there is a change from "1" to
"0" at the S input before the time interval has elapsed the timer will be stopped. In this case the
signal state at output Q is "0".
The timer is reset when the timer reset (R) input changes from "0" to "1" while the timer is running.
The current time and the time base are also set to zero. Logic "1" at the timer's R input has no
effect if the timer is not running.
The current time value can be scanned at the outputs BI and BCD. The time value at BI is binary
coded, at BCD it is BCD coded. The current time value is the initial TV value minus the time
elapsed since the timer was started.
Timer Instructions
13.3 S_PULSE Pulse S5 Timer
Ladder Logic (LAD) for S7-300 and S7-400 Programming
158
Reference Manual, 04/2017, A5E41524738-AA
Timing Diagram
Pulse timer characteristics:
t
t
t
t = Programmed time
RLO at S input
RLO at R input
Timer running
Scan for "1"
Scan for "0"
Status word
BR
CC 1
CC 0
OV
OS
OR
STA
RLO
/FC
writes:
-
-
-
-
-
x
x
x
1
Example
S_PULSE
S
Q
BI
TV
R
BCD
I 0.0
I 0.1 S5TIME#2S
Q 4.0
T 5
If the signal state of input I0.0 changes from "0" to "1" (positive edge in RLO), the timer T5 will be
started. The timer will continue to run for the specified time of two seconds (2 s) as long as I0.0 is
"1". If the signal state of I0.0 changes from "1" to "0" before the timer has expired the timer will be
stopped. If the signal state of input I0.1 changes from "0" to "1" while the timer is running, the time
is reset.
The output Q4.0 is logic "1" as long as the timer is running and "0" if the time has elapsed or was
reset.
Timer Instructions
13.4 S_PEXT Extended Pulse S5 Timer
Ladder Logic (LAD) for S7-300 and S7-400 Programming
Reference Manual, 04/2017, A5E41524738-AA
159
0>0>0>0>0>0>0>0> Dostları ilə paylaş: |