The text of a manual · part 29 of 61
DL205 PLC User Manual, Volume 1 of 2: Chapter 5: RLL and Intelligent Box Instructions, pages 263 to 272
Pages 263 to 272 of 592, from DL205 PLC User Manual, Volume 1 of 2
The original document is the PDF (13 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the PLC Direct D2-08ND3 and Koyo D2-08ND3
Page 263
Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register
Timer, Counter and Shift Register Instructions
1 Using Timers Timers are used to time an event for a desired length of time. The single input timer will time 2 as long as the input is on. When the input changes from on to off the timer current value is reset to 0. There is a tenth of a second and a hundredth of a second timer available with a maximum time of 999.9 and 99.99 seconds respectively. There is a discrete bit associated with 3 each timer to indicate that the current value is equal to or greater than the preset value. The timing diagram below shows the relationship between the timer input, associated discrete bit, 4 current value, and timer preset. 5 6 Timer Preset 7 8 9 There are those applications that need an accumulating timer, meaning it has the ability to 10 time, stop, and then resume from where it previously stopped. The accumulating timer works similarly to the regular timer, but two inputs are required. The enable input starts and stops the timer. When the timer stops, the elapsed time is maintained. When the timer starts again, 11 the timing continues from the elapsed time. When the reset input is turned on, the elapsed time is cleared and the timer will start at 0 when it is restarted. There is a tenth of a second 12 and a hundredth of a second timer available with a maximum time of 9999999.9 and 999999.99 seconds respectively. The timing diagram below shows the relationship between 13 the timer input, timer reset, associated discrete bit, current value, and timer preset. 14 A B C D 0
1
2
3
Seconds 4
5
6
7
8
X1
TMR
T1
K30
X1
T1
T1
Current Value
0
0
10
20
1
2
3
30 40 1/10 Seconds
Seconds 4
5
50
60
6
7
Y0 OUT
0
8
X1
TMRA
T0
K30
Enable
X1
X2
X2
Reset Input
T0
Current Value
0
10
10
20 30 1/10 Seconds
40
50
0
DL205 User Manual, 4th Edition, Rev. A
5–41
Page 264
Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register
Timer (TMR) and Timer Fast (TMRF)
The Timer instruction is a 0.1 second single-input timer that 1 times to a maximum of 999.9 seconds. The Timer Fast instruction is a 0.01 second single input timer that times up to
2 a maximum of 99.99 seconds. These timers will be enabled if the input logic is true (on) and will be reset to 0 if the input logic is false (off ). 3 Instruction Specifications Timer Reference (Taaa): Specifies the timer number. 4 Preset Value (Bbbb): Constant value (K) or a V-memory location. (Pointer (P) for DL240, DL250-1 and DL260). 5 Current Value: Timer current values are accessed by referencing the associated V or T memory location*. For 6 example, the timer current value for T3 physically resides in V-memory location V3. 7 Discrete Status Bit: The discrete status bit is referenced by the associated T memory location. It will be on if the current value is equal to or greater than the 8 preset value. For example, the discrete status bit for Timer 2 would be T2. NOTE: A V-memory preset is required only if the ladder program or an Operator Interface unit must change 9 the preset. Data 10 Operand DL230 Range DL240 Range DL250-1 Range DL260 Range Type B aaa bbb aaa bbb aaa bbb aaa bbb 11 12 13 14 A NOTE: * Both the Timer discrete status bits and the current value are accessed with the same data reference with the HPP. DirectSOFT uses separate references, such as “T2” for discrete status bit for Timer B T2, and “TA2” for the current value of Timer T2. You can perform functions when the timer reaches the specified preset using the discrete C status bit. Or, use the comparative contacts to perform functions at different time intervals based on one timer. The examples on the following page show these methods of programming timers. D 230
T aaa
TMR
B bbb
240
250-1
Preset
260
Timer#
DS Used HPP Used
TMRF
T aaa
B bbb
Timer#
Preset
Timers T V-memory for preset values V Pointers (presets only) P Constants (presets only) K Timer discrete status bits T/V* Timer current values V/T*
5–42
0-77 –
0-177
2000-2377
–
0-377
2000-3777
1400-7377 10000-17777 1400-7377 10000-17777
–
1400-7377 10000-37777 1400-7377 10000-37777
–
0-9999
–
0-9999
2000-3777
–
0-9999
–
0-9999
0-377
–
0-77 or V41100-41103
0-177 or V41100-41107
0-377 or V41100-41117
0-377 or V41100-41117
0-77
0-177
0-377
0-377
DL205 User Manual, 4th Edition, Rev. A
Page 265
Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register
Timer Example Using Discrete Status Bits
1 2 3 4 5 6 7 8 Timer Example Using Comparative Contacts 9 In the following example, a single-input timer is used with a preset of 4.5 seconds. Comparative contacts are used to energize Y3, Y4, and Y5 at one second intervals respectively. When X1 is turned off the timer will be reset to 0 and the comparative contacts will turn off 10 Y3, Y4, and Y5. 11 12 13 14 A B C D In the following example, a single-input timer is used with a preset of 3 seconds. The timer discrete status bit (T2) will turn on when the timer has timed for 3 seconds. The timer is reset when X1 turns off, turning the discrete status bit off and resetting the timer current value to 0.
Timing Diagram
DirectSOFT
X1
TMR
T2
K30
0
OUT
B
STR
N TMR $
C
STR
GX OUT
D
2
SHFT
T MLR
A
ENT
0
Seconds 4
5
6
7
0
10
20
30
40
50
60
C
A
3
ENT
0
1/10th Seconds
Timing Diagram
X1
TMR
Seconds
T20
0
K45
2
3
4
5
6
7
0
10
20
30
40
50
60
8
Y3
Y4
K20
1
X1
Y3
K10
OUT
TA20
0
ENT
2
DirectSOFT
TA20
8
Y0
Current Value
ENT
1
3
T2
Handheld Programmer Keystrokes $
2
X1
Y0
T2
1
Y4
OUT
Y5
TA20
Y5
K30
T2
OUT
Current Value
1/10th Seconds
Handheld Programmer Keystrokes $
B
1
STR
N TMR
C
ENT
A
E
2
0
SHFT
T MLR
GX OUT
D
ENT
$
SHFT
T MLR
GX OUT
E
ENT
$
SHFT
T MLR
F
ENT
$
STR
STR
STR GX OUT
3
4
5
0
F
4
C
A
2
C
A
1
C
0
A
2
ENT
B
A
2
C
5
0
A
2
D
0
0
0
A
3
0
ENT
ENT
ENT
DL205 User Manual, 4th Edition, Rev. A
5–43
Page 266
Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register
Accumulating Timer (TMRA)
Enable
T aaa TMRA B bbb
Accumulating Timer is a 0.1 second two-input timer that will 1 The time to a maximum of 9999999.9. The TMRA uses two timer registers in V-memory. 2 Accumulating Fast Timer (TMRAF)
The Accumulating Fast Timer is a 0.01 second two-input timer 3 that will time to a maximum of 999999.99. The TMRAF uses two timer registers in V-memory. 4 These timers have two inputs, an enable and a reset. The timer will start timing when the enable is on and stop timing when the enable is off without resetting the value to 0. The reset will reset the timer 5 when on and allow the timer to time when off.
Instruction Specifications 6 Timer Reference (Taaa): Specifies the timer number. Preset Value (Bbbb): Constant value (K) or two consecutive V-memory locations. (Pointer (P) 7 for DL240, DL250-1 and DL260). Current Value: Timer current values are accessed by referencing the associated V or T 8 memory location. For example, the timer current value for T3 resides in V-memory location V3. Discrete Status Bit: The discrete status bit is accessed by referencing the associated T memory 9 location. It will be on if the current value is equal to or greater than the preset value. For example, the discrete status bit for Timer 2 would be T2. 10 NOTE: The accumulating timer uses two consecutive V-memory locations for the 8-digit value, therefore two consecutive timer locations. For example, if TMRA T1 is used, the next available timer number is T3. 11 NOTE: A V-memory preset is required only if the ladder program or an OIT must be used to change the preset. 12 13 Operand Data DL230 Range DL240 Range DL250-1 Range DL260 Range Type B aaa bbb aaa bbb aaa bbb aaa bbb 14 A B C D NOTE: * Both the Timer discrete status bits and the current value are accessed with the same data 230
Reset
240
250-1
Preset
Timer
260
Enable
T aaa TMRAF B bbb
Reset
230
Preset
Timer
240
250-1 260
DS Used HPP Used
Timers T V-memory for preset values V Pointers (presets only) P Constants (presets only) K Timer discrete status bits T/V* Timer current values V/T*
0-76 –
0-176
2000-2377
–
0-376
2000-3777
–
–
1400-7377 10000-37777 1400-7377 10000-37777
–
0-99999999
–
0-99999999
2000-3777
–
0-99999999
–
0-99999999
0-376
1400-7377 10000-17777 1400-7377 10000-17777
0-76 or V41100-41103
0-176 or V41100-41107
0-376 or V41100-41117
0-376 or V41100-41117
0-76
0-176
0-376
0-376 reference with the HPP. DirectSOFT uses separate references, such as “T2” for discrete status bit for Timer T2, and “TA2” for the current value of Timer T2.
5–44
DL205 User Manual, 4th Edition, Rev. A
Page 267
Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register
Accumulating Timer Example using Discrete Status Bits
1 2 3 4 5 6 7 8 Accumulator Timer Example Using Comparative Contacts In the following example, a two-input timer is used with a preset of 4.5 seconds. Comparative 9 contacts are used to energized Y3, Y4, and Y5 at one second intervals respectively. The comparative contacts will turn off when the timer is reset. 10 11 12 13 14 A B C D In the following example, a two input timer (accumulating timer) is used with a preset of 3 seconds. The timer discrete status bit (T6) will turn on when the timer has timed for 3 seconds. Notice in this example that the timer times for 1 second , stops for one second, then resumes timing. The timer will reset when C10 turns on, turning the discrete status bit off and resetting the timer current value to 0.
DirectSOFT
Timing Diagram
X1
TMRA
0
T6
1
2
3
0
10
10
Seconds 4
5
6
7
20
30
40
50
8
X1
K30
C10
C10
T6
Y10
T6
OUT
Current Value
Handheld Programmer Keystrokes $
B
N TMR
SHFT
D
A
3
C
SHFT
STR
Handheld Programmer Keystrokes (cont’d)
ENT
1
STR
$
0
1/10th Seconds
B
A
1
2
A
ENT
0
STR
G
0
GX OUT
6
ENT
0
$
SHFT
T MLR
G
B
A
ENT
0
1
ENT
6
Contacts
DirectSOFT
Timing Diagram
X1
TMRA
0
T20
K45
1
2
3
0
10
10
Seconds 4
5
6
7
20
30
40
50
8
X1
C10
C10
TA20
K10 TA21
Y3
K0
Y3
OUT
Y4
TA21
K1
TA20
K20 TA21
TA21
K1
Y5
Y4
K0
T20
OUT
TA20
Current Value
K30 TA21
0
1/10th Seconds
Y5
K1
OUT
Handheld Programmer Keystrokes $
B
1
STR
$
SHFT
STR
N TMR
SHFT
$
STR
SHFT
Q OR
SHFT
GX OUT
C
$
A
1
2
C
0
E
4
E 4 D 3
0
ENT
C
E
0
F
5
4
A
B
2
0
SHFT
T MLR
C
SHFT
T MLR
C
A
1
B
2
SHFT
ENT
Q OR
SHFT
ENT
GX OUT
E
ENT
$
SHFT
ENT
V AND
A
B 2
0
0
1 B 1
1
GX OUT
4
E
4
4
STR SHFT
T MLR
E
V AND
ENT
A
2
T MLR
SHFT
STR
B
A
SHFT
V AND
Handheld Programmer Keystrokes (cont’d)
ENT
T MLR
4 5
A
C
2
0
SHFT
T MLR
C
SHFT
T MLR
C
C
A
A
0
2
B
ENT
A
0
1
2
B
B
1
1
2
ENT ENT
ENT
E F
C
D
2
0
SHFT
T MLR
A
3
0
B
C 2
ENT
B 1
1
ENT
ENT
DL205 User Manual, 4th Edition, Rev. A
5–45
Page 268
Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register
Counter (CNT)
Counter#
The Counter is a two-input counter that increments 1 when the count input logic transitions from off to on.
When the counter reset input is on the counter resets 2 to 0. When the current value equals the preset value, the counter status bit comes on and the counter continues to count up to a maximum count of 9999. 3 The maximum value will be held until the counter is reset. 4 Instruction Specifications Counter Reference (CTaaa): Specifies the counter number. 5 Preset Value (Bbbb): Constant value (K) or a V-memory location. (Pointer (P) for DL240, DL250-1 and DL260.) 6 Current Values: Counter current values are accessed by referencing the associated V or CT memory locations. The V-memory location is the counter location + 1000. For example, the 7 counter current value for CT3 resides in V-memory location V1003. Discrete Status Bit: The discrete status bit is accessed by referencing the associated CT 8 memory location. It will be on if the value is equal to or greater than the preset value. For example the discrete status bit for Counter 2 would be CT2. 9 NOTE: A V-memory preset is required only if the ladder program or an OIT must used to change the preset. Data 10 Operand DL230 Range DL240 Range DL250-1 Range DL260 Range Type B aaa bbb aaa bbb aaa bbb aaa bbb 11 12 13 14 NOTE: * Both the Counter discrete status bits and the current value are accessed with the same data A reference with the HPP. DirectSOFT uses separate references, such as “CT2” for discrete status bit for Counter CT2, and “CTA2” for the current value of Counter CT2. B C D 230
Count
240
250-1
CT aaa B bbb
Reset
260
DS Used HPP Used
Preset
Counters CT V-memory for preset values V Pointers (presets only) P Constants (presets only) K Counter discrete status bits CT/V* Counter current values V/CT*
5–46
CNT
0-77 –
0-177
2000-2377
–
0-177
2000-3777
1400-7377 10000-17777 1400-7377 10000-17777
–
1400-7377 10000-37777 1400-7377 10000-37777
–
0-9999
–
0-9999
2000-3777
–
0-9999
–
0-9999
0-377
–
0-77 or V41140-41143
0-177 or V41140-41147
0-177 or V41140-41147
0-377 or V41100-41157
1000-1077
1000-1177
1000-1177
1000-1377
DL205 User Manual, 4th Edition, Rev. A
Page 269
Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register
Counter Example Using Discrete Status Bits In the following example, when X1 makes an off to on transition, counter CT2 will increment by one. When the current value reaches the preset value of 3, the counter status bit CT2 will turn on and energize Y7. When the reset C10 turns on, the counter status bit will turn off and the current value will be 0. The current value for counter CT2 will be held in Vmemory location V1002. DirectSOFT
Counting diagram
X1 CNT
CT2 X1 K3
C10 C10
Y7
CT2 or Y7
OUT
Current Value
CT2
1
2
3
Handheld Programmer Keystrokes
Handheld Programmer Keystrokes (cont)
$
$
B
ENT
1
STR $
C
SHFT
STR GY CNT
SHFT
C
H
ENT
STR B
A 1
2
C
0
D 2
GX OUT
ENT
7
2
SHFT
T MLR
4
C
ENT
2
ENT
3
Counter Example Using Comparative Contacts In the following example, when X1 makes an off to on transition, counter CT2 will increment by one. Comparative contacts are used to energize Y3, Y4, and Y5 at different counts. When the reset C10 turns on, the counter status bit will turn off and the counter current value will be 0, and the comparative contacts will turn off. DirectSOFT
Counting diagram
X1 CNT
CT2 X1 K3
C10 C10
CTA2
Y3
K1
Y3
OUT Y4 CTA2
Y4
K2
OUT
CTA2
Y5
K3
Y5 1
Current Value
2
3
4
0
OUT
Handheld Programmer Keystrokes (cont)
Handheld Programmer Keystrokes $
B STR
1
$
SHFT
STR GY CNT
D
SHFT B 1
A 1
2
3 C 2
SHFT
0
2 GX OUT
ENT T MLR
C
ENT
C 2
3
4 SHFT
STR D 3
ENT
GX OUT
C 2
SHFT
T MLR
C
SHFT
T MLR
C
2
ENT E
$
ENT D
SHFT
STR B
2
STR
GX OUT
C
C
$
$
ENT
ENT C 2
2
ENT F 5
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
ENT
DL205 User Manual, 4th Edition, Rev. A
5–47
Page 270
Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register
Stage Counter (SGCNT)
The Stage Counter is a single-input counter that 1 increments when the input logic transitions from off to on. This counter differs from other counters since it will 2 hold its current value until reset using the RST instruction. The Stage Counter is designed for use in RLL programs but can be used in relay ladder logic 3 programs. When the current value equals the preset value, the counter status bit turns on and the counter 4 continues to count up to a maximum count of 9999. The maximum value will be held until the counter is reset. 5 Instruction Specifications Counter Reference (CTaaa): Specifies the counter number. 6 Preset Value (Bbbb): Constant value (K) or a V-memory location.(Pointer (P) for DL240, DL250-1 and DL260.) 7 Current Values: Counter current values are accessed by referencing the associated V or CT memory locations*. The V-memory location is the counter location + 1000. For example, the counter current value for CT3 resides in V-memory location V1003. 8 Discrete Status Bit: The discrete status bit is accessed by referencing the associated CT memory location. It will be on if the value is equal to or greater than the preset value. For 9 example, the discrete status bit for Counter 2 would be CT2. NOTE: When using a counter inside a stage, the stage must be active for one scan before the input to the 10 counter makes a 0-1 transition. Otherwise, there is no real transition and the counter will not count. 11 NOTE: A V-memory preset is required only if the ladder program or an OIT must used to change the preset. 12 Operand Data DL230 Range DL240 Range DL250-1 Range DL260 Range Type B aaa bbb aaa bbb aaa bbb aaa bbb 13 14 A B C NOTE: * Both the Counter discrete status bits and the current value are accessed with the same data reference with the HPP. DirectSOFT uses separate references, such as “CT2” for discrete status bit for D Counter CT2, and “CTA2” for the current value of Counter CT2. Counter#
230
CT aaa SGCNT B bbb
240
250-1 260
PLUS
Preset
The counter discrete status bit and the current value are not specified in the counter instruction.
DS Used HPP Used
Counters CT V-memory for preset values V Pointers (presets only) P Constants (presets only) K Counter discrete status bits CT/V Counter current values V/CT
5–48
0-77 –
0-177
2000-2377
–
0-177
2000-3777
1400-7377 10000-17777 1400-7377 10000-17777
–
1400-7377 10000-37777 1400-7377 10000-37777
–
0-9999
–
0-9999
2000-3777
–
0-9999
–
0-9999
0-377
–
0-77 or V41140-41143
0-177 or V41140-41147
0-177 or V41140-41147
0-377 or V41140-41157
1000-1077
1000-1177
1000-1177
1000-1377
DL205 User Manual, 4th Edition, Rev. A
Page 271
Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register
Stage Counter Example Using Discrete Status Bits In the following example, when X1 makes an off to on transition, stage counter CT7 will increment by one. When the current value reaches 3, the counter status bit CT7 will turn on and energize Y7. The counter status bit CT7 will remain on until the counter is reset using the RST instruction. When the counter is reset, the counter status bit will turn off and the counter current value will be 0. The current value for counter CT7 will be held in V-memory location V1007. DirectSOFT
Counting diagram
X1
SGCNT K3
CT7
C5
CT7
X1
Y7
Y7
OUT
Current Value
CT7
RST CT7
RST
Handheld Programmer Keystrokes $
B 1
STR S RST
SHFT H
G
D
ENT
3
7 $
SHFT
STR
6
C 2
2
3
4
0
Handheld Programmer Keystrokes (cont)
ENT
SHFT
1
SHFT
GY CNT
GX OUT
H
$
SHFT
C
SHFT
C
STR S RST
SHFT
T MLR
H 7
ENT
7
F
ENT
5
2
T MLR
SHFT
2
H 7
ENT
ENT
Stage Counter Example Using Comparative Contacts In the following example, when X1 makes an off to on transition, counter CT2 will increment by one. Comparative contacts are used to energize Y3, Y4, and Y5 at different counts. Although this is not shown in the example, when the counter is reset using the Reset instruction, the counter status bit will turn off and the current value will be 0. The current value for counter CT2 will be held in V-memory location V1002. DirectSOFT
Counting diagram
X1
SGCNT CT2 K10 X1
CTA2
Y3
K1
OUT
Y3
Y4 CTA2
Y4
K2
OUT
CTA2
Y5
K3
Y5 Current Value
1
2
3
4
OUT RST CT2 Handheld Programmer Keystrokes $
B 1
STR SHFT
S RST
C
G 6 B
SHFT
STR B 1 GX OUT
$
SHFT A
ENT
0 C 2
SHFT
C 2
T MLR
C 2
E
$
SHFT
3
4
STR D 3
ENT
GX OUT
C 2
SHFT
T MLR
C
SHFT
T MLR
C
2
ENT
GX OUT
ENT D
SHFT
STR GY CNT
1
2 $
Handheld Programmer Keystrokes (cont)
ENT
ENT C 2
2
ENT F 5
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
ENT
DL205 User Manual, 4th Edition, Rev. A
5–49
Page 272
Chapter 5: Standard RLL Instructions - Timer, Counter and Shift Register
Up Down Counter (UDC)
Up
UDC
CT aaa B bbb
This Up/Down Counter counts up on each off to on 1 transition of the Up input and counts down on each off to on transition of the Down input. The counter is 2 reset to 0 when the Reset input is on. The count range is 0 to 99999999. The count input not being used must be off in order for the active count input to 3 function. Caution: The UDC uses two Instruction Specification 4 V-memory locations for the 8-digit Counter Reference (CTaaa): Specifies the counter current value. This means that the number. UDC uses two consecutive 5 counter locations. If UDC CT1 is Preset Value (Bbbb): Constant value (K) or two used in the program, the next consecutive V-memory locations. (Pointer (P) for 6 available counter is CT3. DL240, DL250-1 and DL260). Current Values: Current count is a double word value accessed by referencing the associated 7 V or CT memory locations. The V-memory location is the counter location + 1000. For example, the counter current value for CT5 resides in V-memory location V1005 and V1006. 8 Discrete Status Bit: The discrete status bit is accessed by referencing the associated CT memory location. It will be on if the value is equal to or greater than the preset value. For example, the discrete status bit for Counter 2 would be CT2. 9 NOTE: The UDC uses two consecutive V-memory locations for the 8-digit value, therefore two consecutive counter locations. For example, if UDC CT1 is used, the next available counter number is CT3. 10 NOTE: A V-memory preset is required only if the ladder program or an OIT must be used to change the 11 preset. 12 Operand Data DL230 Range DL240 Range DL250-1 Range DL260 Range Type B aaa bbb aaa bbb aaa bbb aaa bbb 13 14 A B C NOTE: * Both the Counter discrete status bits and the current value are accessed with the same data reference with the HPP. DirectSOFT uses separate references, such as “CT2” for discrete status bit for D Counter CT2, and “CTA2” for the current value of Counter CT2. 230
Down
240
Counter #
250-1
Reset
260
Preset
DS Used HPP Used
Counters CT V-memory for preset values V Pointers (presets only) P Constants (presets only) K Counter discrete status bits CT/V* Counter current values V/CT*
5–50
0-76 –
0-176
2000-2377
–
0-176
2000-3777
1400-7377 10000-17777 1400-7377 10000-17777
–
1400-7377 10000-37777 1400-7377 10000-37777
–
0-99999999
–
0-99999999
2000-3777
–
0-99999999
–
0-99999999
0-376
–
0-76 or V41140-41143
0-176 or V41140-41147
0-176 or V41140-41147
0-376 or V41100-41157
1000-1076
1000-1176
1000-1176
1000-1376
DL205 User Manual, 4th Edition, Rev. A