The text of a manual · part 31 of 42
DL305 User Manual: Chapter 11: Instruction Set, pages 252 to 261
Pages 252 to 261 of 359, from DL305 User Manual
The original document is the PDF (4.9 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 D3-08TD2, AutomationDirect D3-16TD2, Konnect-It D3-08TD2, Koyo D3-08TD2, Konnect-It D3-16TD2 and Koyo D3-16TD2
Page 252
11--11
Instruction Set Boolean Instructions
The And Timer instruction logically ands a normally open timer contact in series with another contact in a rung. The timer contact T aaa will be on when the timer current value ² the preset value of the associated timer.
And Not Timer (AND NOT TMR) DL330/340 Only
The And Not Timer instruction logically ands a normally closed timer contact in series with another contact in a rung. The timer contact T aaa will be on when the timer current value is < the preset value of the associated timer. Data Type
Timer
T
T aaa
Instruction Set
And Timer (AND TMR) DL330/340 Only
T aaa
D3--330 Range
D3--340 Range
D3--330P Range* aaa aaa aaa
600--677
600--677
----
* See Chapter 12 for similar RLL PLUS instructions In the following And Timer example, when input 000 is on and the current value in timer 604 is ² the preset value output 050 will energize. DirectSOFT Display 000
Handheld Programmer Keystrokes T604
050 OUT
STR AND OUT
SHF TMR SHF
0 SHF 5
ENT 6 0
0 ENT
4
ENT
In the following And Not Timer example, when input 000 is on and the current value in timer 604 is < the preset value output 050 will energize. DirectSOFT Display 000
Handheld Programmer Keystrokes T 604
050 OUT
STR AND OUT
SHF NOT SHF
0 TMR 5
ENT SHF 0
6 ENT
0
DL305 User Manual, Rev. D
4
ENT
Page 253
Instruction Set
11--12
Instruction Set Boolean Instructions
And Counter (AND CNT) DL330/340 Only
The And Counter instruction logically ands a normally open counter contact in series with another contact in a rung. The counter contact C aaa will be on when the counter current value is ² the preset value of the associated counter.
And Not Counter (AND NOT CNT) DL330/340 Only
The And Not Counter instruction logically ands a normally closed counter contact in series with another contact in a rung. The counter contact C aaa will be on when the counter current value is < the preset value of the associated counter. Data Type
Counter
C
C aaa
C aaa
D3--330 Range
D3--340 Range
D3--330P Range aaa aaa aaa
600--677
600--677
----
* See Chapter 12 for similar RLL PLUS instructions In the following And Counter example, when input 002 is on and the current value in counter 602 is ² the preset value output 050 will energize. DirectSOFT Display 002
Handheld Programmer Keystrokes C 602
050 OUT
STR AND OUT
SHF CNT SHF
2 SHF 5
ENT 6 0
0 ENT
2
ENT
In the following And Not Counter example, when input 002 is on and the current value in counter 602 is < the preset value output 050 will energize. DirectSOFT Display 002
Handheld Programmer Keystrokes C 602
050 OUT
DL305 User Manual, Rev. D
STR AND OUT
SHF NOT SHF
2 TMR 5
ENT SHF 0
6 ENT
0
2
ENT
Page 254
11--13
Instruction Set Boolean Instructions
Or Store (OR STR)
The And Store instruction logically ands two branches of a rung in series. Both branches must begin with the Store instruction.
OUT
The Or Store instruction logically ors two branches of a rung in parallel. Both branches must begin with the Store instruction.
OUT
In the following And Store example, the branch consisting of contacts 000 and 002 have been anded with the branch consisting of contacts 001 and 003. DirectSOFT Display 000
Handheld Programmer Keystrokes 001
010 OUT
002
003
STR OR STR OR
SHF SHF SHF SHF
0 2 1 3
ENT ENT ENT ENT
AND OUT
STR SHF
ENT 1
0
ENT
In the following Or Store example, the branch consisting of 000 and 001 have been ored with the branch consisting of 002 and 003. DirectSOFT Display 000
Handheld Programmer Keystrokes 001
010 OUT
002
003
STR AND STR AND
SHF SHF SHF SHF
0 1 2 3
ENT ENT ENT ENT
OR OUT
STR SHF
ENT 1
0
ENT
DL305 User Manual, Rev. D
Instruction Set
And Store (AND STR)
Page 255
11--14
Instruction Set Boolean Instructions
Instruction Set
There are limits to what you can enter with these simple boolean instructions. This is because the DL305 CPUs use an 8-level stack to evaluate the various logic elements. The stack is a temporary storage area that helps solve the logic for the rung. Each time you enter a Store instruction, the instruction is placed on the top of the stack. Any other instructions on the stack are pushed down a level. The And, Or, And Store, and Or Store instructions combine levels of the stack when they are encountered. Since the stack is only eight levels, an error will occur if the CPU encounters a rung that uses more than the eight levels of the stack. The following example shows how the stack is used to solve simple boolean logic.
000
001
STR
STR
STR
ORSTR
AND 004
050
Output
OUT 002 AND 003
005
ANDSTR
OR
¡ STR 000
© STR 001
¢ STR 002
£ AND 003
1
1
STR 001
1
STR 002
1
002 AND 003
2
2
STR 000
2
STR 001
2
STR 001
3
3
3
STR 000
3
STR 000
4
4
4
4
5
5
5
5
6
6
6
6
7
7
7
7
8
8
8
8
STR 000
¤ ORSTR
¥ AND 004
¦ OR 005
1
001 OR (002 AND 003)
1
004 AND [001 OR (002 AND 003)]
1
005 OR 004 AND [001 OR (002 AND 003)]
2
STR 000
2
STR 000
2
STR 000
3
3 S S
3 S S
8
8
§ ANDSTR 1
000 AND (005 OR 004) AND [001 OR (002 AND 003)]
2 3 S S
8
DL305 User Manual, Rev. D
S S
8
Page 256
Instruction Set Boolean Instructions
The Out instruction reflects the status of the rung (on/off) and outputs the discrete (on/off) state to the specified image register point or memory location. Multiple Out instructions referencing the same discrete location should not be used because only the last Out instruction in the program will control the physical output point. Data Type aaa OUT
D3--330 Range
D3--340 Range aaa aaa
D3--330P Range aaa
Outputs
000--167 700--767
000--177 700--767
000--167 700--767
Control Relays
160--373
160--373 1000--1067
160--174 200--77
Shift Register Bits
400--577
400--577
----
In the following Out example, when input 000 is on output 010 will energize. DirectSOFT Display
Handheld Programmer Keystrokes
000
010 OUT
STR OUT
SHF SHF
0 1
ENT 0
ENT
In the following Out example, two Out instructions using output 10 are used in the program. The status of output 010 being controlled by input 001 will override the instance of output 010 being controlled by input 000. The physical output would always be controlled by input 001. 000
010 OUT
O
O
O
001
O
010 OUT
DL305 User Manual, Rev. D
Instruction Set
Out (OUT)
11--15
Page 257
Instruction Set
11--16
Instruction Set Boolean Instructions
Set (SET) DL330/340 Only
The Set instruction sets or turns on an output. Once the output is set it will remain on until it is reset using the Reset instruction. It is not necessary for the input controlling the Set instruction to remain on. The Set instruction is sometimes known as a latch. The Reset instruction is used to reset the output.
Reset (RST) DL330/340 Only
The Reset instruction resets or turns off an output. Once the output is reset it is not necessary for the input to remain on. The Reset instruction is sometimes known as an unlatch instruction. Data Type aaa SET aaa RST
D3--330 Range
D3--340 Range
D3--330P Range* aaa aaa aaa
Outputs
000--167 700--767
000--177 700--767
----
Control Relays
160--373
160--373 1000--1067
----
Shift Register Bits
400--577
400--577
----
* See Chapter 12 for similar RLL PLUS instructions In the following Set example, when input 000 is on output 010 will be energized. DirectSOFT Display 000
Handheld Programmer Keystrokes 010 SET
STR SET
SHF SHF
0 1
ENT 0
ENT
In the following Reset example, when input 001 is on output 010 will de--energize. DirectSOFT Display 001
Handheld Programmer Keystrokes 010 RST
DL305 User Manual, Rev. D
STR RST
SHF SHF
1 1
ENT 0
ENT
Page 258
Instruction Set Boolean Instructions
The Set Out instruction reflects the status of the rung (on/off) and outputs the discrete (on/off) state to the specified image register location. This instruction is similar to the Out instruction except the output disable coil (special relay 376) will not override and disable the output. Multiple Set Out instructions referencing the same discrete location should not be used because only the last Set Out instruction in the program will control the physical output point. Data Type
Outputs aaa
Instruction Set
Set Out (SET OUT)
11--17
SET OUT
D3--330 Range
D3--340 Range
D3--330P Range aaa aaa aaa
000--167 700--767
000--177 700--767
000--167 700--767
In the following Set Out example, when input location 000 is on output 020 will energize. The output disable coil (special relay 376) will not override this output coil. DirectSOFT Display 000
Handheld Programmer Keystrokes 020 SET OUT
STR SET
SHF OUT
0 SHF
ENT 2
0
ENT
DL305 User Manual, Rev. D
Page 259
Instruction Set
11--18
Instruction Set Boolean Instructions
Set Out Reset (SET OUT RST)
The Set Out Reset instruction is typically known as a one shot. When the input logic produces an off to on transition the output will turn on for one CPU scan.
Data Type aaa OUT RST
D3--330 Range
D3--340 Range aaa aaa
D3--330P Range aaa
Outputs
000--167 700--767
000--177 700--767
000--167 700--767
Control Relays
160--373
160--373 1000--1067
160--174 200--77
In the following Set Out Reset example, when input 007 transitions from off to on, control relay 160 will energize for the remainder of the CPU scan. DirectSOFT Display 007
Handheld Programmer Keystrokes 160 OUT RST
DL305 User Manual, Rev. D
STR SHF 7 SET OUT RST
ENT SHF
1
6
0
ENT
Page 260
11--19
Instruction Set Comparative Boolean Instructions
Comparative Boolean Instructions The Store If Equal instruction begins a new rung or additional branch in a rung with a normally open comparative counter contact. The contact will be on if the specified counter CT aaa = B bbbb.
CTaaa
Instruction Set
Store If Equal (STR) DL330/DL340 Only
B bbbb
CT
Store Not If Equal (STR NOT) DL330/DL340 Only
The Store Not If Equal instruction begins a new rung or additional branch in a rung with a normally closed comparative counter contact. The contact will be on if the specified counter CT aaa ¸ B bbbb. Operand Data Type
Counters
CT aaa
D3--330 Range
B bbbb
D3--340 Range
D3--330P Range*
B aaa bbbb aaa bbbb aaa bbbb
CT
600--677
----
600--677
----
----
----
----
400--577
----
400--577 700--777
----
----
----
0--9999
----
0--9999
----
----
Data registers
R
Constant
K
* See Chapter 12 for similar RLL PLUS instructions In the following Store If Equal example, when CT600 = 2510 output 012 will energize. DirectSOFT Display CT600
K2510
Handheld Programmer Keystrokes 012 OUT
STR SHF
SHF 2
6 5
0 1
0 0
ENT ENT
OUT
SHF
0
1
2
ENT
In the following Store Not If Equal example, when CT600 is ¸ the value in R400 output 020 will energize. DirectSOFT Display CT600
R400
Handheld Programmer Keystrokes 020 OUT
STR R
NOT 4
SHF 0
6 0
0 ENT
0
OUT
SHF
0
1
2
ENT
ENT
DL305 User Manual, Rev. D
Page 261
Instruction Set
11--20
Instruction Set Comparative Boolean Instructions
Or If Equal (OR) DL330/DL340 Only
The Or If Equal instruction connects a normally open comparative counter contact in parallel with another contact. The contact will be on if the specified counter CT aaa = B bbbb.
Or Not If Equal (OR NOT) DL330/DL340 Only
The Or Not If Equal instruction connects a normally closed comparative counter contact in parallel with another contact. The contact will be on if the specified counter CT aaa ¸ B bbbb. Operand Data Type
Counters
D3--330 Range
CT aaa
B bbbb
CT aaa
B bbbb
D3--340 Range
D3--330P Range*
B aaa bbbb aaa bbbb aaa bbbb
CT
600--677
----
600--677
----
----
----
----
400--577
----
400--577 700--777
----
----
----
0--9999
----
0--9999
----
----
Data registers
R
Constant
K
* See Chapter 12 for similar RLL PLUS instructions In the following Or If Equal example, when input contact 001 is on or CT600 = 2510 output 012 will energize. DirectSOFT Display
Handheld Programmer Keystrokes 012
001
OUT CT600
K2510
STR OR SHF
SHF SHF 2
1 6 5
ENT 0 1
0 0
ENT ENT
OUT
SHF
0
1
2
ENT
In the following Or Not If Equal example, when input contact 001 is on or CT600 ¸ the value in R400 output 012 will energize. DirectSOFT Display
Handheld Programmer Keystrokes 012
001
OUT CT600
R400
DL305 User Manual, Rev. D
STR OR R
SHF NOT 4
1 6 0
ENT 0 0
0 ENT
ENT
OUT
SHF
0
1
2
ENT