The text of a manual · part 18 of 40
DL05 Micro PLC User Manual, Volume 1 of 2: Chapter 5: Standard RLL and Intelligent Box Instructions, pages 154 to 163
Pages 154 to 163 of 379, from DL05 Micro PLC User Manual, Volume 1 of 2
The original document is the PDF (5.8 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 D0-05AA
Page 154
Chapter 5: Standard RLL - Immediate Instructions
Immediate Instructions Store Immediate (STRI) DS5
Used
HPP
Used
The Store Immediate instruction begins a new rung or additional branch in a rung. The status of the contact will be the same as the status of the associated input point at the time the instruction is executed. The image register is not updated.
X aaa
Store Not Immediate (STRNI) DS5
Used
HPP
Used
The Store Not Immediate instruction begins a new rung or additional branch in a rung. The status of the contact will be opposite the status of the associated input point at the time the instruction is executed. The image register is not updated.
X aaa
Operand Data Type
DL05 Range aaa
Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X
0–377
In the following example when X1 is on, Y2 will energize. DirectSOFT 5
DirectSOFT32 X1
Handheld Programmer Keystrokes Y2
$ STR
B
I
SHFT
8
1
ENT
OUT GX OUT
C 2
ENT
In the following example when X1 is off, Y2 will energize. DirectSOFT 5 DirectSOFT32 X1
Handheld Programmer Keystrokes Y2 OUT
SP STRN GX OUT
SHFT
I
B 8
C 2
1 ENT
Or Immediate (ORI) DS5 Implied HPP
Used
The Or Immediate connects two contacts in parallel. The status of the contact will be the same as the status of the associated input point at the time the instruction is executed. The image register is not updated.
X aaa
Or Not Immediate (ORNI) DS5 Implied HPP
Used
The Or Not Immediate connects two contacts in parallel. The status of the contact will be opposite the status of the associated input point at the time the instruction is executed. The image register is not updated.
X aaa
DL05 Micro PLC User Manual, 6th Edition, Rev. A
ENT
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
5–31
Page 155
Chapter 5: Standard RLL - Immediate Instructions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
OR Immediate Instructions (cont’d) Operand Data Type
DL05 Range aaa
Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X
0–377
In the following example, when X1 or X2 is on, Y5 will energize. DirectSOFT DirectSOFT32 5
Handheld Programmer Keystrokes Y5
X1
$
B STR
OUT
I
SHFT
OR
X2
ENT
1
Q
C 8
GX OUT
ENT
2
F
ENT
5
In the following example, when X1 is on or X2 is off, Y5 will energize. DirectSOFT 5 DirectSOFT32
Handheld Programmer Keystrokes Y5
X1
B
$ STR
OUT X2
ENT
1
R ORN
I
SHFT
C 8
ENT
2
F
GX OUT
ENT
5
And Immediate (ANDI) DS5 Implied HPP
Used
The And Immediate connects two contacts in series. The status of the contact will be the same as the status of the associated input point at the time the instruction is executed. The image register is not updated.
X aaa
And Not Immediate (ANDNI) DS5 Implied HPP
Used
The And Not Immediate connects two contacts in series. The status of the contact will be opposite the status of the associated input point at the time the instruction is executed. The image register is not updated. Operand Data Type
DL05 Range aaa
Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X
0–377
In the following example, when X1 and X2 are on, Y5 will energize. DirectSOFT DirectSOFT32 5 X1
Handheld Programmer Keystrokes X2
Y5 OUT
B
$ STR V AND
1 SHFT
GX OUT
ENT
I
C 8
F 5
2
ENT
ENT
In the following example, when X1 is on and X2 is off, Y5 will energize. DirectSOFT DirectSOFT325 X1
Handheld Programmer Keystrokes X2
Y5 OUT
$
B 1
STR W ANDN GX OUT
5–32
X aaa
DL05 Micro PLC User Manual, 6th Edition, Rev. A
SHFT
ENT
I
C 8
F 5
2 ENT
ENT
Page 156
Chapter 5: Standard RLL - Immediate Instructions
Out Immediate (OUTI) DS5 HPP
DS5 HPP
1 2 3 4 Or Out Immediate (OROUTI) 5 The Or Out Immediate instruction has been designed to use more than 1 rung of discrete logic to control a single output. Multiple Or Out Immediate instructions 6 referencing the same output coil may be used, since all contacts controlling the output are ored together. If the 7 status of any rung is on at the time the instruction is executed, the output will also be on. 8 Operand Data Type DL05 Range aaa 9 10 In the following example, when X1 is on, output point Y2 on the output module will turn on. For instruction entry on the Handheld Programmer, you can use the instruction number (#350) as shown, or type each letter of the command. 11 12 13 14 In the following example, when X1 or X4 is on, Y2 will energize. A B C D The Out Immediate instruction reflects the status of the Used rung (on/off ) and outputs the discrete (on/off ) status to the specified module output point and the image register at the time the instruction is executed. If multiple Out Immediate instructions referencing the same discrete point are used it is possible for the module output status to change multiple times in a CPU scan. See Or Out Immediate. Used
Y aaa OUTI
Used Used
Y aaa OROUTI
Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y
0–377
DirectSOFT 5 DirectSOFT32
Handheld Programmer Keystrokes
Y2
X1
$
B
STR
OUTI
1
O INST#
D
F
5
X1
ENT
ENT
Handheld Programmer Keystrokes
Y2
OR OUTI
X4
0
ENT
2
DirectSOFT 5 DirectSOFT32
A
3
C
ENT
B
$
O INST#
D
F
3
C
Y2
OR OUTI
1
STR
2
$
A
5
E
4
D
F
3 C 2
0
ENT
ENT
ENT
ENT
ENT
STR
O INST#
ENT
ENT
A
5
0
ENT
DL05 Micro PLC User Manual, 6th Edition, Rev. A
5–33
Page 157
Chapter 5: Standard RLL - Immediate Instructions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Set Immediate (SETI) DS5
Used
HPP
Used
The Set Immediate instruction immediately sets, or 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 set it is not necessary for the input to remain on. The Reset Immediate instruction can be used to reset the outputs.
Y aaa aaa SETI
Reset Immediate (RSTI) DS5
Used
HPP
Used
The Reset Immediate instruction immediately resets, or turns off an output or a range of outputs in the image register and the output point(s) at the time the instruction is executed. Once the outputs are reset it is not necessary for the input to remain on.
Y aaa aaa RSTI
Operand Data Type
DL05 Range aaa
Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y
0–377
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. DirectSOFT 5 DirectSOFT32 X1
Handheld Programmer Keystrokes Y2
$
Y5
B STR
SETI
ENT
1
X SET
SHFT
C
I 8
F 2
ENT
5
In the following example, when X1 is on, Y5 through Y22 will be reset (off ) in the image register and on the corresponding output module(s). DirectSOFT 5 DirectSOFT32
5–34
Handheld Programmer Keystrokes X1
Y5
Y22 RSTI
$
B STR
S RST
1 SHFT
I
DL05 Micro PLC User Manual, 6th Edition, Rev. A
ENT C
F 8
5
C 2
2
ENT
Page 158
Chapter 5: Standard RLL - Timer, Counter and Shift Register Instructions
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 3 maximum time of 999.9 and 99.99 seconds respectively. There is a discrete bit associated with each timer to indicate that the current value is equal to or greater than the preset value. The 4 timing diagram below shows the relationship between the timer input, associated discrete bit, current value, and timer preset. 5 6 7 Timer Preset 8 9 10 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 accumulating timer works similarly to the regular timer, but two inputs are required. The start/stop input starts and 11 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 12 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 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
DL05 Micro PLC User Manual, 6th Edition, Rev. A
5–35
Page 159
Chapter 5: Standard RLL - Timer, Counter and Shift Register Instructions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Timer (TMR) and Timer Fast (TMRF) DS5
Used
HPP
Used
5–36
The Timer instruction is a 0.1 second single input timer that T aaa TMR times to a maximum of 999.9 seconds. The Timer Fast B bbb instruction is a 0.01 second single input timer that times up to a maximum of 99.99 seconds. These timers will be Preset Timer# enabled if the input logic is true (on) and will be reset to 0 if the input logic is false (off ). Instruction Specifications TMRF T aaa Timer Reference (Taaa): Specifies the timer number. B bbb Preset Value (Bbbb): Constant value (K) or a V-memory location. Timer# Preset Current Value: Timer current values (BCD) are accessed by The timer discrete status bit and the referencing the associated V or T memory location*. For example, the timer current value for T3 physically resides current value are not specified in the timer instruction in V-memory location V3 as a BCD value. Discrete Status Bit: The discrete status bit is referenced by the associated T memory location. Operating as a “timer done bit”, 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 is TA2. NOTE: Timer preset constants (K) may be changed by using a handheld programmer, even when the CPU is in Run Mode. Therefore, a V-memory preset is required only if the ladder program must change the preset.
Operand Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A/B Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T
DL05 Range aaa bbb
0–177
V-memory for preset values . . . . . . . . . . . . . . . V Pointers (preset only) . . . . . . . . . . . . . . . . . . . . P Constants (preset only) . . . . . . . . . . . . . . . . . . K Timer discrete status bits . . . . . . . . . . . . . . . T/V Timer current values . . . . . . . . . . . . . . . . . V /T**
–– 1200–7377 –– 7400–7577* 1200–7377 –– 7400–7577 –– 0–9999 0–177 or V41100–41107 0–177
NOTE: * May be non-volatile if MOV instruction is used. ** With the HPP, both the Timer discrete status bits and current value are accessed with the same data reference. DirectSOFT 5 uses separate references, such as “T2” for discrete status bit for Timer T2, and “TA2” for the current value of Timer T2.
You can perform functions when the timer reaches the specified preset using the discrete status bit. Or, use comparative contacts to perform functions at different time intervals, based on one timer. The examples on the following page show these two methods of programming timers.
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Page 160
Chapter 5: Standard RLL - Timer, Counter and Shift Register Instructions
Timer Example Using Discrete Status Bits
1 2 3 4 5 6 7 8 Timer Example Using Comparative Contacts In the following example, a single input timer is used with a preset of 4.5 seconds. 9 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, turns off the discrete status bit and resets the timer current value to 0.
DirectSOFT 5
Timing Diagram
Direct SOFT32 X1
TMR
T2
0
K30
2
3
Seconds 4
5
6
7
0
10
20
30
40
50
60
8
X1
Y0
T2
1
OUT
T2
Y0
Handheld Programmer Keystrokes $
B
STR
1
N TMR
Current Value
ENT
C
STR
GX OUT
A
D
3
2
$
SHFT
T MLR
A
ENT
0
ENT
0
C
ENT
2
DirectSOFT Direct SOFT32 5
Timing Diagram
X1
TMR
Seconds
T20
0
K45
TA20
2
3
4
5
6
7
0
10
20
30
40
50
60
8
Y3
Y4
K20
1
X1
Y3
K10
OUT
TA20
0
Y4
OUT
Y5
TA20
Y5
K30
T2
OUT
Current Value
0
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
F
4
C
2
2
2
A
1
C
0
A
C
ENT
0
A
C
5
B
A
A
2
0
A
D
0
0
3
0
ENT
ENT
ENT
DL05 Micro PLC User Manual, 6th Edition, Rev. A
5–37
Page 161
Chapter 5: Standard RLL - Timer, Counter and Shift Register Instructions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Accumulating Timer (TMRA) DS5
Used
HPP
Used
Enable
The Accumulating Timer is a 0.1 second two input timer that will time to a maximum of 9999999.9.
T aaa TMRA B bbb
Reset
Accumulating Fast Timer (TMRAF) DS5
Used
HPP
Used
5–38
The Accumulating Fast Timer is a 0.01 second two-input Timer# Preset timer that will time to a maximum of 99999.99. Each one uses two timer registers in V-memory. These timers have two inputs, an enable and a reset. The timer starts timing when the enable is on and stops when the enable is off (without resetting the T aaa Enable TMRAF count). The reset will reset the timer when on and allow the B bbb timer to time when off. Reset Instruction Specifications Timer Reference (Taaa): Specifies the timer number. Timer# Preset Preset Value (Bbbb): Constant value (K) or a V-memory location. The timer discrete status bit Current Value: Timer current values (BCD) are accessed by and the current value are not referencing the associated V or T memory location*. For specified in the timer example, the timer current value for T3 resides in V-memory instruction location V3 as a BCD value. Discrete Status Bit: The discrete status bit is accessed by referencing the associated T memory location. Operating as a “timer done bit”, 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. NOTE: The accumulating type timer uses two consecutive V-memory locations for the 8-digit value, and therefore two consecutive timer locations. For example, if TMR 1 is used, the next available timer number is TMR 3.
Operand Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A/B Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T V-memory for preset values . . . . . . . . . . . . . . . V Pointers (preset only) . . . . . . . . . . . . . . . . . . . . P Constants (preset only) . . . . . . . . . . . . . . . . . . K Timer discrete status bits . . . . . . . . . . . . . . . T/V Timer current values . . . . . . . . . . . . . . . . . V /T**
DL05 Range aaa 0–176 –– –– –– bbb –– 1200–7377/7400–7577* 1200–7377/7400–7577 0–99999999 0–176 or V41100–41107 0–176
NOTE: * May be non-volatile if MOV instruction is used. ** With the HPP, both the Timer discrete status bits and current value are accessed with the same data reference. DirectSOFT 5 uses separate references, such as “T2” for discrete status bit for Timer T2, and “TA2” for the current value of Timer T2.
The following examples show two methods of programming timers. One performs functions when the timer reaches the preset value using the discrete status bit, or use comparative contacts to perform functions at different time intervals.
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Page 162
Chapter 5: Standard RLL - Timer, Counter and Shift Register Instructions
Accumulating Timer Example using Discrete Status Bits 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 Direct SOFT32 5
Timing Diagram
X1 TMRA
0
T6
1
2
3
Seconds 4
5
6
7
0
10
10
20
30
40
50
8
X1
K30 C10
C10
Y7
T6
OUT
Current Value
T6
Handheld Programmer Keystrokes $
B
3 B
2
A 1
A
SHFT
A
D
C
SHFT
STR N TMR
Handheld Programmer Keystrokes (cont)
ENT
1
STR $
0
ENT
0
STR
G 0
ENT
0
$ GX OUT
6
SHFT
T MLR
G
B
A
ENT
0
1
ENT
6
Accumulator Timer Example Using Comparative Contacts In the following example, a single input timer is used with a preset of 4.5 seconds. Comparative 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. 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
TA20
K30 TA21
Y5 Y4
K0
T20
OUT Current Value
0
1/10 Seconds
Y5
K1
OUT
Handheld Programmer Keystrokes $
B 1
STR $
SHFT
STR N TMR
SHFT
$ V AND
SHFT
Q OR
SHFT
GX OUT
C
$ A 1
2 C
0
E 4 E 4 D 3
0
ENT
C
V AND
SHFT
ENT
Q OR
SHFT
ENT
GX OUT
ENT
A 2
T MLR
SHFT
STR B
A
SHFT
STR
Handheld Programmer Keystrokes (cont’d)
ENT
E 0
F 5
4
A
B
2
0
SHFT
T MLR
C
SHFT
T MLR
C
A 1
B 2
A 0
1 B
2
0
B 1
1
ENT
$
ENT
V AND GX OUT
4 E 4 E 4 SHFT
STR SHFT
T MLR
E
T MLR
4 5
A
C
2
0
SHFT
T MLR
C
SHFT
T MLR
C
C
A
A 0
2 B 2
ENT A 0
1 B
2
B 1
1
ENT ENT
ENT
E F
C
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
D
2
0
SHFT
T MLR
A 3
0
B
C 2
ENT B
1
1
ENT
ENT
DL05 Micro PLC User Manual, 6th Edition, Rev. A
5–39
Page 163
Chapter 5: Standard RLL - Timer, Counter and Shift Register Instructions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 5–40
Using Counters Counters are used to count events. The counters available are up counters, up/down counters, and stage counters (used with RLLPLUS 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. X1
CNT
X1
CT1 K3
Up X2
X2
Reset CT1 Current alue
1
2
3
4
0
Counter preset
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
UDC
X1 X2
X2
Down
X3
X3
CT2 Current Value
CT2 K3
Up
Reset 1
2
1 Counts
2
3
0
Counter Preset
The stage counter has a count input and is reset by the RST instruction. This instruction is useful when programming using the RLLPLUS structured programming. 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
X1
SGCNT
CT2 K3
CT2 Current Value
1
2
3
4
0
Counts
RST CT2
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Counter preset