The text of a manual · part 29 of 60
DL205 PLC User Manual, Volume 1 of 2, pages 281 to 290
Pages 281 to 290 of 598
The original document is the PDF (12 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 D2-04TD1, AutomationDirect D2-08TD2, AutomationDirect D2-16ND3-2, AutomationDirect D2-32ND3, Konnect-It D2-04TD1, Koyo D2-04TD1, Konnect-It D2-08TD2, Koyo D2-08TD2, and 5 more models
Page 281
Chapter 5: Standard RLL Instructions
Using Pointers
1 2 NOTE: In the DL205, V-memory addressing is in octal. However the value in the pointer location which will 3 reference a V-memory location is viewed as HEX. Use the Load Address instruction to move an address into the pointer location. This instruction performs the Octal to Hexadecimal conversion for you. 4 The following example uses a pointer operand in a Load instruction. V-memory location 3000 is the pointer location. V3000 contains the value 400, which is the HEX equivalent of 5 the Octal address V-memory location V2000. The CPU copies the data from V2000 into the lower word of the accumulator. 6 7 8 9 10 The following example is similar to the one above, except for the LDA (load address) instruction, which automatically converts the Octal address to the Hex equivalent. 11 12 13 14 A B C D Many of the DL205 series instructions will allow V-memory pointers as an operand. Pointers can be useful in ladder logic programming, but can be difficult to understand or implement in your application if you do not have prior experience with pointers (commonly known as indirect addressing). Pointers allow instructions to obtain data from V-memory locations referenced by the pointer value.
X1
LD
P3000
V3000 (P3000) contains the value 400 Hex. 400 Hex. = 2000 Octal which contains the value 2635.
V3000
0
4
0
0
V2000
2
6
3
5
V2001
X
X
X
X
V2002
X
X
X
X
V2003
X
X
X
X
V2004
X
X
X
X
V2005
X
X
X
X
Accumulator 2
6
3
5
OUT
V3100
Copy the data from the lower 16 bits of the accumulator to V3100.
X1
LDA
O 2000
OUT
V 3000
LD
P 3000
Load the lower 16 bits of the accumulator with Hexadecimal equivalent to Octal 2000 (400))
V3100
2
6
3
5
V3101
X
X
X
X
0
0
2
0
2000 Octal is converted to Hexadecimal 400 and loaded into the accumulator
Unused accumulator bits are set to zero
Copy the data from the lower 16 bits of the accumulator to V3000
Acc. 0
0
0
0
V3000 (P3000) contains the value 400 HEX = 2000 Octal which contains the value 2635
0
4
0
0
0
4
0
0
V3000
OUT
V 3100
Copy the data from the lower 16 bits of the accumulator to V3100
V3000
0
4
0
0
V2000
2
6
3
5
V2001
X
X
X
X
V2002
X
X
X
X
V2003
X
X
X
X
V2004
X
X
X
X
V2005
X
X
X
X
V3100
2
6
3
5
V3101
X
X
X
X
Accumulator
0
0
0
0
DL205 User Manual, 4th Edition, Rev. D
2
6
3
5
5-57
Page 282
Chapter 5: Standard RLL Instructions
Load (LD)
Load instruction is a 16-bit instruction that loads the value 1 The LD (Aaaa), which is either a V-memory location or a 4-digit constant,
A aaa the lower 16 bits of the accumulator. The upper 16 bits of 2 into the accumulator are set to 0.
3 Operand Data DL230 Range DL240 Range DL250-1 Range DL260 Range Type A aaa aaa aaa aaa bbb 4 5 6 Discrete Bit Flags Description SP76 7 NOTE: Two consecutive Load instructions will place the value of the first Load instruction onto the 8 accumulator stack. In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator 9 and output to V2010. 10 11 12 13 14 A B C D 230 240
250-1 260
V-memory
V
All. See Memory map
Pointer
P
–
Constant
K
0-FFFF
All. See Memory map All V-memory See Memory map 0-FFFF
All See Memory map All V-memory See Memory map 0-FFFF
All See Memory map All V-memory See Memory map 0-FFFF
On when the value loaded into the accumulator by any instruction is zero.
DS Used HPP Used
DirectSOFT X1
V2000
LD
8
V2000
9
3
5
The unused accumulator bits are set to zero
Load the value in V2000 into the lower 16 bits of the accumulator
Acc. 0
0
0
0
88 99 33 55
OUT
V2010
8
Copy the value in the lower 16 bits of the accumulator to V2010
SHFT
L ANDST
D
C
A
A
2
GX OUT
5-58
B
STR
0
1
ENT
3 0
SHFT
A
0
V AND
ENT
C
2
A
3
V2010
Handheld Programmer Keystrokes $
9
0
B
1
DL205 User Manual, 4th Edition, Rev. D
A
0
ENT
5
Page 283
Chapter 5: Standard RLL Instructions
Load Double (LDD)
1 2 3 Operand Data DL230 Range DL240 Range DL250-1 Range DL260 Range Type A aaa aaa aaa aaa bbb 4 5 6 Discrete Bit Flags Description SP76 7 NOTE: Two consecutive Load instructions will place the value of the first load instruction onto the 8 accumulator stack. In the following example, when X1 is on, the 32-bit value in V2000 and V2001 will be loaded 9 into the accumulator and output to V2010 and V2011. 10 11 12 13 14 A B C D 230 240 250-1 260
The Load Double instruction is a 32-bit instruction that loads the value (Aaaa), which is either two consecutive V-memory locations or an 8-digit constant value, into the accumulator.
V-memory
V
All. See Memory map
Pointer
P
–
Constant
K
0-FFFFFFFF
All. See Memory map All V-memory See Memory map 0-FFFFFFFF
LDD
A aaa
All See Memory map All V-memory See Memory map 0-FFFFFFFF
All See Memory map All V-memory See Memory map 0-FFFFFFFF
On when the value loaded into the accumulator by any instruction is zero.
DS Used HPP Used
DirectSOFT X1
V2001
LDD
V2000
Load the value in V2000 and V2001 into the 32 bit accumulator
OUTD
7 ?
3
9
5
Acc. 6
7
3
9
2 66 65 00 2?
6
7
3
9
5
V2011
V2010
V2000
6
0
0
2
2
6
6
V2010
Copy the value in the 32 bit accumulator to V2010 and V2011
Handheld Programmer Keystrokes $
B
STR
SHFT
L ANDST
D
C
A
A
2
0
GX OUT
SHFT
D
C
A
B
2
0
1
3 0
ENT
D A
3
0
ENT
3
1
A
0
ENT
DL205 User Manual, 4th Edition, Rev. D
5-59
Page 284
Chapter 5: Standard RLL Instructions
1
2
3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Load Formatted (LDF) The Load Formatted instruction loads 1 to 32 consecutive bits from discrete memory locations into the accumulator. The instruction requires a starting location (Aaaa) and the number of bits (Kbbb) to be loaded. Unused accumulator bit locations are set to zero.
230 240 250-1 260
Operand Data Type
DL240 Range A
Inputs Outputs Control Relays Stage bits Timer bits Counter bits Special Relays Global I/O Constant aaa
X 0–477 Y 0–477 C 0–377 S 0–777 T 0–177 CT 0–177 SP 0-137, 540-617 GX/GY – K –
A aaa K bbb
DL250-1 Range
DL260 Range bbb aaa bbb aaa bbb
– – – – – – – – 1–32
0–777 0–777 0–1777 0–1777 0–377 0–177 0–777 – –
– – – – – – – – 1–32
0–1777 0–1777 0–3777 0–1777 0–377 0–377 0–777 0–3777 –
– – – – – – – – 1–32
Discrete Bit Flags SP76
LDF
Description On when the value loaded into the accumulator by any instruction is zero.
NOTE: Two consecutive Load instructions will place the value of the first Load instruction onto the accumulator stack.
In the following example, when C0 is on, the binary pattern of C10–C16 (7 bits) will be loaded into the accumulator using the Load Formatted instruction. The lower 7 bits of the accumulator are output to Y0–Y6 using the Out Formatted instruction.
DS Used HPP Used DirectSOFT C0
LDF
C10 K7
Load the status of 7 consecutive bits (C10–C16) into the accumulator
C16 C15 C14 C13 C12 C11 C10 OFF OFF OFF ON ON ON OFF
8
7
6 5
4 3
2
1
0
0
0
0
0
0
0
1
1
0
Y4 ?
Y3 ?
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
Y0 K7
Copy the value from the specified number of bits in the accumulator to Y0 – Y6
SHFT
C
SHFT
L ANDST
D
F
SHFT
C
B
STR
GX OUT A
5-60
K7
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9
Handheld Programmer Keystrokes $
Constant
The unused accumulator bits are set to zero
Acc.
OUTF
Location C10
0
2
SHFT
F H
3 1
A
2
A
0
ENT
5 0
H
7
ENT
5 7
ENT
DL205 User Manual, 4th Edition, Rev. D
Location
Constant
Y6 Y5 ?
Y0
K7
OFF OFF OFF ON ON ON OFF
? Y2 Y1 ?
Y0
Page 285
Chapter 5: Standard RLL Instructions
Load Address (LDA)
1 2 3 Operand Data DL230 Range DL240 Range DL250-1 Range DL260 Range Type 4 aaa aaa aaa aaa 5 Discrete Bit Flags Description 6 SP76 7 NOTE: Two consecutive Load instructions will place the value of the first Load instruction onto the accumulator stack. 8 In the following example, when X1 is on, the octal number 40400 will be converted to a HEX 4100 and loaded into the accumulator using the Load Address instruction. The value in the 9 lower 16 bits of the accumulator is copied to V2000 using the Out instruction. 10 11 12 13 14 A B C D
Load Address instruction is a 16-bit instruction. It 230 The converts any octal value or address to the HEX equivalent 240 value and loads the HEX value into the accumulator. This 250-1 instruction is useful when an address parameter is required 260 since all addresses for the DL205 system are in octal.
Octal Address
All V-memory See Memory map
O
LDA
O aaa
All V-memory See Memory map
All V-memory See Memory map
All V-memory See Memory map
On when the value loaded into the accumulator by any instruction is zero.
DS Used HPP Used
DirectSOFT X1
Octal
LDA
4
O 40400
0
Load The HEX equivalent to the octal number into the lower 16 bits of the accumulator
4
Hexadecimal
0
0
4
1
0
0
4
1
0
0
4
1
0
0
The unused accumulator bits are set to zero Acc. 0
OUT
0
0
0
V2000
V2000
Copy the value in lower 16 bits of the accumulator to V2000
Handheld Programmer Keystrokes $
B
STR
SHFT
L ANDST
D
E
A
E
4
GX OUT
0
1
3 4
SHFT
ENT
A A
0 0
V AND
A
C
0 2
ENT
A
0
A
0
A
0
ENT
DL205 User Manual, 4th Edition, Rev. D
5-61
Page 286
Chapter 5: Standard RLL Instructions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Load Accumulator Indexed (LDX) Accumulator Indexed is a 16-bit instruction that specifies 230 Load a source address (V-memory) which will be offset by the value in 240 the first stack location. This instruction interprets the value in 250-1 the first stack location as HEX. The value in the offset address 260 (source address + offset) is loaded into the lower 16 bits of the DS Used HPP Used
5-62
LDX A aaa accumulator. The upper 16 bits of the accumulator are set to 0. Helpful hint:, The Load Address instruction can be used to convert an octal address to a HEX address and load the value into the accumulator. Operand Data Type
DL250-1 Range
DL260 Range
A aaa aaa
V-memory
V
Pointer
P
All. See memory map All V-memory. See memory map
All. See memory map All V-memory. See memory map
NOTE: Two consecutive Load instructions will place the value of the first load instruction onto the accumulator stack.
In the following example, when X1 is on, the HEX equivalent for octal 25 will be loaded into the accumulator (this value will be placed on the stack when the Load Accumulator Indexed instruction is executed). V-memory location V1410 will be added to the value in the first level of the stack and the value in this location (V1435 = 2345) is loaded into the lower 16 bits of the accumulator using the Load Accumulator Indexed instruction. The value in the lower 16 bits of the accumulator is output to V1500 using the Out instruction.
X1
LDA O 25 Load The HEX equivalent to octal 25 into the lower 16 bits of the accumulator
Octal
Hexadecimal
2
0
0
1
5
0
0
1
5
V 1
4
5
The unused accumulator bits are set to zero Acc. 0
0
0
0
LDX V1410 Move the offset to the stack. Load the accumulator with the address to be offset
HEX Value in 1st stack location
Octal V 1
4
1
0
+
1
5
Accumulator Stack
Octal
=
3
5
The unused accumulator bits are set to zero
OUT V1500 Copy the value in the lower 16 bits of the accumulator to V1500
Acc. 0
0
0
0
2
3
4
The value in V1435 is 2345 2
3
4
V1500
DL205 User Manual, 4th Edition, Rev. D
5
5
Level 1
0
0
0
0
0
0
1
5
Level 2
X
X
X
X X
X
X
X
Level 3
X
X
X
X X
X
X
X
Level 4
X
X
X
X X
X
X
X
Level 5
X
X
X
X X
X
X
X
Level 6
X
X
X
X X
X
X
X
Level 7
X
X
X
X X
X
X
X
Level 8
X
X
X
X X
X
X
X
Page 287
Chapter 5: Standard RLL Instructions
Load Accumulator Indexed from Data Constants (LDSX)
240 250-1 260 230
DS Used HPP Used
1 2 3 4 5 Operand Data Type DL240 Range DL250-1 Range DL260 Range aaa aaa aaa 6 7 NOTE: Two consecutive Load instructions will place the value of the first load instruction onto the accumulator stack. 8 In the following example, when X1 is on, the offset of 1 is loaded into the accumulator. This value will be placed into the first level of the accumulator stack when the LDSX instruction 9 is executed. The LDSX instruction specifies the Data Label (DLBL K2) where the numerical constant(s) are located in the program and loads the constant value, indicated by the offset in 10 the stack, into the lower 16 bits of the accumulator. 11 12 13 14 A B C D The Load Accumulator Indexed from Data Constants is a 16-bit instruction. The instruction specifies a Data Label LDSX Area (DLBL) where numerical or ASCII constants are stored. K aaa This value will be loaded into the lower 16 bits. The LDSX instruction uses the value in the first level of the accumulator stack as an offset to determine which numerical or ASCII constant within the Data Label Area will be loaded into the accumulator. The LDSX instruction interprets the value in the first level of the accumulator stack as a HEX value. Helpful hint:, The Load Address instruction can be used to convert octal to HEX and load the value into the accumulator.
Constant
K
X1
1-FFFF
1-FFFF
Hexadecimal
LD
0
K1
Load the offset value of 1 (K1) into the lower 16 bits of the accumulator.
0
0
1
0
0
1
Acc. 0
0
0
0
Accumulator Stack
0
K2
Constant
Move the offset to the stack. Load the accumulator with the data label number OUT
Copy the value in the lower 16 bits of the accumulator to V2000
0
K
0
0
2
The unused accumulator bits are set to zero Acc. 0
V2000
Value in 1st. level of stack is used as offset. The value is 1
The unused accumulator bits are set to zero
LDSX
0
0
0
0
0
0
2
Level 1
0
0
0
0
0
0
0
1
Level 2
X
X
X
X X
X
X
X
Level 3
X
X
X
X X
X
X
X
Level 4
X
X
X
X X
X
X
X
Level 5
X
X
X
X X
X
X
X
Level 6
X
X
X
X X
X
X
X
Level 7
X
X
X
X X
X
X
X
Level 8
X
X
X
X X
X
X
X
The unused accumulator bits are set to zero
END
DLBL
1-FFFF
Acc. 0
0
0
0
2
3
2
3
2
3
2
3
K2
NCON
K3333
NCON
K2323
NCON
K4549
Offset 0
V2000
Offset 1
Offset 2
DL205 User Manual, 4th Edition, Rev. D
5-63
Page 288
Chapter 5: Standard RLL Instructions $
B
STR
1
Handheld Programmer Keystrokes
ENT
1 2 3 4 5 6 Load Real Number (LDR) The Load Real Number instruction loads a real number contained in two consecutive V-memory locations, or an 7
8-digit constant into the accumulator.
8 Operand Data Type DL250-1 Range DL260 Range A aaa aaa 9 10 DirectSOFT allows you to enter real numbers directly, 11 by using the leading “R” to indicate a real number entry. You can enter a constant such as Pi, shown in the example to the right. To enter negative numbers, 12 use a minus (–) after the “R”. For very large numbers or very small numbers, you can 13 use exponential notation. The number to the right is 5.3 million. The OUTD instruction stores it in V1400 14 and V1401. These real numbers are in the IEEE 32-bit floating point format, so they occupy two V-memory A locations, regardless of how big or small the number may be! If you view a stored real number in hex, binary, or even BCD, the number shown will be very difficult to decipher. Just like all other number types, you must keep track of real number locations in memory, so they can be B read with the proper instructions later. The previous example above stored a real number in V1400 C and V1401. Suppose that now we want to retrieve that number. Just use the Load Real with the V data type, as D shown to the right. Next we could perform real math on it, SHFT
L ANDST
D
SHFT
L ANDST
D
SHFT
3
S RST
X SET
SHFT
V AND
C
4
N TMR
D
3
L ANDST
B
GX OUT
SHFT
E
SHFT
D
SHFT
N TMR
C
SHFT
N TMR
C
SHFT
N TMR
C
3
3
2
K JMP
B
C
A
0
A
1
2 0
ENT ENT
A
0
ENT
ENT
1
L ANDST
C
2
O INST#
N TMR
D
2
O INST#
N TMR
C
2
O INST#
N TMR
E
2 3 2 4
ENT
D D F
3
3
5
D C E
3
2
4
D D J
3
3
9
ENT ENT ENT
LDR
230
A aaa
240
250-1 260
DS Used HPP N/A
V-memory Pointer
Real Constants
V All. See memory map All. See memory map P All V-memory. See memory map All V-memory. See memory map -3.402823E+038 to -3.402823E+038 to R +3.402823E+038 +3.402823E+038 LDR
R3.14159
LDR
R5.3E6
OUTD V1400
LDR
V1400 or convert it to a binary number.
5-64
DL205 User Manual, 4th Edition, Rev. D
Page 289
Chapter 5: Standard RLL Instructions
Out (OUT)
1 2 Operand Data Type DL230 Range DL240 Range DL250-1 Range DL260 Range 3 A aaa aaa aaa aaa 4 5 Discrete Bit Flags Description 6 SP76 In the following example, when X1 is on, the value in V2000 will be loaded into the lower 7 16 bits of the accumulator using the Load instruction. The value in the lower 16 bits of the accumulator are copied to V2010 using the Out instruction. 8 9 10 11 12 13 14 A B C D
Out instruction is a 16-bit instruction that copies the 230 The value in the lower 16 bits of the accumulator to a specified 240
V-memory location (Aaaa). 250-1 260
V-memory
V
All. See memory map
Pointer
P
-
OUT
A aaa
All. See All. See memory map memory map All V-memory. All V-memory. See memory map See memory map
All. See memory map All V-memory. See memory map
On when the value loaded into the accumulator by any instruction is zero.
DS Used HPP Used
DirectSOFT X1
V2000
LD
8
V2000
Load the value in V2000 into the lower 16 bits of the accumulator
9
3
5
The unused accumulator bits are set to zero Acc. 0
0
0
0
88 99 33 55
OUT
V2010
Copy the value in the lower 16 bits of the accumulator to V2010
8
9
3
5
V2010
Handheld Programmer Keystrokes $
B
STR
SHFT
L ANDST
D
C
A
A
2
GX OUT
0
1
ENT
3 0
SHFT
A
0
V AND
ENT
C
2
A
0
B
1
A
0
ENT
DL205 User Manual, 4th Edition, Rev. D
5-65
Page 290
Chapter 5: Standard RLL Instructions
1
2
3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Out Double (OUTD) 230 240 250-1
The Out Double instruction is a 32-bit instruction that copies the value in the accumulator to two consecutive V-memory locations at a specified starting location (Aaaa).
OUTD A aaa
260
Operand Data Type
DL230 Range
DL240 Range DL250-1 Range DL260 Range
A aaa aaa
V-memory
V
All. See memory map
Pointer
P
-
All. See memory map All V-memory. See memory map aaa aaa
All. See All. See memory map memory map All V-memory. All V-memory. See memory map See memory map
In the following example, when X1 is on, the 32-bit value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in the accumulator is Used output to V2010 and V2011 using the Out Double instruction.
DS HPP Used
V2001
DirectSOFT
5-66
X1
6 LDD
7 ?
3
Handheld Programmer Keystrokes
V2000 9
5
0
2
6
V2000 Load the value in V2000 and V2001 into the accumulator
Acc. 6
7
3
9
55 00 2? 2 66
OUTD V2010 Copy the value in the accumulator to V2010 and V2011
6
7
3
9
5
V2011
DL205 User Manual, 4th Edition, Rev. D
0
2
V2010
6
$
B
STR
SHFT
L ANDST
D
C
A
A
2
0
GX OUT
SHFT
D
C
A
B
2
0
1 3 0
ENT D A
3 0
ENT
3 1
A
0
ENT