Chapter 11

Chapter 11
Instruction Set
111
In This Chapter. . . .
— Boolean Instructions
— Comparative Boolean Instructions
— Timer, Counter, and Shift Register Instructions
— Accumulator Load and Output Instructions
— Accumulator Logic Instructions
— Math Instructions
— Bit Operation Instructions
— Number Conversion Instructions
— Program Control Instructions
— Network Instructions
— Message Instructions
11--2
Instruction Set
Instruction Set
Introduction
The DL305 CPUs offer a wide variety of instructions to perform many different types
of operations. This chapter shows you how to use these individual instructions. The
following table provides a quick reference listing of the instruction mnemonic and the
page(s) defining the instruction. (The mnemonics are very similar to the instruction
names and should be easy to become familiar with in a short time.) For example STR
NOT (Comparative) is the mnemonic for Store Not Equal. Each instruction definition
will show in parentheses the keystrokes used to enter the instruction.
There are two ways to quickly find the instruction you need.
S If you know the instruction category (Boolean, Comparative Boolean,
etc.) just use the header at the top of the page to find the pages that
discuss the instructions in that category.
S If you know the individual instruction mnemonic, use the following table
to find the page that discusses the instruction.
The DL330 and DL340 instructions sets are very similar. However, the DL330P
instruction set has several differences. Some of the instructions in this chapter will
be labeled “DL330/DL340 Only.” There may be an equivalent instruction for the
DL330P CPU, but it may also work slightly differently. The DL330P instructions that
operate differently from these instructions are discussed in Chapter 12. Make sure
you review the instructions carefully to make sure you can use the instruction with
your CPU.
DL305 User Manual, Rev. D
Instruction Set
Instruction
Page
Instruction
Page
INV
AND
11--10
MCR
11--50
AND (Comparative)
11--21
MCS
11--50
AND NOT
11--10
AND NOT (Comparative)
11--21
AND NOT T/C
11--11, 11--12
AND STR
11--13
AND T/C
11--11, 11--12
(F71)
(F84)
MUL
(F73)
11--49
11--38
OR
11--7
OR (Comparative)
11--20
OR NOT
11--7
OR NOT (Comparative)
11--20
OR NOT T/C
11--8, 11--9
OR STR
11--13
BCD
(F86)
11--48
BIN
(F85)
11--47
OR T/C
11--8, 11--9
CMP
(F70)
11--32
OUT
11--15
11--23
RST
11--16
11--30
RX
11--16
CNT
DAND
(F75)
(F952)
11--52
DECO
(F82)
11--46
SET
DIV
(F74)
11--40
SET OUT
11--17
SET OUT RST
11--18
DOR
(F76)
11--31
DOUT
(F60)
11--25
DOUT1
(F61)
11--26
DOUT2
(F62)
11--27
DOUT3
(F63)
11--28
DOUT5
(F65)
11--29
DSTR
(F50)
11--25
DSTR1
(F51)
11--26
DSTR2
(F52)
11--27
STR T/C
DSTR3
(F53)
11--28
SUB
DSTR5
(F55)
11--29
TMR
ENCO
(F83)
11--44
WX
FAULT
(F20)
11--56
SHFL
(F82)
11--42
SHFR
(F80)
11--43
SR
11--24
STR
11--4
STR (Comparative)
11--19
STR NOT
11--4
STR NOT (Comparative)
11--19
STR NOT T/C
11--5, 11--6
11--5, 11--6
(F72)
11--36
11--22
(F953)
11--54
NOTE: See Chapter 12 for RLL PLUS instructions.
DL305 User Manual, Rev. D
Instruction Set
11--34
ADD
11--3
11--4
Instruction Set
Boolean Instructions
Instruction Set
Boolean Instructions
Store
(STR)
The Store instruction begins a new rung
or 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.
Store Not
(STR NOT)
The Store Not instruction begins a new
rung or 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.
Data Type
aaa
aaa
D3--330 Range
D3--340 Range
D3--330P Range
aaa
aaa
aaa
Inputs / 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
Special Control Relays
374--377
770--777
374--377
770--777
1074--1077
175--177
770--777
Shift Register Bits
400--577
400--577
----
In the following Store example, when input 000 is on, output 010 will energize.
DirectSOFT Display
000
Handheld Programmer Keystrokes
010
OUT
STR
OUT
SHF
SHF
0
1
ENT
0
ENT
In the following Store Not example, when input 000 is off output 010 will energize.
DirectSOFT Display
000
Handheld Programmer Keystrokes
010
OUT
DL305 User Manual, Rev. D
STR
OUT
NOT
SHF
SHF
1
0
0
ENT
ENT
11--5
Instruction Set
Boolean Instructions
The Store Timer instruction begins a new
rung or additional branch in a rung with a
normally open timer contact. The timer
contact T aaa will be on when the timer
current value is ² the preset value of the
associated timer.
Store Not Timer
(STR NOT TMR)
DL330/340 Only
The Store Not Timer instruction begins a
new rung or additional branch in a rung
with a normally closed timer contact. 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
Store Timer
(STR TMR)
DL330/340 Only
T aaa
D3--330 Range
D3--340 Range
D3--330P Range*
aaa
aaa
aaa
600--677
600--677
----
* See Chapter12 for similar RLL PLUS instructions
In the following Store Timer example, when the current value in timer 600 is ² the
preset value output 017 will energize.
DirectSOFT Display
T600
Handheld Programmer Keystrokes
017
OUT
STR
OUT
TMR
SHF
SHF
1
6
7
0
ENT
0
ENT
In the following Store Not Timer example, when the current value in timer 600 is < the
preset value output 017 will energize.
DirectSOFT Display
T600
Handheld Programmer Keystrokes
017
OUT
STR
OUT
NOT
SHF
TMR
1
SHF
7
6
ENT
0
DL305 User Manual, Rev. D
0
ENT
Instruction Set
11--6
Instruction Set
Boolean Instructions
Store Counter
(STR CNT)
DL330/340 Only
The Store Counter instruction begins a
new rung or additional branch in a rung
with a normally open counter contact.
The counter contact C aaa will be on
when the counter current value ² the
preset value of the associated counter.
Store Not Counter
(STR NOT CNT)
DL330/340 Only
The Store Not Counter instruction begins
a new rung or additional branch in a rung
with a normally closed counter contact.
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 Store Counter example, when the current value in counter 602 is ²
the preset value output 015 will energize.
DirectSOFT Display
C 602
Handheld Programmer Keystrokes
015
OUT
STR
OUT
CNT
SHF
SHF
1
6
5
0
ENT
2
ENT
In the following Store Not Counter example, when the current value in counter 602 is
< the preset value output 015 will energize.
DirectSOFT Display
C602
Handheld Programmer Keystrokes
015
OUT
DL305 User Manual, Rev. D
STR
OUT
NOT
SHF
CNT
1
SHF
5
6
ENT
0
2
ENT
Instruction Set
Boolean Instructions
Or Not
(OR NOT)
The Or instruction logically ors 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.
aaa
The Or Not instruction logically ors 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.
aaa
Data Type
D3--330 Range
D3--340 Range
aaa
aaa
aaa
Inputs / 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
Special Control Relays
374--377
770--777
374--377
770--777
1074--1077
175--177
770--777
Shift Register Bits
400--577
400--577
----
Instruction Set
Or
(OR)
11--7
D3--330P Range
In the following Or example, when input 000 or 001 is on output 010 will energize.
DirectSOFT Display
000
Handheld Programmer Keystrokes
010
OUT
STR
OR
OUT
SHF
SHF
SHF
0
1
1
ENT
ENT
0
ENT
001
In the following Or Not example, when input 000 is on or 001 is off output 010 will
energize.
DirectSOFT Display
000
Handheld Programmer Keystrokes
010
OUT
STR
OR
OUT
SHF
NOT
SHF
0
SHF
1
ENT
1
0
ENT
ENT
001
DL305 User Manual, Rev. D
Instruction Set
11--8
Instruction Set
Boolean Instructions
Or Timer
(OR TMR)
DL330/340 Only
The Or Timer instruction logically ors a
normally open timer contact in parallel
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.
T aaa
Or Not Timer
(OR NOT TMR)
DL330/340 Only
The Or Not Timer instruction logically ors
a normally closed timer contact in parallel
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.
T aaa
Data Type
Timer
T
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 Or Timer example, when input 000 is on or the current value in T600
is ² the preset value output 010 will energize.
DirectSOFT Display
000
Handheld Programmer Keystrokes
010
OUT
STR
OR
OUT
SHF
TMR
SHF
0
SHF
1
ENT
6
0
0
ENT
0
ENT
T600
In the following Or Not Timer example, when input 000 is on or the current value in
T600 is < the preset value output 010 will energize.
DirectSOFT Display
000
Handheld Programmer Keystrokes
010
OUT
T600
DL305 User Manual, Rev. D
STR
OR
OUT
SHF
NOT
SHF
0
TMR
1
ENT
SHF
0
6
ENT
0
0
ENT
11--9
Instruction Set
Boolean Instructions
The Or Counter instruction logically ors a
normally open counter contact in parallel
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.
Or Not Counter
(OR NOT CNT)
DL330/340 Only
The Or Not Counter instruction logically
ors a normally closed counter contact in
parallel 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
Instruction Set
Or Counter
(OR CNT)
DL330/340 Only
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 Or Counter example, when input 007 is on or the current value in
C610 is ² the preset value output 025 will energize.
DirectSOFT Display
007
Handheld Programmer Keystrokes
025
OUT
STR
OR
OUT
SHF
CNT
SHF
7
SHF
2
ENT
6
5
1
ENT
0
ENT
C610
In the following Or Not Counter example, when input location 007 is on or the current
value in C610 is < the preset value output 025 will energize.
DirectSOFT Display
007
Handheld Programmer Keystrokes
025
OUT
STR
OR
OUT
SHF
NOT
SHF
7
CNT
2
ENT
SHF
5
6
ENT
1
C610
DL305 User Manual, Rev. D
0
ENT
Instruction Set
11--10
Instruction Set
Boolean Instructions
And
(AND)
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.
And Not
(AND NOT)
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.
Data Type
aaa
aaa
D3--330 Range
D3--340 Range
aaa
aaa
D3--330P Range
aaa
Inputs / 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
Special Control Relays
374--377
770--777
374--377
770--777
1074--1077
175--177
770--777
Shift Register Bits
400--577
400--577
----
In the following And example, when input 000 and 001 is on output 010 will energize.
DirectSOFT Display
000
Handheld Programmer Keystrokes
001
010
OUT
STR
AND
OUT
SHF
SHF
SHF
0
1
1
ENT
ENT
0
ENT
In the following And Not example, when input 000 is on and 001 is off output 010 will
energize.
DirectSOFT Display
000
Handheld Programmer Keystrokes
001
010
OUT
DL305 User Manual, Rev. D
STR
AND
OUT
SHF
NOT
SHF
0
SHF
1
ENT
1
0
ENT
ENT
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
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
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)
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
STR
STR
ORSTR
001
STR
AND 004
050
Output
OUT
002
AND 003
005
ANDSTR
OR
¡ STR 000
© STR 001
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 003
¢ STR 002
¥ 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
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
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
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
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
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
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
11--21
Instruction Set
Comparative Boolean Instructions
The And If Equal instruction connects a
normally open comparative counter
contact in series with another contact.
The contact will be on if the specified
counter CT aaa = B bbbb.
And Not If Equal
(AND NOT)
DL330/DL340 Only
The And Not If Equal instruction
connects a normally closed comparative
counter contact in series 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
----
----
----
----
----
----
----
Data registers
R
----
400--577
----
400--577
700--777
Constant
K
----
0--9999
----
0--9999
* See Chapter 12 for similar RLL PLUS instructions
In the following And If Equal example, when input contact 001 is on and CT600 =
2510 the contact will turn on and output 012 will energize.
DirectSOFT Display
001
Handheld Programmer Keystrokes
CT600
K2510
012
OUT
STR
AND
SHF
SHF
SHF
2
1
6
5
ENT
0
1
0
0
ENT
ENT
OUT
SHF
0
1
2
ENT
In the following And Not If Equal example, when input contact 001 is on and CT600
¸ the value in R400 output 012 will energize.
DirectSOFT Display
001
Handheld Programmer Keystrokes
CT600
R400
012
OUT
STR
AND
R
SHF
NOT
4
1
6
0
ENT
0
0
0
ENT
ENT
OUT
SHF
0
1
2
ENT
DL305 User Manual, Rev. D
Instruction Set
And If Equal
(AND)
DL330/DL340 Only
11--22
Instruction Set
Timer, Counter, and Shift Register Instructions
Instruction Set
Timer, Counter, and Shift Register Instructions
Timer
(TMR)
DL330/DL340 Only
The Timer instruction provides a single
input timer with a 0.1 second increment
(0--999.9 seconds) in the normal
operating mode, or a 0.01 second
increment (0--99.99 seconds) in the fast
timer mode when relay 770 is turned on.
The timer will time up to 9999 and stop. It
will reset to zero when the input is turned
off. The discrete bit associated with the
timer will be on when the current value is
equal to or greater than the preset value.
Operand Data Type
Timers
TMR
D3--330 Range
T aaa
Bbbbb
D3--340 Range
D3--330P Range
B
aaa
bbbb
aaa
bbbb
aaa
bbbb
T
600--677
----
600--677
----
----
----
----
----
----
----
Data registers
R
----
400--577
----
400--577
700--777
Constant
K
----
0--9999
----
0--9999
* See Chapter 12 for similar RLL PLUS instructions
In the following Timer example, timer 600 will begin timing up when input 000 turns
on. The timer bit associated with timer 600 will turn on when the current value in timer
600 is ² the preset value K30 (3 seconds). When input 000 turns off the timer
discrete bit and current value are reset.
DirectSOFT Display
Handheld Programmer Keystrokes
000
TMR
STR
TMR
K
T600
K30
T600
SHF
SHF
3
0
6
ENT
ENT
0
10
OUT
Timing Diagram
0
1
2
3
4
5
6
7
0
10
20
30
40
50
60
8
000
010
Current
Value
DL305 User Manual, Rev. D
0
0
ENT
11--23
Instruction Set
Timer, Counter, and Shift Register Instructions
The Counter instruction provides a
counter with a count and reset input. The
range of this counter is 0--9999 and it will
increment when the count input
transitions from off to on. The counter is
reset to 0 when you turn on the reset
input. The counter bit associated with the
counter will turn on when the current
value is equal to or greater than the
preset value.
Operand Data Type
Counters
COUNT
CNT
CTaaa
Bbbbb
Instruction Set
Counter
(CNT)
DL330/DL340 Only
RESET
D3--330 Range
D3--340 Range
B
aaa
bbbb
aaa
CT
600--677
----
D3--330P Range
bbbb
aaa
bbbb
600--677
----
----
----
----
----
----
----
Data registers
R
----
400--577
----
400--577
700--777
Constant
K
----
0--9999
----
0--9999
* See Chapter 12 for similar RLL PLUS instructions
In the following Counter example, counter 604 will increment by one count when
input 000 transitions from off to on. When input contact 001 is turned on the counter
will reset to zero. The counter bit associated with counter 604 will turn on when the
current value in counter 604 is ² the preset constant value K3 (3).
DirectSOFT Display
Handheld Programmer Keystrokes
000
CNT
STR
STR
CNT
SHF
CT604
K3
001
CT604
SHF
SHF
SHF
3
0
1
6
ENT
ENT
ENT
0
4
ENT
10
OUT
000
001
010
Current
Value
1
2
3
4
0
DL305 User Manual, Rev. D
Instruction Set
11--24
Instruction Set
Timer, Counter, and Shift Register Instructions
Shift Register
(SR)
DL330/340 Only
The Shift Register instruction shifts data
through a predefined number of shift
register bits. There are 128 bits allocated
for use in shift registers. There is no limit
to the number of shift registers which can
be used in a program, however the total
number of bits used cannot exceed 128.
The Shift Register has three contacts.
S Data — determines the value (1 or
0) that will enter the register
S Clock — shifts the bits one position
on each off to on transition
S Reset —resets the Shift Register to
all zeros.
DATA
SR
From A aaa
CLOCK
To
B bbb
RESET
With each off to on transition of the clock input, the bits which make up the shift
register block are shifted by one bit position and the status of the data input is shifted
into the starting bit position in the block. The direction of the shift depends on the
entry in the From and To fields. From 400 to 407 would define a block of eight bits to
be shifted from bit 400 to bit 407. From 407 to 400 would also define a block of eight
bits, but would shift from bit 407 to bit 400. The maximum size of the shift register
block is limited to 128 bits. There is no minimum block size.
Operand Data Type
D3--330 Range
Shift Register Bits
D3--340 Range
bbbb
aaa
bbbb
aaa
bbbb
400--577
400--577
400--577
400--577
----
----
DirectSOFT Display
000
Handheld Programmer Keystrokes
Data Input
001
SR
From
400
To
417
Clock Input
002
D3--330P Range
aaa
STR
STR
STR
SR
SHF
SHF
SHF
SHF
SHF
4
0
1
2
4
1
Reset Input
Inputs on Successive Scans
Data
Clock
Reset
1
1
0
0
1
0
0
1
0
1
1
0
0
1
0
0
0
1
-- indicates on
DL305 User Manual, Rev. D
Shift Register Bits
400
417
-- indicates off
ENT
ENT
ENT
0
7
0
ENT
ENT
11--25
Instruction Set
Accumulator Load and Output Instructions
Accumulator Load and Output Instructions
The Data Store (F50) is a 16--bit
instruction that loads the value of a 16--bit
register, two consecutive 8--bit registers
(specify starting location), or a 4--digit
BCD value into the accumulator.
DSTR (F50)
A aaaa
Data Out
DOUT (F60)
The Data Out (F60) is a 16--bit instruction
that copies the 16--bit value in the
accumulator to a 16--bit reference or two
consecutive 8--bit registers (specify
starting location).
DOUT (F60)
A aaaa
Data Type
D3--330 Range
D3--340 Range
A
aaaa
aaaa
aaaa
Inputs / Outputs
R
000--014
070--075
000--014
070--075
000--014
070--075
Control Relays
R
016--036
016--036
100--105
016, 020--027
Shift Registers
R
040--056
040--056
----
Stages
R
----
----
100--116
Timer /Counters (16 bit)
R
600--677
600--677
600--677
400--577
0000--9999
Data Registers
R
400--577
400--577
700--777
*Constant (4--digit BCD)
K
0000--9999
0000--9999
Instruction Set
Data Store
DSTR (F50)
D3--330P Range
* A constant is not a valid data type for the DOUT (F60) instruction.
In the following example, when input 000 is on the value (7502) in R402 and R403 is
loaded into the accumulator using the Data Store (F50) instruction. The value in the
accumulator is output to data registers R404 and R405 using the Data Out (F60)
instruction.
DirectSOFT Display
000
DSTR (F50)
R 402
Handheld Programmer Keystrokes
R 403
R 402
7
0
2
2
Accumulator
0
2
5
7
DOUT (F60)
R 404
7
5
0
5
R405
STR
F
SHF
5
0
0
ENT
ENT
R
F
R
4
6
4
0
0
0
2
ENT
4
ENT
ENT
R404
In the following example, when input 001 is on the BCD constant value K7502 is
loaded into the accumulator using the Data Store (F50) instruction. The value in the
accumulator is output to data registers R404 and R405 using the Data Out (F60)
instruction.
DirectSOFT Display
K
001
DSTR (F50)
K 7502
DOUT (F60)
R 404
7
Handheld Programmer Keystrokes
7
5
0
2
7
5
0
2
Accumulator
0
2
5
R405
R404
STR
F
SHF
5
1
0
ENT
ENT
SHF
F
R
7
6
4
5
0
0
0
ENT
4
DL305 User Manual, Rev. D
2
ENT
ENT
Instruction Set
11--26
Instruction Set
Accumulator Load and Output Instructions
Data Store 1
DSTR (F51)
The Data Store 1 (F51) is an 8--bit
instruction that loads the value from a
specified 8--bit register into the lower 8
bits of the accumulator. The upper 8 bits
of the accumulator are set to zero.
DSTR1 (F51)
R aaa
Data Out 1
DOUT (F61)
The Data Out 1 (F61) is an 8--bit
instruction that copies the value in the
lower 8 bits of the accumulator to a
specified 8--bit register.
DOUT1 (F61)
R aaa
Data Type
D3--330 Range
D3--340 Range
D3--330P Range
aaaa
aaaa
aaaa
000--014
070--075
000--014
070--075
016, 020--027
Inputs / Outputs
R
000--014
070--075
Control Relays
R
016--036
016--036
100--105
Shift Registers
R
040--056
040--056
----
Stages
R
----
----
100--116
Data Registers
R
400--577
400--577
700--777
400--577
In the following example, when input 000 is on the value (89) in R410 is loaded into
the lower 8 bits of the accumulator using the Data Store 1 (F51) instruction. The
value in the least significant 8 bits of the accumulator is output to data register R500
using the Data Out 1 (F61) instruction.
DirectSOFT Display
Handheld Programmer Keystrokes
000
R410
DSTR1 (F51)
R 410
Load the value in register
R410 into the accumulator
DOUT1 (F61)
R 500
Copy the value in the
accumulator to
registers R500
DL305 User Manual, Rev. D
0
0
8
9
8
9
8
9
R500
Accumulator
STR
F
SHF
5
0
1
ENT
ENT
R
F
R
4
6
5
1
1
0
0
ENT
0
ENT
ENT
11--27
Instruction Set
Accumulator Load and Output Instructions
The Data Store 2 (F52) is a 4--bit
instruction that loads the value of the
most significant 4 bits of a specified 8--bit
register into the least significant 4 bits of
the accumulator. The remaining 12 bits
of the accumulator are set to zero.
Data Out 2
DOUT (F62)
The Data Out 2 (F62) is a 4--bit
instruction that copies the value in the
least significant 4 bits of the accumulator
into the most significant 4 bits of a
specified 8--bit register. The lower 4 bits
of the register are not altered .
Data Type
DSTR2 (F52)
R aaa
Instruction Set
Data Store 2
DSTR (F52)
DOUT2 (F62)
R aaa
D3--330 Range
D3--340 Range
aaaa
aaaa
D3--330P Range
aaaa
000--014
070--075
000--014
070--075
016, 020--27
Inputs / Outputs
R
000--014
070--075
Control Relays
R
016--036
016--036
100--105
Shift Registers
R
040--056
040--56
----
Stages
R
----
----
100--116
Data Registers
R
400--577
400--577
700--777
400--577
In the following example, when input 000 is on the most significant 4 bits of R1 are
loaded into the lower 4 bits of the accumulator using the Data Store 2 (F52)
instruction. The value in the least significant 4 bits of the accumulator is output to
most significant 4 bits of data register R400 using the Data Out 2 (F62) instruction.
DirectSOFT Display
Handheld Programmer Keystrokes
000
R001
DSTR2 (F52)
R 001
Load the upper 4 bits in
register 1 into the lower 4 bits
of the accumulator
DOUT2 (F62)
R 400
5
0
0
*
0
5
5
*
R400
The lower 4 bits (*) of R1
are not loaded into the
accumulator
Accumulator
STR
F
SHF
5
0
2
ENT
ENT
R
F
R
1
6
4
ENT
2
0
ENT
0
The lower 4 bits (*) of R400
are not altered
Copy the lower 4 bits of the
accumulator to the upper 4
bits or registers R400
DL305 User Manual, Rev. D
ENT
Instruction Set
11--28
Instruction Set
Accumulator Load and Output Instructions
Data Store 3
DSTR (F53)
The Data Store 3 (F53) is a 4--bit
instruction that loads the value of the
least significant 4 bits of a specified 8--bit
register into the least significant 4 bits of
the accumulator. The upper 12 bits of the
accumulator are set to zero.
Data Out 3
DOUT (F63)
The Data Out 3 (F63) is a 4--bit
instruction that copies the value in the
least significant 4 bits of the accumulator
to the least significant 4 bits of a specified
8 bit register. The upper 4 bits of the
register are not altered.
Data Type
DSTR3 (F53)
R aaa
DOUT3 (F63)
R aaa
D3--330 Range
D3--340 Range
aaaa
aaaa
D3--330P Range
aaaa
000--014
070--075
000--014
070--075
016, 020--027
Inputs / Outputs
R
000--014
070--075
Control Relays
R
016--036
016--036
100--105
Shift Registers
R
040--056
040--056
----
Stages
R
----
----
100--116
Data Registers
R
400--577
400--577
700--777
400--577
In the following example, when input 000 is on the least significant 4 bits of R005 are
loaded into the accumulator using the Data Store 3 (F53) instruction. The data in the
least significant 4 bits of the accumulator is output to the least significant 4 bits of
R016 using the Data Out 3 (F63) instruction.
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR3 (F53)
R 005
Load the lower 4 bits in
register 5 into the lower 4 bits
of the accumulator
DOUT3 (F63)
R 016
R005
The upper 4 bits (*) of R5
are not loaded into the
accumulator
0
0
The upper 4 bits (*) of R400
are not altered
Output the lower 4 bits of the
accumulator to the lower 4
bits of R16
DL305 User Manual, Rev. D
*
8
0
8
*
8
R016
Accumulator
STR
F
SHF
5
0
3
ENT
ENT
R
F
R
5
6
1
ENT
3
6
ENT
ENT
Instruction Set
Accumulator Load and Output Instructions
The Data Store 5 (F55) is a 16--bit
instruction that loads the value of 16
image register locations for a specified
16 point input module into the
accumulator.
DSTR 5 (F55)
R aaa
Data Out 5
DOUT (F65)
The Data Out 5 (F65) is a 16--bit
instruction that outputs the 16 bit value in
the accumulator to the image register of a
specified 16 point output module.
DOUT 5 (65)
R aaa
Data Type
D3--330 Range
Inputs / Outputs
R
D3--340 Range
D3--330P Range
aaaa
aaaa
aaaa
000--014
070--075
000--014
070--075
000--014
070--075
In the following example, when input 000 is on the binary status of a 16 point I/O
module in slot 1 (R000 and R010) is loaded into the accumulator using the
Data Store 5 (F55) instruction. The value in the accumulator is copied to I/O register
locations in slot 2 (R001 and R011) using the Data Out 5 (F65) instruction.
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR5 (F55)
R 000
R
Loads status of 16 point
input image register
(R000 and R010) to
accumulator
0
1
0
R
0
0
0
7
I/O Points 100--107
6 5 4 3 2 1 0
7
I/O Points 000--007
6 5 4 3 2 1 0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
STR
F
SHF
5
0
5
ENT
ENT
R
F
0
6
1
ENT
5
ENT
ENT
R
1
Load status of 16 pt. input module into the accumulator
Acc.
15 14 13 12 11 10 9
8
7
6
5
4
3
2
1
0
0
0
0
0
0
0
1
0
0
1
1
0
0
0
0
0
I/O Points 100--107
R
DOUT5 (F65)
R 001
Copy the value in the
accumulator to R001
and R011
0
1
I/O Points 000--007
1
R
I/O Points 110--117
0
0
1
I/O Points 010--017
7
6
5
4
3
2
1
0
7
6
5
4
3
2
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
DL305 User Manual, Rev. D
Instruction Set
Data Store 5
DSTR (F55)
11--29
11--30
Instruction Set
Accumulator Logic Instructions
Instruction Set
Accumulator Logic Instructions
Data And
DAND (F75)
The Data And (F75) is a 16--bit
instruction that logical ands the value in a
16--bit reference, two consecutive 8--bit
registers (specify starting location), or a
4--digit BCD constant with the value in
the accumulator. The result resides in the
accumulator.
Data Type
D3--330 Range
DAND (F75)
A aaaa
D3--340 Range
D3--330P Range
A
aaaa
aaaa
aaaa
Inputs / Outputs
R
000--014
070--075
000--014
070--075
000--014
070--075
Control Relays
R
016--036
016--036
100--105
016, 020--027
Shift Registers
R
040--056
040--056
----
Stages
R
----
----
100--116
Timer /Counters (16 bit)
R
600--677
600--677
600--677
Data Registers
R
400--577
400--577
700--777
400--577
Constant (4--digit BCD)
K
0000--9999
0000--9999
0000--9999
In the following example, when input 000 is on the value(6489) in R402 and R403 is
loaded into the accumulator using the Data Store (F50) instruction. The data in the
accumulator is logically anded with the constant K4107 with the result residing in the
accumulator. The value in the accumulator is output to data register R404 and R405
using the Data Out (F60) instruction.
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR (F50)
R 402
Load the value in register
R402 and R403 into the
accumulator
Acc.
DAND (F75)
K4107
AND the value in the
accumulator with the constant
value 4107
AND
DOUT (F60)
R 404
Output the value in the
accumulator to registers R404
and R405
DL305 User Manual, Rev. D
9
STR
F
SHF
5
0
0
ENT
ENT
R
F
SHF
4
7
4
0
5
1
2
ENT
0
F
R
6
4
0
0
ENT
4
R403
R402
6
8
4
7
6
5
4
3
2
1
0
7
6
5
4
3
2
1
0
0
1
1
0
0
1
0
0
1
0
0
0
1
0
0
1
0
1
1
0
0
1
0
0
1
0
0
0
1
0
0
1
Accumulator
0
1
0
0
0
0
0
1
0
0
0
0
0
1
1
1
Constant (4107)
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
Accumulator
4
0
0
1
R405
R404
ENT
7
ENT
ENT
11--31
Instruction Set
Accumulator Logic Instructions
The Data Or (F76) is a 16--bit instruction
that logically ors the value in a 16--bit
reference, two consecutive 8--bit
registers, (specify starting location) or a
4--digit BCD constant with the value in
the accumulator. The result resides in the
accumulator.
Data Type
DOR (F76)
A aaaa
D3--330 Range
D3--340 Range
A
aaaa
aaaa
aaaa
Inputs / Outputs
R
000--014
070--075
000--014
070--075
000--014
070--075
Control Relays
R
016--036
016--036
100--105
016, 020--027
Shift Registers
R
040--056
040--056
----
Stages
R
----
----
100--116
Timer /Counters (16 bit)
R
600--677
600--677
600--677
Data Registers
R
400--577
400--577
700--777
400--577
Constant (4--digit BCD)
K
0000--9999
0000--9999
0000--9999
Instruction Set
Data Or
DOR (F76)
D3--330P Range
In the following example, when input 000 is on the value (6481) in R402 and R403 is
loaded into the accumulator using the Data Store (F50) instruction. The data in the
accumulator is logically ored with the constant K4102 with the result residing in the
accumulator. The value in the accumulator is output to data registers R404 and
R405 using the Data Out (F60) instruction.
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR (F50)
R 402
Load the value in register
R402 and 403 into the
accumulator
7
Acc.
DOR (F76)
K4102
AND the value in the
accumulator with the constant
value 4102
DOUT (F60)
R 404
OR
6
5
1
STR
F
SHF
5
0
0
ENT
ENT
3
R
F
K
4
7
4
0
6
1
2
ENT
0
F
R
6
4
0
0
ENT
4
R403
R402
6
8
4
4
3
2
1
0
7
6
5
4
2
1
0
0
1
1
0
0
1
0
0
1
0
0
0
0
0
0
1
0
1
1
0
0
1
0
0
1
0
0
0
0
0
0
1
Accumulator
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
Constant (4102)
0
1
1
0
0
1
0
1
1
0
0
0
0
0
1
1
Accumulator
6
5
8
3
R405
R404
Output the value in the
accumulator to registers R404
and R405
DL305 User Manual, Rev. D
ENT
2
ENT
ENT
Instruction Set
11--32
Instruction Set
Accumulator Logic Instructions
Compare
CMP (F70)
The Compare (F70) is a 16--bit
instruction that compares the value in a
16--bit reference, two consecutive 8--bit
registers (specify starting location), or a
4--digit BCD against the value in the
accumulator. Discrete bit flags are used
to indicate if the result of the comparison
was greater than, equal to, or less than
the value in the accumulator.
Data Type
CMP (F70)
A aaaa
D3--330 Range
D3--340 Range
A
aaaa
aaaa
aaaa
Inputs / Outputs
R
000--014
070--075
000--014
070--075
000--014
070--075
Control Relays
R
016--036
016--036
100--105
016, 020--27
Shift Registers
R
040--056
040--56
----
Stages
R
----
----
100--116
Timer /Counters (16 bit)
R
600--677
600--677
600--677
Data Registers
R
400--577
400--577
700--777
400--577
Constant (4--digit BCD)
K
0000--9999
0000--9999
0000--9999
Discrete Bit Flags
Description
772
Will be on if the accumulator value is greater than the compare value
773
Will be on if the accumulator value is equal to the compare value
774
Will be on if the accumulator value is less than the compare value
DL305 User Manual, Rev. D
D3--330P Range
11--33
Instruction Set
Accumulator Logic Instructions
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR (F50)
R 402
Load the value in registers
402 and 403 into the
accumulator
R 403
R 402
2
1
3
Acc.
2
1
3
2
2
Compared
with
CMP (F70)
R 404
Compare the value in the
accumulator with the value in
registers 404 and 405
000
774
160
7
5
R405
0
2
STR
F
SHF
5
0
0
ENT
ENT
R
F
R
STR
AND
4
7
4
SHF
SHF
0
0
0
0
7
2
ENT
4
ENT
7
ENT
4
ENT
OUT
SHF
1
6
0
ENT
ENT
R404
772
Accumulator value is
greater than compare value
OUT
773
Flag status after Compare execution
772 off
773 off
774 on
Accumulator value is
equal to compare value
774
Accumulator value is
less than compare value
NOTE: Input 000 has been used to interlock output 160. This is done since an earlier
comparison could result in status flag 774 coming on when this particular comparison is not
being executed thereby providing the opportunity for an unexpected output signal on
output 160.
It is a common mistake to just use the status flags without interlocking to control outputs in a
program but, status flags 772 -- 774 can change several times during the same scan. Just
as you should not use the status flags by themselves to control outputs, you also should not
monitor status flags within the program. Instead you should monitor the interlocked outputs
controlled by the status flags.
DL305 User Manual, Rev. D
Instruction Set
In the following example, when input 000 is on the value (2132) in R402 and R403 is
loaded into the accumulator using the Data Store (F50) instruction. The data in the
accumulator is compared to value in data registers R404 and R405 using the
Compare (F70) instruction. Discrete status flag 774 is used to indicate if the
accumulator is less than the compare value in this example.
11--34
Instruction Set
Math Instructions
Instruction Set
Math Instructions
Add
ADD (F71)
The Add (F71) is a 16--bit instruction that
adds the value of a 16 bit reference, two
consecutive 8--bit registers (specify
starting location), or a 4--digit BCD value
with the value in the accumulator. The
result resides in the accumulator.
Discrete bit flags are used to indicate if
the result had a carry digit or if the result
was was zero.
Data Type
ADD (F71)
A aaaa
D3--330 Range
D3--340 Range
A
aaaa
aaaa
D3--330P Range
aaaa
Inputs / Outputs
R
000--014
070--075
000--014
070--075
000--014
070--075
Control Relays
R
016--036
016--036
100--105
016, 020--027
Shift Registers
R
040--056
040--056
----
Stages
R
----
----
100--116
Timer /Counters (16 bit)
R
600--677
600--677
600--677
Data Registers
R
400--577
400--577
700--777
400--577
Constant (4--digit BCD)
K
0000--9999
0000--9999
0000--9999
Discrete Bit Flags
Description
775
Will be on if the operation results in a carry
776
Will be on if the result is 0
In the following example, when input 000 is on the value (3619) in R402 and R403 is
loaded into the accumulator using the Data Store (F50) instruction. The Add
instruction (F71) adds the value (2602) in R410 and R411 to the value in the
accumulator. The result in the accumulator is then copied to data registers R404 and
R405 with the Data Out (F60) instruction.
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR (F50)
R 402
R 403
R 402
3
6
1
9
3
6
1
9
Accumulator
2
6
0
2
(R410 and R411)
6
2
2
1
Accumulator
6
2
2
1
Load the value in registers
R402 and R403 into the
accumulator
ADD (F71)
R410
+
Add the value in the
accumulator with the value in
registers R410 and R411
DOUT (F60)
R 404
Copy the value in the
accumulator to registers R404
and R405
R 405
R 404
777
Carry bit
776
Result equal 0
DL305 User Manual, Rev. D
STR
F
SHF
5
0
0
ENT
ENT
R
F
R
4
7
4
0
1
1
2
ENT
0
F
R
6
4
0
0
ENT
4
ENT
ENT
ENT
Instruction Set
Math Instructions
Add Example
11--35
Registers for DSTR
Instruction
Registers for ADD
Instruction
Registers for DOUT
Instruction
Discrete Status
Flag
Discrete Status
Flag
R401/R400
R403/R402
R405/R404
775
776
Example 1
500
400
0900
off
off
Example 2
5000
5000
0000
on
on
Example 3
5050
5000
0050
on
off
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR (F50)
R 400
Load the value in registers
R400 and R401 into the
accumulator
ADD (F71)
R402
Add the value in the
accumulator with the value in
registers R402 and R403
DOUT (F60)
R 404
STR
F
SHF
5
0
0
ENT
ENT
R
F
R
4
7
4
0
1
0
0
ENT
2
F
R
6
4
0
0
ENT
4
ENT
STR
OUT
SHF
SHF
7
0
7
1
5
0
ENT
ENT
STR
OUT
SHF
SHF
7
0
7
1
6
1
ENT
ENT
ENT
ENT
Output the value in the
accumulator to registers R404
and R405
000
775
010
OUT
Output 010 will be on if the
operation results in a carry
000
776
011
OUT
Output 011 will be on if the
result of the addition is zero
NOTE: An input has been used to interlock the outputs on the last two rungs. This is
done since an earlier math instruction could result in the status flag coming on
when this particular math instruction is not being executed thereby providing the
opportunity for an unexpected output signal.
It is a common mistake to just use the status flags without interlocking to control
outputs in a program but, the status flags can change several times during the
same scan. Just as you should not use the status flags by themselves to control
outputs, you also should not monitor status flags within the program. Instead you
should monitor the interlocked outputs controlled by the status flags.
DL305 User Manual, Rev. D
Instruction Set
The following examples demonstrate how the discrete status flags are used to
indicate if the result of the add has produced a number which exceeds the capacity of
the accumulator. Remember, the accumulator has a 4 digit maximum. When a
calculation produces a number larger than 4 digits, part of this number is lost. The
following table shows different values being used in the logic example below. Notice
how the discrete status flags change.
Instruction Set
11--36
Instruction Set
Math Instructions
Subtract
SUB (F72)
The Subtract (F72) is a 16--bit instruction
that subtracts the value in a 16--bit
register, two consecutive 8--bit registers
(specify starting location), or a 4--digit
BCD value from the value in the
accumulator. The result resides in the
accumulator. Discrete bit flags are used
to indicate if the result had a borrow digit
or the result was zero.
Data Type
SUB (F72)
A aaaa
D3--330 Range
D3--340 Range
A
aaaa
aaaa
D3--330P Range
aaaa
Inputs / Outputs
R
000--014
070--075
000--014
070--075
000--014
070--075
Control Relays
R
016--036
016--036
100--105
016, 020--027
Shift Registers
R
040--056
040--056
----
Stages
R
----
----
100--116
Timer /Counters (16 bit)
R
600--677
600--677
600--677
Data Registers
R
400--577
400--577
700--777
400--577
Constant (4--digit BCD)
K
0000--9999
0000--9999
0000--9999
Discrete Bit Flags
Description
775
Will be on if the result if a borrow digit occurred
776
Will be on if the result is 0
In the following example, when input 000 is on the value (3619) in R402 and R403 is
loaded into the accumulator using the Data Store (F50) instruction. The constant
value K1406 is subtracted from the value in the accumulator using the Subtract
(F72) instruction. The result in the accumulator is then copied to data registers R404
and R405 using the Data Out (F60) instruction.
Handheld Programmer Keystrokes
DirectSOFT Display
000
DSTR (F50)
R 402
Load the value in registers
R402 and R403 into the
accumulator
SUB (F72)
K1406
--
Subtract the value in the
accumulator with the value in
registers R402 and R403
DOUT (F60)
R 404
Output the value in the
accumulator to registers R404
and R405
R 403
R 402
3
6
1
9
3
6
1
9
Accumulator
1
4
0
6
Constant (K1406)
2
2
1
3
Accumulator
2
2
1
3
R 405
R 404
775
Borrow digit
776
Result equal 0
DL305 User Manual, Rev. D
STR
F
SHF
5
0
0
ENT
ENT
R
F
SHF
4
7
1
0
2
4
2
ENT
0
F
R
6
4
0
0
ENT
4
ENT
6
ENT
ENT
Instruction Set
Math Instructions
Subtract Example
11--37
Registers for DSTR
Instruction
Registers for SUB
Instruction
Registers for DOUT
Instruction
Discrete Status
Flag
Discrete Status
Flag
R401/R400
R403/R402
R405/R404
775
776
Example 1
6050
5000
1050
off
off
Example 2
7050
7050
0000
off
on
Example 3
5000
6000
9000*
on
off
* The DL305 cannot process negative numbers. When the number being subtracted
from the accumulator is larger than the number in the accumulator, a borrow digit
occurs and the subtraction is completed. The value in the accumulator does not
represent the difference between the two numbers. To get the difference between
the two numbers in Example 3 the result (9000) in the accumulator is subtracted
from 0. The final result is 1000, the difference between 6000 and 5000.
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR (F50)
R 400
Load the value in registers
R400 and R401 into the
accumulator
SUB (F72)
R402
Subtract the value in the
accumulator with the value in
registers R402 and R403
DOUT (F60)
R 404
000
775
Output the value in the
accumulator to registers R404
and R405
DSTR (F50)
K0
STR
F
SHF
5
0
0
ENT
ENT
R
F
R
4
7
4
0
2
0
0
ENT
2
F
R
STR
6
4
SHF
0
0
0
ENT
4
ENT
AND
F
SHF
5
7
0
7
ENT
R
F
K
4
7
0
0
2
ENT
4
ENT
F
R
6
4
0
0
ENT
4
ENT
ENT
ENT
5
ENT
ENT
Load the constant zero (0)
into the accumulator
SUB (F72)
R404
Subtract the value in the
accumulator with the value in
registers R404 and R405
DOUT (F60)
R 404
Output the value in the
accumulator to registers R404
and R405
NOTE: It is a common mistake to just use the status flags without interlocking to
control outputs in a program, but the status flags can change several times during
the same scan. Just as you should not use the status flags by themselves to control
outputs, you also should not monitor status flags within the program. Instead you
should monitor the interlocked outputs controlled by the status flags.
DL305 User Manual, Rev. D
Instruction Set
The following examples demonstrate how the discrete status flags are used to
indicate if the result of the Subtraction is a 0 or required a borrow digit. The following
table shows different values being used in the logic example below. Notice how the
discrete status flags change for each example.
Instruction Set
11--38
Instruction Set
Math Instructions
Multiply
MUL (F73)
The Multiply (F73) is a 16--bit instruction
that multiplies the value in a 16--bit
register, two consecutive 8--bit registers,
or a 4--digit BCD value by the value in the
accumulator. The least significant four
digits of the result are stored in the
accumulator and the most significant
four digits are stored in the auxiliary
accumulator (R575 and R577). A
discrete bit flag is used to indicate if the
result was zero.
Data Type
MUL (F73)
A aaaa
D3--330 Range
D3--340 Range
A
aaaa
aaaa
D3--330P Range
aaaa
Inputs / Outputs
R
000--014
070--075
000--014
070--075
000--014
070--075
Control Relays
R
016--036
016--036
100--105
016, 020--027
Shift Registers
R
040--056
040--056
----
Stages
R
----
----
100--116
Timer /Counters (16 bit)
R
600--677
600--677
600--677
Data Registers
R
400--577
400--577
700--777
400--577
Constant (4--digit BCD)
K
0000--9999
0000--9999
0000--9999
Discrete Bit Flags
Description
776
Will be on if the result is 0
In the following example, when input 000 is on the value (3619) in R402 and R403 is
loaded into the accumulator using the Data Store (F50) instruction. The data in the
accumulator is multiplied with the constant K2 with the result residing in the
accumulator and auxiliary accumulator (R576 and R577) using the Multiply (F73)
instruction. The value in the accumulator is output to data registers R404 and R405
using the Data Out (F60) instruction.
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR (F50)
R 402
Load the value in registers
R402 and R403 into the
accumulator
MUL (F73)
K2
Multiply the value in the
accumulator with the
constant 2
R 403
R 402
3
6
1
9
3
6
1
9
Accumulator
2
Constant (K2)
X
0
0
0
0
Auxilliary Acc.
R 577 R 576
2
3
8
Accumulator
7
DOUT (F60)
R404
Copy the value in the
accumulator to registers R404
and R405
7
2
R 405
3
8
R 404
776
Result equal 0
DL305 User Manual, Rev. D
STR
F
SHF
5
0
0
ENT
ENT
R
F
SHF
4
7
2
0
3
ENT
2
ENT
F
R
6
4
0
0
ENT
4
ENT
ENT
11--39
Instruction Set
Math Instructions
Multiply Example
Whenever possible multiplications resulting in more than 4 digits should be avoided
since the DL305 instruction set can only manipulate a maximum of two consecutive
8--bit registers (4 digits) at one time.
If the result of a multiplication is greater than 4 digits, the application program must
be written to compensate for the instruction set 4 digit maximum for data
manipulation. The example below shows how the auxiliary accumulator is used to
store a result with more than 4 digits and how to access the upper 4 digits.
The example below shows how the auxiliary accumulator is used to process
numbers larger than 4 digits when the multiplication instruction is used.
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR (F50)
R 402
Load the value in registers
R402 and R403 into the
accumulator
MUL (F73)
K50
Multiply the value in the
accumulator with the
constant 50
DOUT (F60)
R412
R 403
R 402
3
6
1
9
3
6
1
9
Accumulator
5
0
Constant (K50)
5
0
X
0
0
1
8
Auxilliary Acc.
R 577 R 576
0
9
Accumulator
0
9
5
STR
F
SHF
5
0
0
ENT
ENT
R
F
SHF
4
7
5
0
3
0
2
ENT
ENT
F
R
F
6
4
5
0
1
0
ENT
2
ENT
R
F
R
5
6
4
7
0
1
6
ENT
4
0
R 413
R 412
0
1
Output the value in the
accumulator to registers R412
and R413
DSTR (F50)
R 576
Load the value in registers
R576 and R577 into the
accumulator
DOUT (F60)
R414
Output the value in the
accumulator to registers R414
and R415
0
8
Accumulator
0
0
R 415
1
8
R 414
DL305 User Manual, Rev. D
ENT
ENT
ENT
ENT
Instruction Set
The multiply instruction allows you to multiply two 4--digit numbers together. The
result is located in the accumulator and the auxiliary accumulator (R576 and R577)
when necessary. The accumulator holds the lower 4 digits of the result and the
auxiliary accumulator holds the upper 4 digits.
Instruction Set
11--40
Instruction Set
Math Instructions
Divide
DIV (F74)
The Divide (F74) is a 16--bit instruction
that divides the value in the accumulator
by the value in a 16--bit register, two
consecutive 8--bit registers, or a 4--digit
BCD value. The integer portion of the
result is stored in the accumulator and
the decimal fraction is stored in the
auxiliary accumulator, R576 and R577.
Discrete flags are used to indicate if the
dividend or divisor is zero or if only the
divisor is zero.
Data Type
D3--330 Range
D3--340 Range
DIV (F74)
A aaaa
D3--330P Range
A
aaaa
aaaa
aaaa
Inputs / Outputs
R
000--014
070--075
000--014
070--075
000--014
070--075
Control Relays
R
016--036
016--036
100--105
016, 020--027
Shift Registers
R
040--056
040--056
----
Stages
R
----
----
100--116
Timer /Counters (16 bit)
R
600--677
600--677
600--677
Data Registers
R
400--577
400--577
700--777
400--577
Constant (4--digit BCD)
K
0000--9999
0000--9999
0000--9999
Discrete Bit Flags
Description
776
Will be on if the dividend or divisor is zero
777
Will be on if the divisor is zero
In the following example, when input 000 is on the value (530) in R402 and R403 is
loaded into the accumulator using the Data Store (F50) instruction. The data in the
accumulator is divided by the constant 10 (K10). The result in the accumulator and is
copied to data registers R404 and R405 using the Data Out (F60) instruction. The
remainder is in the auxiliary accumulator (R576 and R577).
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR (F50)
R 402
Load the value in registers
R402 and R403 into the
accumulator
DIV (F74)
K10
Divide the value in the
accumulator by the
constant value 10
R 403
R 402
0
3
0
Copy the value in the
accumulator to registers R404
and R405
5
­
0
0
0
STR
F
SHF
5
0
0
ENT
ENT
3
0
Accumulator
R
F
SHF
4
7
1
0
4
0
2
ENT
ENT
1
0
Constant (K10)
5
3
F
R
6
4
0
0
ENT
4
Accumulator
0
DOUT (F60)
R404
5
0
R 405
5
0
0
0
Auxilliary Acc.
R 577 R 576
3
R 404
776
Dividend or divisor is zero
777
Divisor is zero
DL305 User Manual, Rev. D
0
ENT
ENT
11--41
Instruction Set
Math Instructions
Divide Example
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR (F50)
R 402
Load the value in registers
R402 and R403 into the
accumulator
DIV (F74)
K32
Divide the value in the
accumulator with the
constant value 32
DOUT (F60)
R412
R 403
R 402
0
2
0
5
5
­
0
0
9
STR
F
SHF
5
0
0
ENT
ENT
2
9
Accumulator
R
F
SHF
4
7
3
0
4
2
2
ENT
ENT
3
2
Constant (K32)
1
6
F
R
F
6
4
5
0
1
0
ENT
2
ENT
R
F
5
6
7
0
6
ENT
ENT
R
4
1
4
ENT
Accumulator
0
0
1
5
3
1
2
Auxilliary Acc.
R 577 R 576
6
R 413
R 412
5
1
Copy the value in the
accumulator to registers R412
and R413
DSTR (F50)
R 576
Load the value in registers
R576 and R577 into the
accumulator
DOUT (F60)
R414
3
2
Accumulator
5
3
R 415
1
2
R 414
Copy the value in the
accumulator to registers R414
and R415
DL305 User Manual, Rev. D
ENT
ENT
Instruction Set
The divide instruction allows you to divide the value in the accumulator by 4 digits
maximum. The divide instruction uses the accumulator for the integer value of the
result and the auxiliary accumulator (R576 and R577) for fraction. The instruction set
only allows manipulation on two consecutive registers at a time. For example, if the
result was a 4 digit number with a remainder it would have to be treated like two
4--digit numbers in the program. Manipulating numbers over 4 digits should be
avoided whenever possible. If it cannot be avoided the application program must be
written to compensate for the 4--digit maximum for data manipulation.
The example below shows how the auxiliary accumulator is used to store the
fractional portion of the result and how to access the remainder.
11--42
Instruction Set
Bit Operation Instructions
Instruction Set
Bit Operation Instructions
Shift Left
SHFL (F81)
The Shift Left (F81) is a 16--bit instruction
that shifts the value in the accumulator a
specified number of bits (15 maximum)
to the left. Discrete bit flags are used to
indicate if a “1” was shifted out of the
accumulator or if the accumulator equals
“0” after the shift.
Data Type
SHFL (F81)
K aaaa
D3--330 Range
D3--340 Range
D3--330P Range
aaaa
aaaa
aaaa
1--16
1--16
1--16
Constant (4--digit BCD)
K
Discrete Bit Flags
Description
775
Will be on if a“1” was shifted out of the accumulator.
776
Will be on if the accumulator equals zero after the shift instruction is executed.
In the following example, when input 000 is on the value in R000 and R010 is loaded
into the accumulator using the Data Store 5 (F55) instruction. The bit pattern in the
accumulator is shifted to the left 4 bit positions using the Shift Left (F81) instruction
with the result resides in the accumulator. The value in the accumulator is copied to
data registers R404 and R405 using the Data Out (F60) instruction.
DirectSOFT Display
000
R 010
R 000
6
3
9
Handheld Programmer Keystrokes
5
DSTR 5 (F55)
R0
Load the value in registers R0
and R10 into the accumulator
7
6
0
1
I/O Points 100--107
5 4 3 2 1 0
1
0
1
0
15 14 13 12 11 10 9
Acc.
1
0
0
1
S S
Shifted out of
accumulator
SHFL (F81)
K4
0
1
0
0
1
7
6
0
0
I/O Points 000--007
5 4 3 2 1 0
1
1
0
1
0
1
9
Copy the value in the
accumulator to registers R404
and R405
8
7
6 5
4 3
2
1
0
1
0
1
1
0
0
0
5
0
0
0
0
5
ENT
ENT
R
F
SHF
0
8
4
ENT
1
ENT
ENT
F
R
6
4
0
0
ENT
4
775 will be ON after the shift
776 will be OFF after the shift
3
R 405
R 404
775
Shifted a “1” out of Accumulator
776
Accumulator equals zero after shift
DL305 User Manual, Rev. D
SHF
5
S S
Shift the value in the
accumulator 4 bits to the left
DOUT (F60)
R 404
STR
F
ENT
11--43
Instruction Set
Bit Operation Instructions
The Shift Right (F80) is a 16--bit
instruction that shifts the value in the
accumulator a specified number of bits
(15 maximum) to the right. Discrete bit
flags are used to indicate if a “1” was
shifted out of the accumulator or if the
accumulator equals “0” after the shift.
Data Type
Instruction Set
Shift Right
SHFR (F80)
SHFR (F80)
Kaaaa
D3--330 Range
D3--340 Range
D3--330P Range
aaaa
aaaa
aaaa
1--16
1--16
1--16
Constant (4--digit BCD)
K
Discrete Bit Flags
Description
775
Will be on if a“1” was shifted out of the accumulator.
776
Will be on if the accumulator equals zero after the shift instruction is executed.
In the following example, when input 000 is on the value in R000 and R010 is loaded
into the accumulator using the Data Store 5 (F55) instruction. The bit pattern in the
accumulator is shifted 4 bit positions using the Shift Right (F80) instruction and the
result resides in the accumulator. The value in the accumulator is copied to data
registers R404 and R405 using the Data Out (F60) instruction.
DirectSOFT Display
R 10
000
4
DSTR 5 (F55)
R0
Load the value in registers R0
and R10 into the accumulator
3
7
7
I/O Points 000--007
6 5 4 3 2 1 0
0
1
0
0
0
0
1
0
0
15 14 13 12 11 10 9
Acc.
5
I/O Points 100--107
6 5 4 3 2 1 0
1
S S
SHFR (F80)
K4
Handheld Programmer Keystrokes
R0
9
0
0
0
0
0
1
0
1
S S
1
0
1
0
1
STR
F
SHF
5
0
5
ENT
ENT
R
F
SHF
0
8
4
ENT
0
ENT
ENT
F
R
6
4
0
0
ENT
4
Shifted out of
accumulator
8
7
6 5
4 3
2
1
0
0
1
0
1
0
1
1
9
3
0
0
775 will be ON after the shift
776 will be OFF after the shift
Shift the value in the
accumulator 4 bits to the right
0
DOUT (F60)
R 404
Copy the value in the
accumulator to registers R404
and R405
4
R 405
R 404
775
Shifted a “1” out of Accumulator
776
Accumulator equals zero after shift
DL305 User Manual, Rev. D
ENT
11--44
Instruction Set
Number Conversion Instructions
Instruction Set
Number Conversion Instructions
Encode
ENCOD (F83)
The Encode instruction encodes the
accumulator bit position that contains a 1
by returning the corresponding binary
representation. If the most significant bit
is set to HEX F (decimal 15), the binary
value 15 is returned to the accumulator. If
the accumulator value is 0000 or 0001 a
zero will be returned to the accumulator.
If there is more than one bit position set to
a “1” the least significant “1” will be
encoded. The discrete bit flag 777 is
used to indicate if there were multiple 1s
in the accumulator.
ENCOD (F83)
Discrete Bit Flags
Description
777
Will be on if there was more than one bit position set to a ”1” in the accumulator.
DL305 User Manual, Rev. D
11--45
Instruction Set
Number Conversion Instructions
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR 5 (F55)
R 005
R 015
R 005
0
4
0
0
Load the value in registers
R005 and R015 into the
accumulator
15 14 13 12 11 10 9
Acc.
0
0
0
0
0
0
0
8
7
6 5
4 3
2
1
0
0
0
1
0
0
0
0
0
0
STR
F
SHF
5
0
5
ENT
ENT
R
F
F
R
5
8
6
4
ENT
3
3
0
ENT
ENT
4
Bit position 6 converted to binary.
ENCOD (F83)
15 14 13 12 11 10 9
Acc.
0
0
0
0
0
0
0
8
7
6 5
4 3
2
1
0
0
0
0
0
1
1
0
0
0
Encode the bit position in the
accumulator set to “1” by
returning the corresponding
binary number
DOUT3 (F63)
R 404
Copy the lower four bits in the
accumulator to the lower four
bits of register R404.
0
6
R 404
DL305 User Manual, Rev. D
ENT
Instruction Set
In the following example, when input 000 is on the 16--bit binary pattern from
registers R005 and R015 is loaded in the accumulator by the Data Store 5 (F55)
instruction. In this example the 6th bit (BCD 40) is on. When the Encode (F83)
instruction executes the accumulator will contain the BCD value of 6. The lower four
bits of the accumulator are copied to the lower four bits of register R404 by the Data
Out 3 (F63) instruction.
Instruction Set
11--46
Instruction Set
Number Conversion Instructions
Decode
DECOD (F82)
The Decode instruction decodes a four
bit binary number (0--F) in the
accumulator and sets the corresponding
bit position to a one. If the accumulator
contains a HEX F (decimal 15) the most
significant bit (bit 15) will be set in the
accumulator. If the accumulator contains
a zero the least significant bit (bit 0) will
be set to a one. All other bits in the
accumulator will be set to a zero.
DECOD (F82)
In the following example, when 000 is on the binary value of the lower four bits in
R016 (5) will be loaded in the accumulator by the Data Store 3 (F53) instruction. The
Decode instruction will then translate the value 5 to a 1 in the fifth bit position of the
accumulator. The value 20 in the accumulator is copied to data registers R404 and
R405 with the Data Out (F60) instruction.
DirectSOFT Display
Handheld Programmer Keystrokes
000
R 016
DSTR3 (F53)
R 016
0
5
Load the lower four bits in
R016 into the accumulator
15 14 13 12 11 10 9
Acc.
0
0
0
0
0
0
0
8
7
6 5
4 3
2
1
0
0
0
0
0
1
0
1
0
0
Bit pattern equals 5 BCD
DECOD (F82)
15 14 13 12 11 10 9
Acc.
0
0
0
0
0
0
0
8
7
6 5
4 3
2
1
0
0
0
0
0
0
0
0
2
0
Decode the binary bit pattern
in the accumulator and set
the appropriate bit to a ”1”
DOUT (F60)
R 404
Copy the value in the
accumulator to registers R404
and R405
DL305 User Manual, Rev. D
0
0
R 405
R 404
1
0
STR
F
SHF
5
0
3
ENT
ENT
R
F
1
8
6
2
ENT
ENT
F
R
6
4
0
0
ENT
4
ENT
11--47
Instruction Set
Number Conversion Instructions
The Binary (F85) instruction converts a
BCD value in the accumulator to the
binary/HEX equivalent value. The result
of the conversion resides in the
accumulator.
BIN (F85)
In the following example, when input 000 is on the value (2571 BCD) in R600 is
loaded into the accumulator using the Data Store (F50) instruction. The value in the
accumulator is converted to a binary number (HEX 0A0B) using the Binary (F85)
instruction with the result residing in the accumulator. The value in the accumulator
is copied to I/O registers R000 and R010 (which corresponds to I/O points 0--7 and
100--107) with the Data Out 5 (F65) instruction.
DirectSOFT Display
Handheld Programmer Keystrokes
000
DSTR (F50)
R 600
Load the value in registers
600 and 601 into the
accumulator
BIN (F85)
1
STR
F
SHF
5
0
0
ENT
ENT
R
F
F
6
8
6
0
5
5
0
ENT
ENT
R
0
ENT
R601
R600
2
7
5
Accumulator value before
BIN instruction
2
5
7
1
Accumulator value after
BIN instruction
0
A
0
B
Hex.
Convert the BCD number in
the accumulator to a binary
number
I/O Points 100--107
DOUT5 (F65)
R 000
Output the value in the
accumulator to R000 and
R010
I/O Points 000--007
7
6
5
4
3
2
1
0
7
6
5
4
3
2
1
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
1
1
R010
R000
DL305 User Manual, Rev. D
ENT
Instruction Set
Binary
BIN (F85)
Instruction Set
11--48
Instruction Set
Number Conversion Instructions
Binary Coded
Decimal
BCD (F86)
The Binary Coded Decimal (F86)
instruction converts a binary/HEX value
in the accumulator to the BCD
equivalent. The result of the conversion
resides in the accumulator.
BCD (F86)
In the following example, when input 000 is on the value (HEX 0A0A) in R000 and
R010 is loaded into the accumulator with the Data Store 5 (F55) instruction. The
value in the accumulator is converted to a BCD number (BCD 2570) using the BCD
(F86) instruction with the result residing in the accumulator. The value in the
accumulator is output to register R600 using the Data Out (F60) instruction.
R 10
0
DirectSOFT Display
R0
A
0
A
Handheld Programmer Keystrokes
000
DSTR5 (F55)
R0
Load the value in
registers R000 and
R010 into the
accumulator
Accumulator
value before
BCD instruction
7
6
0
0
I/O Points 100--107
5 4 3 2 1 0
0
0
1
0
1
0
7
6
0
0
I/O Points 000--007
5 4 3 2 1 0
0
0
1
0
1
0
BCD (F86)
15 14 13 12 11 10 9
Convert the binary number
in the accumulator to a BCD
number
DOUT (F60)
R600
8
7
6 5
4 3
2
1
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
1
0
3
2
7
6
8
1
6
3
8
4
8
1
9
2
4
0
9
6
2
0
4
8
1
0
2
4
5
1
2
2
5
6
1 6
2 4
8
3
2
1 8
6
4
2
1
2
5
7
0
2
5
7
0
Copy the value in the
accumulator to R600 and
R601
Accumulator value after
BCD instruction
R601
DL305 User Manual, Rev. D
R600
STR
F
SHF
5
0
5
ENT
ENT
R
F
F
0
8
6
ENT
6
0
ENT
ENT
R
6
0
0
ENT
11--49
Instruction Set
Number Conversion Instructions
The Invert instruction generates the
one’s complement of the number in the
accumulator. The result is stored in the
accumulator.
INV (F84)
In the following example, when input 000 is on the value (AD63) in R000 and R010 is
loaded into the accumulator using the Data Store (F55) instruction. The value in the
accumulator is inverted with the result residing in the accumulator. The value (HEX
529C) is copied to registers R404 and R405 using the Data Out (F60) instruction.
R 10
DirectSOFT Display
A
000
R0
D
6
Handheld Programmer Keystrokes
3
DSTR5 (F55)
R0
Load the value in register
R000 and R010 into the
accumulator
INV (F84)
Invert the value in the
accumulator
DOUT (F60)
R 404
STR
F
SHF
5
0
5
ENT
ENT
0
8
6
ENT
4
0
ENT
ENT
4
0
4
7
6
5
4
3
2
1
0
7
6
5
4
3
2
1
0
R
F
F
1
0
1
0
1
1
0
1
0
1
1
0
0
0
1
1
R
1
0
1
0
1
1
0
1
0
1
1
0
0
0
1
1
Accumulator
0
0
Accumulator
I/O Points 100--107
I/O Points 000--007
Invert the value in the accumulator
0
1
0
1
0
5
2
R405
0
1
0
1
0
0
1
1
9
C
1
R404
Copy the value in the
accumulator to registers R404
and R405
DL305 User Manual, Rev. D
ENT
Instruction Set
Invert
INV (F84)
11--50
Instruction Set
Program Control Instructions
Instruction Set
Program Control Instructions
Master Control Set
(MCS)
DL330/DL340 Only
Master Control
Reset
(MCR)
DL330/DL340 only
Understanding
Master Control
Relays
The Master Control Set and Master
Control Reset instructions are used to
provide an additional left power rail which
is controllable by a input contact. This is
sometimes known as a sub power rail.
Any number of rungs of ladder logic can
be disabled using these instructions.
MCS
MCR
The Master Control Set (MCS) and Master Control Reset (MCR) instructions allow
you to quickly enable (or disable) sections of the RLL program. This provides
program control flexibility. The following example shows how the MCS and MCR
instructions operate by creating a sub power rail for control logic.
000
When contact 000 is on, logic under the first MCS
will be executed.
MCS
050
OUT
001
002
When contact 002 is on, logic under
the
second MCS will be executed.
MCS
003
MCR
010
DL305 User Manual, Rev. D
MCR
The MCR instructions note the end of the Master Control area. (They will be entered in
adjacent addresses.)
Instruction Set
Program Control Instructions
11--51
DirectSOFT Display
Handheld Programmer Keystrokes
000
MCS
001
A
160
OUT
002
161
OUT
165
20
OUT
010
C
MCS
003
170
OUT
004
171
OUT
D
STR
MCS
STR
OUT
STR
OUT
STR
OUT
STR
MCS
STR
OUT
STR
OUT
MCR
STR
OUT
STR
OUT
MCR
STR
OUT
SHF
ENT
SHF
SHF
SHF
SHF
SHF
SHF
SHF
ENT
SHF
SHF
SHF
SHF
ENT
SHF
SHF
SHF
SHF
ENT
SHF
SHF
0
ENT
1
1
2
1
1
2
1
ENT
6
ENT
6
6
0
0
ENT
ENT
3
1
4
1
ENT
7
0
ENT
ENT
7
1
ENT
5
1
6
2
ENT
7
2
ENT
ENT
1
ENT
7
2
ENT
2
ENT
0
ENT
1
5
ENT
ENT
MCR
005
172
OUT
006
21
OUT
B
MCR
007
22
OUT
NOTE: When programming the MCS instruction, do not put any parallel coils in the
rung with the MCS.
DL305 User Manual, Rev. D
Instruction Set
MCS/MCR Example In the following MCS/MCR example logic between the first MCS (A) and the last
MCR (B) will function only if input 000 is on. The logic between the second MCS (C)
and the next to last MCR (D) will function only if input 010 is on. The last rung is not
controlled by either of the MCS coils.
11--52
Instruction Set
Network Instructions
Instruction Set
Network Instructions
Read from Network The Read from Network instruction is used
RX (F952)
by the master device on a DirectNET
DL340 Only
network to read a block of data from
another CPU or DirectNET interface
module. The function parameters are
loaded into the accumulator and the first
and second level of the accumulator stack
by three additional instructions. Listed
below are the steps necessary to program
the Read from Network function.
RX (F952)
A aaa
Step 1: — Load the slave address (1--90 BCD) into the accumulator with the DSTR
instruction. This must always be preceded by 00, so address 20 would be 0020.
(Remember, D4--DCM slave device addresses are set with switches that use a
hexadecimal format. Make sure you convert this address to the decimal equivalent
for use with this instruction.)
Step 2: — Load the number of bytes (1 -- 128 BCD) to be transferred from the
network slave station.
Step 3: — Load the octal address for the data register that will be used to store the
data obtained from the slave station.
Step 4: — Insert the RX instruction which specifies the starting address in the slave
station. If you are getting the data from a DL305 station, just enter the Data Register
number. If you are getting the data from a DL205 or DL405 station, enter a constant
that corresponds to the memory address. For example, to get the current count for
Timer 600 from a DL305 CPU, you would use R600 with the RX instruction. If you
wanted to get Counter 0 from a DL405 CPU, you would use a constant of 1000 with
the RX instruction. (V1000 stores the current count for Counter 0 in a DL405 CPU.)
NOTE: The DirectNET manual provides further information on the use of the RX
and WX network instructions.
Data Type
D3--330 Range
D3--340 Range
A
aaaa
aaaa
D3--330P Range
aaaa
Inputs / Outputs
R
000--014
070--075
000--014
070--075
000--014
070--075
Control Relays
R
016--036
016--036
100--105
016, 020--027
Shift Registers
R
040--056
040--056
----
Stages
R
----
----
100--116
Timer /Counters (16 bit)
R
600--677
600--677
600--677
Data Registers
R
400--577
400--577
700--777
400--577
*Constant (4--digit BCD)
K
0000--9999
0000--9999
0000--9999
* A constant is used to obtain data from a DL205 or DL405 system.
Discrete Bit Flags
Description
777
Parameters are not properly set. Check the slave address, data length, or data
address reference.
1074
Communication port busy.
1075
Communication error. Data was not transmitted.
DL305 User Manual, Rev. D
Instruction Set
Network Instructions
11--53
In the following example, when input 001 is on and the CPU busy relay 1074 (see
special relays, p. 8--32) is not on, the RX instruction will access a DL405 CPU that
has been assigned station address 20. (Note, the D4--DCM slave station addresses
are set with switches that indicate a hexadecimal number. Make sure you determine
the decimal equivalent to be used with the first DSTR instruction in the sequence.)
Ten consecutive bytes of data (V1400 -- V1404) will be read from the slave station
and stored in registers R400 -- R411. (Remember, the DL205 and DL405 V-memory
locations are 16 bits. The DL305 registers are only 8 bits, so you have to use two data
registers for each V-memory location.)
DirectSOFT Display
001
1074
DSTR (F50)
K0020
The constant value K0020
specifies station address 20
(hex)
DL305
CPU
Slave
CPU
S
S
S
S
DSTR (F50)
K0010
The constant value K10
specifies the number of
bytes to be read
DSTR (F50)
K0400
Octal address 0400 is used
to designate R400 as the
starting point for the range of
registers that will hold the
data
RX (F952)
K1400
R401
R400
3
5
4
7
R403
R402
8
3
5
4
R405
R404
1
3
9
6
R407
R406
9
7
5
1
R411
R410
1
2
4
3
3
4
5
7
V1400
8
5
3
4
V1401
1
9
3
6
V1402
9
5
7
1
V1403
1
4
2
3
V1404
K1400 is used to represent
V1400, which is the starting
location in the for the Slave
CPU where the specified
data will be read from
Handheld Programmer Keystrokes
STR
AND
F
SHF
F
SHF
F
SHF
F
SHF
NOT
5
0
5
1
5
4
9
1
SHF
0
0
0
0
0
0
5
ENT
1
ENT
2
ENT
ENT
ENT
0
2
ENT
ENT
SHF
1
4
0
0
0
7
0
ENT
4
ENT
ENT
DL305 User Manual, Rev. D
Instruction Set
NOTE: See the DL205 or DL405 User’s Manuals for a listing of V-memory
addresses available with these CPUs. Since the DL305 only supports a 4-digit
constant, you will not be able to access the entire V-memory ranges of the DL205
and DL405 CPUs. For example, you could not directly access V40400 stored in a
DL405 CPU. If you require data from a range outside the area available with a 4-digit
constant (from V0 -- V9999) then add a routine to the slave station program that
moves this data down into one of the accessible areas.
Instruction Set
11--54
Instruction Set
Network Instructions
Write to Network
WX (F953)
DL340 Only
The Write to Network instruction is used by
the master device on a DirectNET
network to write a block of data to another
WX (F953)
station. The function parameters are
A aaa
loaded into the accumulator and the first
and second level of the accumulator stack
by three additional instructions. Listed
below are the steps necessary to program
the Write to Network function.
Step 1: — Load the slave address (1--90 BCD) into the accumulator with the DSTR
instruction. This must always be preceded by 00, so address 20 would be 0020.
(Remember, the D4--DCM slave device addresses are set with switches that use a
hexadecimal format. Make sure you convert this address to the decimal equivalent
for use with this instruction.)
Step 2: — Load the number of bytes (1 -- 128 BCD) to be transferred to the network
slave station.
Step 3: — Load the octal address for the data register that will be used to obtain the
data that will be sent to the slave station.
Step 4: — Insert the WX instruction which specifies the starting address in the slave
station. If you are sending data to a DL305 station, just enter the Data Register
number. If you are sending data to a DL205 or DL405 station, enter a constant that
corresponds to the memory address. For example, to send data to Register 500 in
a DL305 CPU, you would use R500 with the RX instruction. If you wanted to send
data to V1400 in a DL405 CPU, you would use a constant of 1400 with the WX
instruction.
NOTE: The DirectNET manual provides further information on the use of the RX
and WX network instructions.
Data Type
D3--330 Range
D3--340 Range
D3--330P Range
A
aaaa
aaaa
aaaa
Inputs / Outputs
R
000--014
070--075
000--014
070--075
000--014
070--075
Control Relays
R
016--036
016--036
100--105
016, 020--027
Shift Registers
R
040--056
040--056
----
Stages
R
----
----
100--116
Timer /Counters (16 bit)
R
600--677
600--677
600--677
400--577
0000--9999
Data Registers
R
400--577
400--577
700--777
*Constant (4--digit BCD)
K
0000--9999
0000--9999
* A constant is used to send data to a DL205 or DL405 system.
Discrete Bit Flags
Description
777
Parameters are not properly set. Check the slave address, data length, or data
address reference.
1074
Communication port busy.
1075
Communication error. Data was not transmitted.
DL305 User Manual, Rev. D
Instruction Set
Network Instructions
11--55
In the following example, when input 001 is on and the CPU busy relay 1074 (see
special relays, p. 8--32) is not on, the WX instruction will access a DL405 CPU that
has been assigned station address 20. (Note, the D4--DCM slave station addresses
are set with switches that indicate a hexadecimal number. Make sure you determine
the decimal equivalent to be used with the first DSTR instruction in the sequence.)
Ten consecutive bytes of data (R400 -- R411) will be sent from the DL340 and stored
in V-memory locations V1400 -- V1404. (Remember, the DL205 and DL405
V-memory locations are 16 bits. The DL305 registers are only 8 bits, so you have to
use two data registers for each V-memory location.)
DirectSOFT Display
001
1074
DSTR (F50)
K0020
The constant value K0020
specifies station address 20
(hex)
DL305
CPU
Slave
CPU
S
S
S
S
DSTR (F50)
K0010
The constant value K10
specifies the number of
bytes to be send
DSTR (F50)
K0400
Octal address 0400 is used
to designate R400 as the
starting point for the range of
registers that holds the data
in the DL340.
WX (F953)
K1400
R401
R400
3
5
4
7
R403
R402
8
3
5
4
R405
R404
1
3
9
6
R407
R406
9
7
5
1
R411
R410
1
2
4
3
3
4
5
7
V1400
8
5
3
4
V1401
1
9
3
6
V1402
9
5
7
1
V1403
1
4
2
3
V1404
K1400 is used to represent
V1400, which is the starting
location in the for the Slave
CPU where the specified
data will be stored.
Handheld Programmer Keystrokes
STR
AND
F
SHF
F
SHF
F
SHF
F
SHF
NOT
5
0
5
1
5
4
9
1
SHF
0
0
0
0
0
0
5
ENT
1
ENT
2
ENT
ENT
ENT
0
7
0
ENT
0
3
ENT
ENT
SHF
1
4
0
0
4
ENT
ENT
DL305 User Manual, Rev. D
Instruction Set
NOTE: See the DL205 or DL405 User’s Manuals for a listing of V-memory
addresses available with these CPUs. Since the DL305 only supports a 4-digit
constant, you will not be able to access the entire V-memory ranges of the DL205
and DL405 CPUs. For example, you could not directly access V40400 stored in a
DL405 CPU. If you want to send data to a range outside the area available with a
4-digit constant (from V0 -- V9999) then add a routine to the slave station program
that moves the data from one of the accessible areas into the unavailable locations.
11--56
Instruction Set
Message Instructions
Instruction Set
Message Instructions
Fault
FAULT (F20)
The Fault (F20) instruction is used to
display a 4--digit BCD constant, 16--bit
register, or two consecutive 8--bit data
registers on the handheld programmer or
in DirectSOFT. When the fault
instruction is executed the number being
displayed will also be copied into the
registers R574 and R575 and the
discrete bit flag 771 will be on.
FAULT (F20)
In the following example, when input 000 is on the number 0206 will be displayed on
the programming device. This would typically be a user defined error code.
Data Type
D3--330 Range
D3--340 Range
D3--330P Range
A
aaaa
aaaa
aaaa
Inputs / Outputs
R
000--014
070--075
000--014
070--075
000--014
070--075
Control Relays
R
016--036
016--036
100--105
016, 020--27
Shift Registers
R
040--056
040--56
----
Stages
R
----
----
100--116
Timer /Counters (16 bit)
R
600--677
600--677
600--677
400--577
0000--9999
Data Registers
R
400--577
400--577
700--777
Constant (4--digit BCD)
K
0000--9999
0000--9999
DirectSOFT Display
Handheld Programmer Display
000
FAULT (F20)
K 0206
0206
ADDRESS/DATA
ON/OFF
RUN BATT
PWR CPU
DL305 User Manual, Rev. D
0
AND
1
OR
2
STR
3
NOT
4
OUT
5
TMR
6
CNT
7
SR
0
MCS
1
MCR
2
SET
3
RST
Handheld Programmer Keystrokes
4
ADR
5
SHF
6
DATA
7
REG
STR
F
SHF
2
0
0
ENT
ENT
SHF
2
0
6
ENT
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement