The text of a manual · part 32 of 42
DL305 User Manual: Chapter 11: Instruction Set, pages 262 to 271
Pages 262 to 271 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 262
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
Page 263
11--22
Instruction Set Timer, Counter, and Shift Register Instructions
Instruction Set
Timer, Counter, and Shift Register Instructions Timer (TMR) DL330/DL340 Only
See Errata Sheet on the first two pages. The counters and timers both time in Decimal and not in BCD. Presets for both are also interpreted as decimal data and not as BCD.
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
Page 264
11--23
Instruction Set Timer, Counter, and Shift Register Instructions
See Errata Sheet on the first two pages. The counters and timers both time in Decimal and not in BCD. Presets for both are also interpreted as decimal data and not as BCD.
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
Page 265
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
Page 266
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
R 403
R 402
Handheld Programmer Keystrokes
7
0
2
STR F
SHF 5
0 0
ENT ENT
2
Accumulator
0
2
R F R
4 6 4
0 0 0
2 ENT 4
5 7
DOUT (F60) R 404 7
5
0
5
R405
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
Page 267
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
Page 268
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
Page 269
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
Page 270
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
Page 271
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
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
F R
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