The text of a manual · part 17 of 53
DL06 Micro PLC User Manual, Volume 1 of 2, pages 160 to 169
Pages 160 to 169 of 524
The original document is the PDF (6.4 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 Direct Logic DL06 and Koyo DL06 D0-06DD1
Page 160
Chapter 5: Standard RLL Instructions - Boolean Instructions
Normally Closed Contact
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 5–6
Normally closed contacts are also very common. This is accomplished with the Store Not, or STRN instruction. The following example shows a simple rung with a normally closed contact. DirectSOFT 5
Direct SOFT32 Example
X0
Handheld Mnemonics Y0 OUT
STRN X0 OUT Y0 END
END
Contacts in Series Use the AND instruction to join two or more contacts in series. The following example shows two contacts in series and a single output coil. The instructions used would be STR X0, AND X1, followed by OUT Y0. DirectSOFT 5 Example Direct SOFT32
X0
Handheld Mnemonics Y0
X1
OUT
STR X0 AND X1 OUT Y0 END
END
Midline Outputs Sometimes it is necessary to use midline outputs to get additional outputs that are conditional on other contacts. The following example shows how you can use the AND instruction to continue a rung with more conditional outputs. DirectSOFT 5 Example Direct SOFT32
X0
Handheld Mnemonics Y0
X1
OUT Y1
X2
OUT X3
Y2 OUT
END
DL06 Micro PLC User Manual, 3rd Edition Rev. A
STR X0 AND X1 OUT Y0 AND X2 OUT Y1 AND X3 OUT Y2 END
Page 161
Chapter 5: Standard RLL Instructions - Boolean Instructions
Parallel Elements You may also have to join contacts in parallel. The OR instruction allows you to do this. The following example shows two contacts in parallel and a single output coil. The instructions would be STR X0, OR X1, followed by OUT Y0.
1 2 3 4 5 Joining Series Branches in Parallel 6 Quite often it is necessary to join several groups of series elements in parallel. The Or Store (ORSTR) instruction allows this operation. The following example shows a simple network 7 consisting of series elements joined in parallel. 8 9 10 11 Joining Parallel Branches in Series You can also join one or more parallel branches in series. The And Store (ANDSTR) instruction allows this operation. The following example shows a simple network with contact 12 branches in series with parallel contacts. 13 14 A Combination Networks B You can combine the various types of series and parallel branches to solve most any application problem. The following C example shows a simple combination network. D DirectSOFT 5 Example Direct SOFT32
Handheld Mnemonics
X0
Y0
OUT
X1
STR X0 OR X1 OUT Y0 END
END
DirectSOFT 5 Direct SOFT32 Example
X0
Handheld Mnemonics
Y0
X1
STR X0 AND X1 STR X2 AND X3 ORSTR OUT Y0 END
OUT
X2
X3
END
DirectSOFT 5 Example Direct SOFT32
X0
Handheld Mnemonics
Y0
X1
OUT
X2
STR X0 STR X1 OR X2 ANDSTR OUT Y0 END
END
X0
X2
X5
Y0
OUT
X1
X3
X4
X6
END
DL06 Micro PLC User Manual, 3rd Edition Rev. A
5–7
Page 162
Chapter 5: Standard RLL Instructions - Boolean Instructions
Comparative Boolean
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 5–8
Some PLC manufacturers make it really difficult to do a simple comparison of two numbers. Some of them require you to move the data all over the place before you can actually perform the comparison. The DL06 Micro PLCs provide Comparative Boolean instructions that allow you to quickly and easily solve this problem. The Comparative Boolean provides evaluation of two BCD values using boolean contacts. The valid evaluations are: equal to, not equal to, equal to or greater than, and less than. Y3 V1400 K1234 In the example when the BCD value in V-memory OUT location V1400 is equal to the constant value 1234, Y3 will energize.
Boolean Stack There are limits to how many elements you can include in a rung. This is because the DL06 PLCs use an 8-level boolean stack to evaluate the various logic elements. The boolean stack is a temporary storage area that solves the logic for the rung. Each time the program encounters a STR instruction, the instruction is placed on the top of the stack. Any other STR instructions already on the boolean stack are pushed down a level. The ANDSTR, and ORSTR instructions combine levels of the boolean stack when they are encountered. An error will occur during program compilation if the CPU encounters a rung that uses more than the eight levels of the boolean stack. The following example shows how the boolean stack is used to solve boolean logic. X0
STR
STR
STR
ORSTR
X1
AND X4
Y0 OUT
X2
AND X3
X5
OR
ANDSTR
STR X0
STR X1
STR X2
1
1
STR X1
1
2
2
STR X0
3 4
STR X0
Output
AND X3
STR X2
1
X2 AND X3
2
STR X1
2
STR X1
3
3
STR X0
3
STR X0
4
4
4
ORSTR
AND X4
ORNOT X5
1
X1 or (X2 AND X3)
1
X4 AND {X1 or (X2 AND X3)}
1
2
STR X0
2
STR X0
2
3
3
ANDSTR 1
XO AND (NOT X5 or X4) AND {X1 or (X2 AND X3)}
2 3
DL06 Micro PLC User Manual, 3rd Edition Rev. A
3
NOT X5 OR X4 AND {X1 OR (X2 AND X3)} STR X0
Page 163
Chapter 5: Standard RLL Instructions - Boolean Instructions
Immediate Boolean The DL06 Micro PLCs can usually complete an operation cycle in a matter of milliseconds. However, in some applications you may not be able to wait a few milliseconds until the next I/O update occurs. The DL06 PLCs offer Immediate input and outputs which are special boolean instructions that allow reading directly from inputs and writing directly to outputs during the program execution portion of the CPU cycle. You may recall that this is normally done during the input or output update portion of the CPU cycle. The immediate instructions take longer to execute because the program execution is interrupted while the CPU reads or writes the I/O point. This function is not normally done until the read inputs or the write outputs portion of the CPU cycle.
1 2 3 4 NOTE: Even though the immediate input instruction reads the most current status from the input point, 5 it only uses the results to solve that one instruction. It does not use the new status to update the image register. Therefore, any regular instructions that follow will still use the image register values. Any immediate instructions that follow will access the I/O again to update the status. The immediate output instruction will 6 write the status to the I/O and update the image register. 7 8 9 06 10 11 12 13 14 A B C D 0
1
2
3
LOGIC
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
PWR RUN CPU TX1 RX1 TX2 RX2
23
K oyo
TERM
PORT1
PORT2
RUN STOP
CPU Scan
The CPU reads the inputs from the local base and stores the status in an input imageregister .
Read Inputs
X11 OFF
... X2 X1 X0 ... ON OFF OFF Input Image Register,
OFF
X0
OFF
X1
Read Inputs from Specialty I/O
Solve the Application Program X0 I
Y0
Immediate instruction does not use the input image register, but instead reads the status from the module immediately.
I/O Point X0 Changes
Write Outputs
ON
X0
OFF
X1
Write Outputs to Specialty I/O Diagnostics
DL06 Micro PLC User Manual, 3rd Edition Rev. A
5–9
Page 164
Chapter 5: Standard RLL Instructions - Boolean Instructions
Boolean Instructions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Store (STR) DS5
Used
HPP
Used
The Store instruction begins a new rung or an additional branch in a rung with a normally open contact. Status of the contact will be the same state as the associated image register point or memory location.
Aaaa
Store Not (STRN) DS5
Used
HPP
Used
5–10
The Store Not instruction begins a new rung or an additional branch in a rung with a normally closed contact. Status of the contact will be opposite the state of the associated image register point or memory location.
Aaaa
Operand Data Type
DL06 Range aaa
....................................A Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X Outputs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y Control Relays . . . . . . . . . . . . . . . . . . . . . . . . . . C Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . S Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T Counter C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CT Special Relay . . . . . . . . . . . . . . . . . . . . . . . . . . SP
0–777 0–777 0–1777 0–1777 0–377 0–177 0–777
In the following Store example, when input X1 is on, output Y2 will energize. DirectSOFT 5 Direct SOFT32 X1
Handheld Programmer Keystrokes Y2 OUT
$
B STR
GX OUT
1 C 2
ENT ENT
In the following Store Not example, when input X1 is off output Y2 will energize. DirectSOFT 5
Direct SOFT32 X1
Handheld Programmer Keystrokes Y2 OUT
DL06 Micro PLC User Manual, 3rd Edition Rev. A
SP STRN
B
GX OUT
C
1 2
ENT ENT
Page 165
Chapter 5: Standard RLL Instructions - Boolean Instructions
Store Bit-of-Word (STRB) DS5
Used
HPP
Used
The Store Bit-of-Word instruction begins a new rung or an additional branch in a rung with a normally open contact. Status of the contact will be the same state as the bit referenced in the associated memory location.
Aaaa.bb
Store Not Bit-of-Word (STRNB) DS5
Used
HPP
Used
The Store Not instruction begins a new rung or an additional branch in a rung with a normally closed contact. Status of the contact will be opposite the state of the bit referenced in the associated memory location.
Aaaa.bb
Operand Data Type
DL06 Range
..................................... V-memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A B PB aaa bb
See memory map See memory map
0 to 15 0 to 15
These instructions look like the STR and STRN instructions only the address is different. Take note how the address is set up in the following Store Bit-of-Word example. When bit 12 of V-memory location V1400 is on, output Y2 will energize. DirectSOFT 5 DirectSOFT32
B1400.12
Y2 OUT
Handheld Programmer Keystrokes STR
SHFT
B
K
1
2
2
ENT
OUT
V
1
4
0
0
ENT
In the following Store Not Bit-of-Word example, when bit 12 of V-memory location V1400 is off, output Y2 will energize. DirectSOFT 5 DirectSOFT32
B1400.12
Y2 OUT
Handheld Programmer Keystrokes STRN
OUT
SHFT
B
V
K
1
2
2
ENT
1
4
0
0
ENT
DL06 Micro PLC User Manual, 3rd Edition Rev. A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
5–11
Page 166
Chapter 5: Standard RLL Instructions - Boolean Instructions
Or (OR)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
DS5 Implied HPP
Used
The Or instruction will logically OR a normally open contact in parallel with another contact in a rung. The status of the contact will be the same state as the associated image register point or memory location.
Aaaa
Or Not (ORN) DS5 Implied HPP
5–12
Used
The Or Not instruction will logically OR a normally closed contact in parallel with another contact in a rung. The status of the contact will be opposite the state of the associated image register point or memory location. Operand Data Type
Aaaa
DL06 Range aaa
....................................A Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y Control Relays . . . . . . . . . . . . . . . . . . . . . . . . . . C Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . S Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CT Special Relay . . . . . . . . . . . . . . . . . . . . . . . . . . SP
0-777 0-777 0–1777 0–1777 0–377 0–177 0-777
In the following Or example, when input X1 or X2 is on, output Y5 will energize. DirectSOFT Direct SOFT32 5 X1
Handheld Programmer Keystrokes Y5
B
$ STR
OUT
1 C
Q OR
X2
GX OUT
2 F 5
ENT ENT ENT
In the following Or Not example, when input X1 is on or X2 is off, output Y5 will energize. DirectSOFT Direct SOFT32 5 X1
Handheld Programmer Keystrokes Y5 OUT
X2
DL06 Micro PLC User Manual, 3rd Edition Rev. A
$
B STR
1
R ORN
C
GX OUT
F
2 5
ENT ENT ENT
Page 167
Chapter 5: Standard RLL Instructions - Boolean Instructions
Or Bit-of-Word (OR) DS5 Implied HPP
Used
The Or Bit-of-Word instruction will logically OR a normally open contact in parallel with another contact in a rung. Status of the contact will be the same state as the bit referenced in the associated memory location.
Aaaa.bb
Or Not Bit-of-Word (ORN) DS5 Implied HPP
Used
The Or Not Bit-of-Word instruction will logically OR a normally closed contact in parallel with another contact in a rung. Status of the contact will be opposite the state of the bit referenced in the associated memory location.
Aaaa.bb
Operand Data Type
DL06 Range
..................................... V-memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A B PB aaa bb
See memory map See memory map
0 to 15 0 to 15
In the following Or Bit-of-Word example, when input X1 or bit 7 of V1400 is on, output Y5 will energize. DirectSOFT DirectSOFT32 5 X1
Y7 OUT
B1400.7 Handheld Programmer Keystrokes STR
1
OR
ENT
SHFT
B
K
7
ENT
7
ENT
OUT
V
1
4
0
0
In the following Or Bit-of-Word example, when input X1 is on or bit 7 of V1400 is off, output Y7 will energize. DirectSOFT DirectSOFT32 5 X1
Y7 OUT
B1400.7 Handheld Programmer Keystrokes STR ORN
OUT
1
ENT
SHFT
B
K
7
ENT
7
ENT
V
1
4
0
DL06 Micro PLC User Manual, 3rd Edition Rev. A
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
5–13
Page 168
Chapter 5: Standard RLL Instructions - Boolean Instructions
AND (AND)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
DS5 Implied HPP
Used
The AND instruction logically ands a normally open contact in series with another contact in a rung. The status of the contact will be the same state as the associated image register point or memory location.
Aaaa
AND NOT (ANDN) DS5 Implied HPP
5–14
Used
The AND NOT instruction logically ands a normally closed contact in series with another contact in a rung. The status of the contact will be opposite the state of the associated image register point or memory location.
Aaaa
Operand Data Type
DL06 Range aaa
....................................A Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Y Control Relays . . . . . . . . . . . . . . . . . . . . . . . . . . C Stage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . S Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . T Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CT Special Relay . . . . . . . . . . . . . . . . . . . . . . . . . . SP
0–777 0–777 0–1777 0–1777 0–377 0–177 0–777
In the following And example, when input X1 and X2 are on output Y5 will energize. DirectSOFT 5 Direct SOFT32 X1
Handheld Programmer Keystrokes X2
Y5 OUT
$
B STR
1
V AND
C
GX OUT
F
2 5
ENT ENT ENT
In the following And Not example, when input X1 is on and X2 is off output Y5 will energize. DirectSOFT Direct SOFT32 5 X1
Handheld Programmer Keystrokes X2
Y5 OUT
DL06 Micro PLC User Manual, 3rd Edition Rev. A
$
B STR
1
W ANDN
C
GX OUT
F
2 5
ENT ENT ENT
Page 169
Chapter 5: Standard RLL Instructions - Boolean Instructions
AND Bit-of-Word (AND) DS5 Implied HPP
Used
The And Bit-of-Word instruction logically ands a normally open contact in series with another contact in a rung. The status of the contact will be the same state as the bit referenced in the associated memory location.
Aaaa.bb
AND Not Bit-of-Word (ANDN) DS5 Implied HPP
Used
Aaaa.bb
The And Not Bit-of-Word instruction logically ands a normally closed contact in series with another contact in a rung. The status of the contact will be opposite the state of the bit referenced in the associated memory location. Operand Data Type
DL06 Range
..................................... V-memory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A B PB aaa bb
See memory map See memory map
0 to 15 0 to 15
In the following And Bit-of-Word example, when input X1 and bit 4 of V1400 is on output Y5 will energize. DirectSOFT 5 DirectSOFT32 X1
B1400.4
Y5 OUT
Handheld Programmer Keystrokes
STR AND
1
ENT
SHFT
B
K
4
ENT
5
ENT
OUT
V
1
4
0
0
In the following And Not Bit-of-Word example, when input X1 is on and bit 4 of V1400 is off output Y5 will energize. DirectSOFT DirectSOFT32 5 X1
Y5
B1400.4
OUT
Handheld Programmer Keystrokes STR ANDN
OUT
1
ENT
SHFT
B
V
K
4
ENT
5
ENT
1
4
0
0
DL06 Micro PLC User Manual, 3rd Edition Rev. A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
5–15