The text of a manual · part 26 of 68
DL405 User Manual: Chapter 5: Standard RLL Instructions, pages 213 to 222
Pages 213 to 222 of 608, from DL405 User Manual
The original document is the PDF (8.2 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 AutomationDirect D4-08B-1, AutomationDirect D4-08ND3S, AutomationDirect D4-16TA, PLC Direct D4-16TD2, AutomationDirect D4-32ND3-1, Konnect-It D4-08B-1, Koyo D4-08B-1, Konnect-It D4-08ND3S, and 6 more models
Page 213
5--41
Standard RLL Instructions Timer, Counter, and Shift Register Instructions
Timer, Counter, and Shift Register Instructions Using Timers
0
Timers are used to time an event for a desired length of time. There are those applications that need an accumulating timer, meaning it has the ability to time, stop, and then resume from where it previously stopped. The single input timer will time 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 discrete bit associated with each timer to indicate 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, current value, and timer preset. 1
2
Seconds 4
3
5
6
7
X1
8
TMR
T1 K30
X1
Timer preset
T1 T1 0
Current Value
10
20
30 40 1/10 Seconds
50
60
Y0 OUT
0
The accumulating timer works similarly to the regular timer, but two inputs are required. The start/stop input starts and stops the timer. When the timer stops, the elapsed time is maintained. When the timer starts again, 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 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 the timer input, timer reset, associated discrete bit, current value, and timer preset. 0
1
2
3
Seconds 4
5
6
7
8
X1
Start/Stop
X1
TMRA
T0 K30
X2 X2
Reset Input T0 Current Value
0
10
10
40
50
0
Standard RLL Instructions
20 30 1/10 Seconds
DL405 User Manual, 4th Edition
Page 214
5--42
Standard RLL Instructions Timer, Counter, and Shift Register Instructions
The Timer instruction is a 0.1 second single input timer that times to a maximum of 999.9 seconds. The Timer Fast instruction is a 0.01 second single input timer that times up to 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).
Timer (TMR) and Timer Fast (TMRF)
430 440 450
DS
HPP
T aaa
TMR B bbb
Preset
Timer #
Instruction Specifications TMRF Timer Reference (Taaa): Specifies the T aaa B bbb timer number. Preset Value (Bbbb): Constant value (K) or a V--memory location. (V locations are Preset Timer # 16-bit words.) Current Value: Timer current values are accessed by referencing the associated V The timer discrete status bit and the or T memory location*. For example, the current value is not specified in the timer timer current value for T3 physically instruction. resides in V-memory location V3. (V locations are 16-bit words.) Discrete Status Bit: The discrete status bit is accessed by referencing the associated T memory 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. Operand Data Type
DL430 Range
DL440 Range
DL450 Range
B aaa bbb aaa bbb aaa bbb
Timers
T
0--177
----
0--377
----
0--377
----
V--memory for preset values
V
----
1400--7377
----
1400--7377 10000--17777
----
1400--7377 10000--17777
Pointers (preset only)
P
----
----
----
1400--7377 10000--17777
----
1400--7377 10000--37777
Constants (preset only)
K
----
0--9999
----
0--9999
----
0--9999
Timer discrete status bits
T
0--177
0--377
0--377
Timer current values
V /T*
0--177
0--377
0--377
Standard RLL Instructions
There are two methods of programming timers. You can perform functions when the timer reaches the specified preset using the discrete status bit, or use the comparative contacts to perform functions at different time intervals based on one timer. The following examples show each method of using timers. NOTE: * For the Handheld Programmer, both the Timer discrete status bits and current value can be accessed with the same data type (example T2). The way the data type is used determines if it is a status bit or a current value. Any comparative instruction using T2 will access the current value, all other instructions using T2 will access the status bit. Current values may also be accessed by the V-memory location. For DirectSOFT, the use of T2 will refer to the timer’s discrete status bit. You should use V2 (or the alias TA2) to refer to the current value.
DL405 User Manual, 4th Edition
Page 215
5--43
Standard RLL Instructions Timer, Counter, and Shift Register Instructions Timer Example Using Discrete Status Bits
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 after 7.5 seconds turning the discrete status bit off and resetting the timer current value to 0. Timing Diagram
DirectSOFT X1
TMR
T2
0
K30
1
2
3
0
10
20
Seconds 4
5
6
7
30
40
50
60
8
X1 Y0
T2
T2
OUT Y0 Current Value
Handheld Programmer Keystrokes STR
X(IN)
1
TMR
TMR
2
STR
TMR
2
OUT
Y(OUT)
0
K(CON)
3
0
1/10 Seconds
0
In the following example, a single input timer is used with a preset of 234.5 seconds. Timer Example Using Comparative 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 contacts will turn off Y3, Y4, and Y5. Timing Diagram
DirectSOFT (see Note) X1
TA20
Seconds
TMR T20 K2345
0
OUT
TA20
3
4
5
6
7
0
10
20
30
40
50
60
8
Y3
Y4
K20
2
X1
Y3
K10
1
Y4
OUT Y5 TA20
Y5
K30
T2
OUT
Current Value
1/10 Seconds
Handheld Programmer Keystrokes X(IN)
1
TMR
TMR
2
0
K(CON)
2
3
STR
TMR
2
0
K(CON)
1
0
OUT
Y(OUT)
3 0
K(CON)
2
0
0
K(CON)
3
0
STR
TMR
2
Y(OUT)
4
STR
TMR
2
OUT
Y(OUT)
5
4
5
NOTE: Since this representation is showing a DirectSOFT example, you would use the alias TA20 (or V20) instead of T20, which would be necessary for the equivalent rung entered with the Handheld Programmer.
Standard RLL Instructions
STR
OUT
0
DL405 User Manual, 4th Edition
Page 216
5--44
Standard RLL Instructions Timer, Counter, and Shift Register Instructions
Accumulating Timer (TMRA) and Accumulating Fast Timer (TMRAF)
430 440 450
DS
HPP
The Accumulating Timer is a 0.1 second two input timer that times to a maximum of 9999999.9. The Accumulating Fast Timer is a 0.01 second two input timer that times to a maximum of 999999.99. 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 current value to 0. The reset will reset the timer when on and allow the timer to time when off. Instruction Specifications Timer Reference (Taaa): Specifies the timer number. Preset Value (Bbbb): Constant value (K) or a V--memory location. (V locations are 32-bit double words.) Current Value: Timer current value is a double word accessed by referencing the associated V or T memory location*. For example, the timer current value for T0 resides in V-memory location V0 and V1. (V locations are 16-bit words.) Discrete Status Bit: The discrete status bit is accessed by referencing the associated T memory 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.
Operand Data Type
Standard RLL Instructions
Timers
DL430 Range
Enable
T aaa TMRA B bbb
Reset
Preset
Enable
Timer #
T aaa TMRAF B bbb
Reset
Preset
Timer #
The timer discrete status bit and the current value is not specified in the timer instruction.
Caution: The TMRA uses two consecutive timer locations, since the preset can now be 8 digits, which requires two V--memory locations. For example, if TMRA T0 is used in the program, the next available timer is T2. Or if T0 was a normal timer, and T1 was an accumulating timer, then the next available timer would be T3.
DL440 Range
DL450 Range
B aaa bbb aaa bbb aaa
T
0--176
----
0--376
----
0--376 bbb ----
----
1400--7377 10000--17777
V--memory for preset values
V
----
1400--7377
----
1400--7377 10000--17777
Pointers (preset only)
P
----
----
----
1400--7377 10000--17777
----
1400--7377 10000--37777
Constants (preset only)
K
----
0--99999999
----
0--99999999
----
0--99999999
Timer discrete status bits
T
0--177
0--377
0--377
Timer current values
V/T*
0--177
0--377
0--377
There are two methods of programming timers. You can perform functions when the timer reaches the specified preset using the the discrete status bit, or use the comparative contacts to perform functions at different time intervals based on one timer. The following examples show each method of using timers. NOTE:* For the Handheld Programmer, both the Timer discrete status bits and current value can be accessed with the same data type (example T2). The way the data type is used determines if it is a status bit or a current value. Any comparative instruction using T2 will access the current value, all other instructions using T2 will access the status bit. Current values may also be accessed by the V-memory location. For DirectSOFT, the use of T2 will refer to the timer’s discrete status bit. You should use V2 (or the alias TA2) to refer to the current value.
DL405 User Manual, 4th Edition
Page 217
5--45
Standard RLL Instructions Timer, Counter, and Shift Register Instructions
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 the timer times for 1 second , stops for one second, then resumes timing. The timer will reset when C10 turn on after 5.5 seconds turning the discrete status bit off and resetting the timer current value to 0.
Accumulating Timer Example using Discrete Status Bits
Timing Diagram
DirectSOFT X1 TMRA
0
T6
2
3
0
10
10
Seconds 4
5
6
7
20
30
40
50
8
X1
K30
C10
1
C10
T6
Y10
T6
OUT
Current Value
0
1/10 Seconds Handheld Programmer Keystrokes (cont)
Handheld Programmer Keystrokes STR
X(IN)
1
STR
C(CR)
1
0
TMR
SHFT
A
SHFT
TMR
6
K(CON)
3
0
STR
TMR
6
OUT
Y(OUT)
1
0
Accumulator Timer In the following example, a single input timer is used with a preset of 23458.9 seconds. Comparative contacts are used to energized Y3, Y4, and Y5 at one second intervals Example Using respectively. The comparative contacts will turn off when the timer is reset. Comparative Contacts Timing Diagram
DirectSOFT (see Note) X1 TMRA
0
T20
2
3
0
10
10
Seconds 4
5
6
7
20
30
40
50
8
X1
K234589
C10
1
C10 TA20
Y3
Y3
K10
OUT Y4 TA20
Y4
K20
Y5
OUT T20 TA20
Y5
K30
Current Value
OUT
Handheld Programmer Keystrokes
0
1/10 Seconds Handheld Programmer Keystrokes (cont)
X(IN)
1
STR
C(CR)
1
0
TMR
SHFT
A
SHFT
TMR
2
0
K(CON)
2
3
4
5
8
9
STR
TMR
2
0
K(CON)
1
0
OUT
Y(OUT)
3
STR
TMR
2
OUT
Y(OUT)
4
STR
TMR
2
OUT
Y(OUT)
5
0
K(CON)
2
0
0
K(CON)
3
0
NOTE: Since this representation is showing a DirectSOFT example, you would use the alias TA20 (or V20) instead of T20, which would be necessary for the equivalent rung entered with the Handheld Programmer.
Standard RLL Instructions
STR
DL405 User Manual, 4th Edition
Page 218
5--46
Standard RLL Instructions Timer, Counter, and Shift Register Instructions Counters are used to count events. The counters available are up counters, up/down counters, and stage counters (used with RLL PLUS programming). The up counter has two inputs, a count input and a reset input. The maximum count value is 9999. The timing diagram below shows the relationship between the counter input, counter reset, associated discrete bit, current value, and counter preset.
Using Counters
X1 X1
X2
CNT
CT1 K3
Up Reset
X2
Counter preset CT1 Current Value
1
2
3
4
0
Counts
The up down counter has three inputs, a count up input, count down input and reset input. The maximum count value is 99999999. The timing diagram below shows the relationship between the counter input, counter reset, associated discrete bit, current value, and counter preset. X1
CT2 K3
Up
X1
X2
X2
X3
Down Reset
X3
Counter preset
CT2 Current Value
UDC
1
2
1 Counts
2
3
0
The stage counter has a count input and is reset by the RST instruction. This instruction is useful when programming RLL PLUS, by allowing you to reference the same counter from multiple stages. The maximum count value is 9999. The timing diagram below shows the relationship between the counter input, associated discrete bit, current value, counter preset and reset instruction. X1
Standard RLL Instructions
X1
Up
CT1 Current Value
SGCNT K3
Counter preset 1
RST CT
DL405 User Manual, 4th Edition
2
3
Counts
4
0
CT2
Page 219
5--47
Standard RLL Instructions Timer, Counter, and Shift Register Instructions
The Counter is a two input counter that increments when the count input logic transitions from off to on. When the counter reset input is on the counter resets 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. The maximum value will be held until the counter is reset.
Counter (CNT)
430 440 450
DS
HPP
Counter # Count
CNT
CT aaa B bbb
Reset
Instruction Specifications Counter Reference (CTaaa): Specifies Preset the counter number. Preset Value (Bbbb): Constant value (K) or a V--memory location. (V locations are 16-bit words.) Current Values: Counter current values are accessed by referencing the The counter discrete status bit and the current value are not specified in the associated V or CT memory locations*. counter instruction. The V-memory location is the counter location + 1000. For example, the counter current value for CT3 resides in V--memory location V1003. (V locations are 16-bit words.) 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. Operand Data Type
Counters
DL430 Range
DL440 Range
DL450 Range
B aaa bbb aaa bbb aaa
CT
0--177
----
0--177
----
0--377 bbb ----
----
1400--7377 10000--37777
V--memory (preset only)
V
----
1400--7377
----
1400--7377 10000--17777
Pointers (preset only)
P
----
----
----
1400--7377 10000--17777
----
1400--7377 10000--37777
Constants (preset only)
K
----
0--9999
----
0--9999
----
0--9999
Counter discrete status bits
CT
0--177
0--177
0--377
Counter current values
V/CT*
1000--1177
1000--1177
1000--1377
Standard RLL Instructions
NOTE:* For the Handheld Programmer, both the Counter discrete status bits and current value can be accessed with the same data type (example CT2). The way the data type is used determines if it is a status bit or a current value. Any comparative instruction using CT2 will access the current value, all other instructions using CT2 will access the status bit. Current values may also be accessed by the V-memory location. For DirectSOFT, the use of CT2 will refer to the timer’s discrete status bit. You should use V1002 (or the alias CTA2) to refer to the current value.
DL405 User Manual, 4th Edition
Page 220
5--48
Standard RLL Instructions Timer, Counter, and Shift Register Instructions
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 Y10. 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 V--memory location V1002. Counting diagram
DirectSOFT X1 CNT
CT2 X1 K3
C10
C10
Y10
Y10
OUT
Current Value
CT2
1
2
3
4
0
Handheld Programmer Keystrokes STR
X(IN)
1
STR
C(CR)
1
0
CNT
CNT
2
K(CON)
STR
CNT
2
OUT
Y(OUT)
1
3
0
In the following example, when X1 is makes an off to on transition, counter CT2 will Counter Example Using Comparative increment by one. Comparative contacts are used to energize Y3, Y4, and Y5 at different counts. The comparative contacts will turn off when the counter is reset. When the reset Contacts C10 turns on, the counter status bit will turn off and the counter current value will be 0. Counting diagram
DirectSOFT (see Note) X1 CNT
CT2 X1 K3
C10
C10
CTA2
Y3
K1
Y3
OUT Y4 CTA2
Y4
K2
OUT
CTA2
Y5
K3
Y5 Current Value
1
2
3
4
0
OUT
Standard RLL Instructions
Handheld Programmer Keystrokes
Handheld Programmer Keystrokes (cont)
STR
X(IN)
1
STR
C(CR)
1
0
CNT
CNT
2
K(CON)
3
STR
CNT
2
K(CON)
1
OUT
Y(OUT)
3
STR
CNT
2
OUT
Y(OUT)
4
STR
CNT
2
OUT
Y(OUT)
5
K(CON)
2
K(CON)
3
NOTE: Since this representation is showing a DirectSOFT example, you would use the alias CTA2 (or V1002) instead of CT2, which would be necessary for the equivalent rung entered with the Handheld.
DL405 User Manual, 4th Edition
Page 221
5--49
Standard RLL Instructions Timer, Counter, and Shift Register Instructions
The Stage Counter is a single input counter that increments when the input logic transitions from off to on. This counter differs from other counters since it will hold its current value until reset using the RST instruction. The Stage Counter is designed for use in RLL PLUS programs but can be used in relay ladder logic programs. When the current value equals the preset value, the counter status bit turns on and the counter continues to count up to a maximum count of 9999. The maximum value will be held until the counter is reset.
Stage Counter (SGCNT)
430 440 450
DS
HPP
Counter # CT aaa SGCNT B bbb Preset
The counter discrete status bit and the current value are not specified in the counter instruction.
Instruction Specifications Counter Reference (CTaaa): Specifies the counter number. Preset Value (Bbbb): Constant value (K) or a V--memory location. (V locations are 16-bit words.) 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. (V locations are 16-bit words.) 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. Operand Data Type
DL430 Range
DL440 Range
DL450 Range
B aaa bbb aaa bbb aaa bbb
Counters
CT
0--177
----
0--177
----
0--377
----
V--memory
V
----
1400--7377
----
1400--7377 10000--17777
----
1400--7377 10000--17777
Pointers (preset only)
P
----
----
----
1400--7377 10000--17777
----
1400--7377 10000--37777
Constants
K
----
0--9999
----
0--9999
----
0--9999
Counter discrete status bits
CT
0--177
0--177
0--377
Counter current values
V/CT*
1000--1177
1000--1177
1000--1377
Standard RLL Instructions
NOTE:* For the Handheld Programmer, both the Stage Counter discrete status bits and current value can be accessed with the same data type (example CT2). The way the data type is used determines if it is a status bit or a current value. Any comparative instruction using CT2 will access the current value, all other instructions using CT2 will access the status bit. Current values may also be accessed by the V-memory location. For DirectSOFT, the use of CT2 will refer to the timer’s discrete status bit. You should use V1002 (or the alias CTA2) to refer to the current value.
DL405 User Manual, 4th Edition
Page 222
5--50
Standard RLL Instructions Timer, Counter, and Shift Register Instructions
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 Y10. 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. Counting diagram
DirectSOFT X1
SGCNT K3
CT7
C5
CT7
X1
Y10
Y10
OUT
Current Value
CT7
1
2
3
4
0
RST C5
RST
Handheld Programmer Keystrokes STR
X(IN)
1
SG
CNT
CNT
STR
CNT
7
OUT
Y(OUT)
1
STR
C(CR)
5
RST
CNT
7
Stage Counter Example Using Comparative Contacts
7
K(CON)
3
0
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. Counting diagram tSOFT (see Note) X1
CTA2
SGCNT CT2 K10
X1
Y3
K1
Y3
OUT
CTA2
Y4
Y4
K2
OUT
CTA2
Y5 Current Value
Y5
K3
1
2
3
4
0
OUT
Standard RLL Instructions
Handheld Programmer Keystrokes
Handheld Programmer Keystrokes (cont)
STR
X(IN)
1
SG
CNT
CNT
2
K(CON)
STR
CNT
2
K(CON)
1
OUT
Y(OUT)
3
1
0
STR
CNT
2
OUT
Y(OUT)
4
STR
CNT
2
OUT
Y(OUT)
5
K(CON)
2
K(CON)
3
NOTE: Since this representation is showing a DirectSOFT example, you would use the alias CTA2 (or V1002) instead of CT2, which would be necessary for the equivalent rung entered with the Handheld.
DL405 User Manual, 4th Edition