The text of a manual · part 27 of 60
DL205 PLC User Manual, Volume 1 of 2, pages 261 to 270
Pages 261 to 270 of 598
The original document is the PDF (12 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 D2-04TD1, AutomationDirect D2-08TD2, AutomationDirect D2-16ND3-2, AutomationDirect D2-32ND3, Konnect-It D2-04TD1, Koyo D2-04TD1, Konnect-It D2-08TD2, Koyo D2-08TD2, and 5 more models
Page 261
Chapter 5: Standard RLL Instructions
Out Immediate Formatted (OUTIF)
230 240 250-1 260
1 2 Operand Data Type DL260 Range 3 aaa bbb 4 In the following example, when C0 is on,the binary pattern for X10 –X17 is loaded into the 5 accumulator using the Load Immediate Formatted instruction. The binary pattern in the accumulator is written to Y30–Y37 using the Out Immediate Formatted instruction. This 6 technique is useful to quickly copy an input pattern to outputs (without waiting for the CPU scan). 7 8 9 10 11 12 13 14 A B C D The Out Immediate Formatted instruction outputs a 1 to 32 bit binary value from the accumulator to specified output points at the time the instruction is executed. Accumulator bits that are not used by the instruction are set to zero.
Outputs Constant
DS HPP
Used Used
DirectSOFT CO
Y K
LDIF
0–1777 –
X10
K8
Load the value of 8 consecutive locations into the accumulator, starting with X10.
– 1–32
Location
Constant
X10
K8
X17 X16 X15 X14 X13 X12 X11 X10 ON OFF ON ON OFF ON OFF ON
Unused accumulator bits are set to zero
Acc.
OUTIF
Y aaa OUTIF K bbb
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9
8
7 6 5
4 3
2
1
0
0
0
1 0
1
1 0
1
0
0
0 0
0
0
0
0 0
0
0
0
0 0
0
0
0
0
0 0
0
0
1
0
Y30
K8
Copy the value in the lower 8 bits of the accumulator to Y30-Y37
Location
Constant
Y37 Y36 Y35 Y34 Y33 Y32 Y31 Y30
Y30
K8
ON OFF ON ON OFF ON OFF ON
Handheld Programmer Keystrokes $
STR
NEXT
NEXT
NEXT
I
F
SHFT
L ANDST
D
GX OUT
SHFT
I
3 8
F
8 5
NEXT
A B
5
D
3
A
0 1 0
ENT
A
I
0
I
8
8
ENT
ENT
DL205 User Manual, 4th Edition, Rev. D
5-37
Page 262
Chapter 5: Standard RLL Instructions
Set Immediate (SETI)
The Set Immediate instruction immediately sets or 1 turns on an output or a range of outputs in the image register and the corresponding output point(s) at the time the instruction is executed. Once the outputs are 2 set, it is not necessary for the input to remain on. The Reset Immediate instruction can be used to reset the 3 outputs. Reset Immediate (RSTI) 4 The Reset Immediate instruction immediately resets or turns off an output or a range of outputs in the 5 image register and the output point(s) at the time the instruction is executed. Once the outputs are reset, it is 6 not necessary for the input to remain on. 7 Operand Data Type DL230 Range DL240 Range DL250-1 Range DL260 Range aaa aaa aaa aaa 8 9 In the following example, when X1 is on, Y2 through Y5 will be set on in the image register and on the corresponding output points. 10 11 12 13 In the following example, when X1 is on, Y5 through Y22 will be reset (off) in the image 14 register and on the corresponding output module(s). A B C D 230 240
Y aaa aaa SETI
250-1 260
230
Y aaa aaa RSTI
240
250-1 260
Outputs
DS HPP
Y
Used Used
0–177
0–477
0–777
0–1777
Handheld Programmer Keystrokes
DirectSOFT
X1
Y2
$
Y5
SETI
B
STR
X SET
I
SHFT
1
ENT
C
8
F
2
ENT
5
DirectSOFT
X1
Y5
Y22
RSTI
Handheld Programmer Keystrokes $
S RST
5-38
B
STR
DL205 User Manual, 4th Edition, Rev. D
SHFT
I
1 8
ENT
F
5
C
2
C
2
ENT
Page 263
Chapter 5: Standard RLL Instructions
Load Immediate (LDI)
230 240 250-1 260
1 2 3 Operand Data Type DL260 Range aaaaa 4 5 In the following example, when C0 is on, the binary pattern of X0–X17 will be loaded into the accumulator using the Load Immediate instruction. The Out Immediate instruction could be 6 used to copy the 16 bits in the accumulator to output points, such as Y40–Y57. This technique is useful to quickly copy an input pattern to output points (without waiting for a full CPU 7 scan to occur). 8 9 10 11 12 13 14 A B C D The Load Immediate instruction loads a 16-bit V-memory value into the accumulator. The valid address range includes all input point addresses on the local base. The value reflects the current status of the input points at the time the instruction is executed. This instruction may be used instead of the LDIF instruction, which requires you to specify the number of input points.
Inputs V-memory
DS HPP
Used Used
DirectSOFT C0
V
Location
LDI
Load the inputs from X0 to X17 into the accumulator, immediately
V aaa
40400–40477
X17 X16 X15 X14 X13 X12 X11 X10
V40400
V40400
LDI
X7
X6
X5
X4
X3
X2
X1
X0
ON OFF ON ON OFF ON OFF OFF ON OFF ON ON OFF ON OFF ON
Unused accumulator bits are set to zero
Acc.
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9
8
7 6 5
4 3
2
1
0
0
0
1 0
1
1 0
1
0
0
0 0
0
0
0
0 0
0
0
0
0 0
0
1
0
1
1 0
1
0
1
0
OUTI
V40502
Output the value in the accumulator to output points Y40 to Y57
Location
Y57 Y56 Y55 Y54 Y53 Y52 Y51 Y50 Y47 Y46 Y45 Y44 Y43 Y42 Y41 Y40 ON OFF ON ON OFF ON OFF OFF ON OFF ON ON OFF ON OFF ON
V40502
Handheld Programmer Keystrokes $
SHFT
C
SHFT
L ANDST
D
I
GX OUT
SHFT
I
STR
3
8
A
2
0
ENT
E
8
NEXT
E
4
4
A A
0 0
E F
4
5
A A
0 0
A
C
0 2
ENT ENT
DL205 User Manual, 4th Edition, Rev. D
5-39
Page 264
Chapter 5: Standard RLL Instructions
1
2
3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Load Immediate Formatted (LDIF) 230 240 250-1 260
The Load Immediate Formatted instruction loads a 1–32 bit binary value into the accumulator. The value reflects the current status of the input module(s) at the time the instruction is executed. Accumulator bits that are not used by the instruction are set to zero. Operand Data Type
X aaa
LDIF K bbb
DL260 Range
Intputs Constant
X K aaa bbb
0–1777 –
– 1–32
In the following example, when C0 is on, the binary pattern of X10–X17 will be loaded into the accumulator using the Load Immediate Formatted instruction. The Out Immediate Formatted instruction could be used to copy the specified number of bits in the accumulator to the specified outputs on the output module, such as Y30–Y37. This technique is useful to quickly copy an input pattern to outputs (without waiting for the CPU scan).
DS HPP
Used Used
DirectSOFT
5-40
C0
LDIF
X10 K8
Load the value of 8 consecutive locations into the accumulator starting with X10
Constant K8
X17 X16 X15 X14 X13 X12 X11 X10 ON OFF ON ON OFF ON OFF ON
Unused accumulator bits are set to zero 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9
8
7 6 5
4 3
2
1
0
0
0
1 0
1
1 0
1
Acc.
OUTIF
Location X10
0
0
0 0
0
0
0
0 0
0
0
0
0 0
0
0
0
0
0 0
0
0
1
0
Y30 K8
Copy the value of the lower 8 bits of the accumulator to Y30 - Y37
Location
Constant
Y37 Y36 Y35 Y34 Y33 Y32 Y31 Y30
Y30
K8
ON OFF ON ON OFF ON OFF ON
Handheld Programmer Keystrokes $
STR
SHFT
C I
SHFT
L ANDST
D
GX OUT
SHFT
I
3 8
F
A 2 8 5
F
0
ENT B
5 D
3
DL205 User Manual, 4th Edition, Rev. D
A
1 0
A
I
0 I
8
8 ENT
ENT
Page 265
Chapter 5: Standard RLL Instructions
Timer, Counter and Shift Register Instructions
1 Timers are used to time an event for a desired length of time. 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 2 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. A discrete bit is associated with each 3 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, current 4 value, and timer preset. 5 6 Timer Preset 7 8 9 Some applications that need an accumulating timer, meaning it has the ability to time, stop, and then resume from where it previously stopped. The accumulating timer works similarly 10 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, the timing 11 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. A tenth of a second and a hundredth of a second timers are available with a maximum time of 9999999.9 and 999999.99 seconds 12 respectively. The timing diagram below shows the relationship between the timer input, timer reset, associated discrete bit, current value, and timer preset. 13 14 A B C D
Using Timers
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
Enable
X1
T0
K30
X2
X2
Reset Input
T0
Current Value
0
10
10
20 30 1/10 Seconds
40
50
0
DL205 User Manual, 4th Edition, Rev. D
5-41
Page 266
Chapter 5: Standard RLL Instructions
Timer (TMR) and Timer Fast (TMRF)
The Timer instruction is a 0.1 second single-input timer 1 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 2 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 preset value. For example, the discrete status bit for Timer 2 would be T2. 8 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 T2, and B “TA2” for the current value of Timer T2. You can perform functions when the timer reaches the specified preset using the discrete status C 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
DS Used HPP Used
Timer#
TMRF
T aaa
B bbb
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
–
2000-3777
–
0-9999
–
0-9999
1400-7377 10000-17777 1400-7377 10000-17777
–
0-9999
Timer#
0-377 –
1400-7377 10000-37777 1400-7377 10000-37777
–
0-9999
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. D
Page 267
Chapter 5: Standard RLL Instructions
Timer Example Using Discrete Status Bits
1 2 3 4 5 6 7 Timer Example Using Comparative Contacts In the following example, a single-input timer is used with a preset of 4.5 seconds. Comparative 8 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 Y3, Y4, and 9 Y5. 10 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
STR
N TMR $
STR
GX OUT
B
C
D
2
SHFT
T MLR
A
ENT
0
0
10
20
C
A
3
ENT
0
6
7
30
40
50
60
8
0
ENT
2
Timing Diagram
X1
TMR
K45
Seconds
T20
0
Y3
K10
2
3
0
10
20
4
5
6
7
30
40
50
60
8
Y3
Y4
K20
1
X1
OUT
TA20
5
1/10th Seconds
DirectSOFT
TA20
Seconds 4
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
Handheld Programmer Keystrokes $
STR
N TMR $
STR
GX OUT $
B
C
1 2
ENT
A
SHFT
D
ENT
SHFT
T MLR
GX OUT
E
ENT
$
SHFT
T MLR
F
ENT
STR
STR
GX OUT
4
5
E
0
T MLR
3
0
1/10th Seconds
C
C
C
2
2
2
A
A
A
4
0
0
0
F
5
ENT
B
C
D
1
2
3
A
A
A
0
0
0
ENT
ENT
ENT
DL205 User Manual, 4th Edition, Rev. D
5-43
Page 268
Chapter 5: Standard RLL Instructions
Accumulating Timer (TMRA)
Accumulating Timer is a 0.1 second two-input timer that 1 The will 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 that 3 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 memory 8 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 Data 13 Operand 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 reference 230
Enable
240
T aaa TMRA B bbb
Reset
250-1 260
Preset
Enable
230
Timer
T aaa TMRAF B bbb
Reset
240
Preset
250-1
Timer
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
–
2000-3777
–
0-99999999
–
0-99999999
–
1400-7377 10000-17777 1400-7377 10000-17777 0-99999999
0-376 –
–
1400-7377 10000-37777 1400-7377 10000-37777 0-99999999
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 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. D
Page 269
Chapter 5: Standard RLL Instructions
Accumulating Timer Example using Discrete Status Bits In the following example, a two input timer (accumulating timer) is used with a preset of three seconds. The timer discrete status bit (T6) will turn on when the timer has timed for three seconds. Notice in this example that the timer times for one 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 zero.
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 contacts are used to energize Y3, Y4, and Y5 at one-second intervals respectively. The 9 comparative contacts will turn off when the timer is reset. 10 11 12 13 14 A B C D Timing Diagram
DirectSOFT
X1
TMRA
0
T6
2
3
Seconds 4
5
6
7
0
10
10
20
30
40
50
8
X1
K30
C10
1
C10
T6
Y10
T6
OUT
Current Value
1/10th Seconds
Handheld Programmer Keystrokes $ $
B
STR
C
SHFT
STR
N TMR
A
SHFT
Handheld Programmer Keystrokes (cont’d) D
ENT
1
0
B
2
G
0
A
1
$
ENT
0
A
3
ENT
0
STR
GX OUT
6
SHFT
T MLR
G
B
A
ENT
1
0
ENT
6
Contacts
DirectSOFT
Timing Diagram
X1
TMRA
0
T20
K45
C10
1
2
3
Seconds 4
5
6
7
0
10
10
20
30
40
50
8
X1
C10
TA20
K10 TA21
Y3
K0
Y3
OUT
Y4
TA21
K1
TA20
K20 TA21
TA21
K1
TA20
K30 TA21
Y5
Y4
K0
T20
OUT
Current Value
1/10th Seconds
Y5
K1
0
OUT
Handheld Programmer Keystrokes $ $
SHFT
A
V AND
SHFT
Q OR
SHFT
E E
D
C
2
$
B
C
T MLR
4 4
3
Handheld Programmer Keystrokes (cont’d)
ENT
0
SHFT
STR
GX OUT
1
SHFT
STR
N TMR $
B
STR
ENT
C
1
2
2
A A A
0
SHFT
ENT
Q OR
SHFT
ENT
GX OUT
ENT
E
0
B
0
SHFT
T MLR
C
SHFT
T MLR
C
2 2
B B
4
1
1
1
F
A
5
0
SHFT
STR
V AND
A B
0
1
ENT
$
ENT
V AND
E
E
SHFT
E
F
T MLR
4 4
4
SHFT
STR
GX OUT
E
2
A
C
0
SHFT
T MLR
C
SHFT
T MLR
C
C
A
2 2
B B
2
A
0
ENT
A
1
B
1
0 1
ENT ENT
ENT
T MLR
2
SHFT
4 5
C
D
0
T MLR
C
2
B
3
A
0
1
ENT
B
1
ENT
ENT
DL205 User Manual, 4th Edition, Rev. D
5-45
Page 270
Chapter 5: Standard RLL Instructions
Counter (CNT)
Counter#
1
2
3 4 5 6 7 8 9 NOTE: A V-memory preset is required only if the ladder program or an OIT must used to change the preset 10 Operand Data DL230 Range DL240 Range DL250-1 Range DL260 Range Type 11 B aaa bbb aaa bbb aaa bbb aaa bbb 12 13 14 A NOTE: * Both the Counter discrete status bits and the current value are accessed with the same data reference B 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. C D 230 240
250-1 260
DS Used HPP Used
The Counter is a two-input counter that increments when the count input logic transitions from off to Count CNT CT aaa on. When the counter reset input is on, the counter B bbb resets to zero. When the current value equals the preset Reset 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 Preset reset. Instruction Specifications Counter Reference (CTaaa): Specifies the counter number. Preset Value (Bbbb): Constant value (K) or a V-memory location. (Pointer (P) for DL240, DL250-1 and DL260.) 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. 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.
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
0-77 –
0-177
2000-2377
–
0-177
2000-3777
–
2000-3777
–
0-9999
–
0-9999
–
1400-7377 10000-17777 1400-7377 10000-17777 0-9999
0-377 –
–
1400-7377 10000-37777 1400-7377 10000-37777 0-9999
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. D