The text of a manual · part 31 of 61
DL205 PLC User Manual, Volume 1 of 2: Chapter 5: RLL and Intelligent Box Instructions, pages 283 to 292
Pages 283 to 292 of 592, from DL205 PLC User Manual, Volume 1 of 2
The original document is the PDF (13 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 PLC Direct D2-08ND3 and Koyo D2-08ND3
Page 283
Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data
Load Address (LDA)
1 2 addresses for the DL205 system are in octal. 3 Operand Data 4 DL230 Range DL240 Range DL250-1 Range DL260 Range Type aaa aaa aaa aaa 5 6 Discrete Bit Flags Description 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 230 The instruction. It converts any octal value or address to 240 the HEX equivalent value and loads the HEX value 250-1 into the accumulator. This instruction is useful 260 when an address parameter is required since all
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
1
STR
SHFT
L ANDST
D
E
A
E
4
GX OUT
0
ENT
A
3
0
A
A
4
0
SHFT
V AND
0
C
ENT
A 2
A 0
A 0
0
ENT
DL205 User Manual, 4th Edition, Rev. A
5–61
Page 284
Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data
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 240 in the first stack location. This instruction interprets the value 250-1 in the first stack location as HEX. The value in the offset 260 address (source address + offset) is loaded into the lower 16 DS Used HPP Used
5–62
LDX A aaa bits of the 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 1st. 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. A
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 285
Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data
Load Accumulator Indexed from Data Constants (LDSX)
230 240 250-1 260 DS Used HPP Used
1 2 3 4 5 Operand Data Type DL240 Range DL250-1 Range DL260 Range 6 aaa aaa aaa 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 9 value will be placed into the first level of the accumulator stack when the LDSX instruction 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 LDSX
The Load Accumulator Indexed from Data Constants is a K aaa 16-bit instruction. The instruction specifies a Data Label Area (DLBL) where numerical or ASCII constants are stored. 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
1-FFFF
1-FFFF
1-FFFF
Hexadecimal
X1
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
LDSX
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
0
2
The unused accumulator bits are set to zero 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
0
K
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
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. A
5–63
Page 286
Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data $
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 7 contained in two consecutive V-memory locations, or an 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 12 the example to the right. To enter negative numbers, use a minus (–) after the “R”. 13 For very large numbers or very small numbers, you can 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 VA memory 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. B Just like all other number types, you must keep track of real number locations in memory, so they can be 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
N TMR
D
4
B
3
L ANDST
GX OUT
3
SHFT
E
SHFT
D
SHFT
N TMR
C
SHFT
N TMR
C
SHFT
N TMR
C
3
K JMP
B
1
C
2
A
2
A
0
ENT ENT
A
0
0
ENT
ENT
C
1
L ANDST
O INST#
N TMR
D
2
O INST#
N TMR
C
2
O INST#
N TMR
E
2
2
ENT
D
D
3
3
D
2
C
D
E
5
3
2
3
F
4
D
3
3
J
4
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. A
Page 287
Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data
Out (OUT)
1 2 3 Operand Data Type DL230 Range DL240 Range DL250-1 Range DL260 Range 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 16 7 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 230 The the value in the lower 16 bits of the accumulator to a 240 specified V-memory location (Aaaa). 250-1 260
V-memory
V
All. See memory map
Pointer
P
-
OUT
A aaa
All. See memory map All V-memory. See memory map
All. See All. See memory map memory map All V-memory. All V-memory. See memory map 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
1
SHFT
L ANDST
D
C
A
A
2
GX OUT
0
ENT
3
A
0
0
SHFT
V AND
ENT
C
A
2
B
0
A
1
0
ENT
DL205 User Manual, 4th Edition, Rev. A
5–65
Page 288
Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data
1
2
3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Out Double (OUTD) 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).
230 240 250-1 260
Operand Data Type
DL230 Range
OUTD A aaa
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 output to V2010 and V2011 using the Out Double instruction.
DS Used HPP Used DirectSOFT
5–66
V2001 6
X1
LDD
7 ?
3
Handheld Programmer Keystrokes
V2000 9
5
0
2
6
$
B 1
STR 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
V2011
DL205 User Manual, 4th Edition, Rev. A
5
0
2
V2010
6
SHFT
L ANDST
D
C
A
A 0
GX OUT
SHFT
D
C
A
B 0
3
3
2
2
ENT D A
0
0
ENT
3 A 1
0
ENT
Page 289
Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data
Out Formatted (OUTF) Out Formatted instruction outputs 1 to 32 bits 230 The from the accumulator to the specified discrete memory 240 locations. The instruction requires a starting location 250-1 (Aaaa) for the destination and the number of bits 260 (Kbbb) to be output. DS Used HPP Used
Operand Data Type
DL240 Range
A V-memory
Pointer Constant aaa
OUTF A aaa K bbb
DL250-1 Range bbb aaa
DL260 Range bbb aaa bbb
All. See V Memory map
All See Memory map
All See Memory map
All Vmemory P See Memory map K
All Vmemory See Memory map
All Vmemory See Memory map
1-32
1-32
1-32
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 Y20–Y26 using the Out Formatted instruction. DirectSOFT C0
LDF
C10 K7
Load the status of 7 consecutive bits (C10–C16) into the accumulator
OUTF
Location
Constant
C10
K7
C16 C15 C14 C13 C12 C11 C10 OFF OFF OFF ON ON ON OFF
The unused accumulator bits are set to zero
Y20
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9
8
7
6 5
4 3
2
1
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
Accumulator
K7 Copy the value of the specified number of bits from the accumulator to Y20–Y26
Location
Constant
Y26 Y25 Y24 Y23 Y22 Y21 Y20
Y20
K7
OFF OFF OFF ON ON ON OFF
Handheld Programmer Keystrokes $ STR
SHFT
C F
SHFT
L ANDST
D
SHFT
C
B
GX OUT
SHFT
C
A 2
3
ENT
5 H 0
7
ENT
F 5 H
0
0
A 1
2
A 2
7
1
ENT
DL205 User Manual, 4th Edition, Rev. A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
5–67
Page 290
Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data
1 2
3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Out Indexed (OUTX) 230 240 250-1 260
The Out Indexed instruction is a 16-bit instruction. It copies a 16-bit or 4-digit value from the first level of the accumulator stack to a source address offset by the value in the accumulator(V-memory + offset).This instruction interprets the offset value as a HEX number. The upper 16 bits of the accumulator are set to zero.
DS Used HPP Used
Operand Data Type
O UT X A aaa
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
In the following example, when X1 is on, the constant value 3544 is loaded into the accumulator. This is the value that will be output to the specified offset V-memory location (V1525). The value 3544 will be placed onto the stack when the Load Address instruction is executed. Remember, two consecutive Load instructions places the value of the first load instruction onto the stack. The Load Address instruction converts octal 25 to HEX 15 and places the value in the accumulator. The Out Indexed instruction outputs the value 3544 which resides in the first level of the accumulator stack to V1525.
DirectSOFT
5–68
Constant
X1
LD
3
5
4
4
5
4
4
K3544 The unused accumulator bits are set to zero.
Load the accumulator with the value 3544.
0
Acc.
0
0
0
3
Octal
LDA
2
O25 Load the HEX equivalent to octal 25 into the lower 16 bits of the accumulator. This is the offset for the Out Indexed instruction, which determines the final destinaltion address.
HEX 5
0
0
1
5
1
5
The unused accumulator bits are set to zero. Acc.
0
0
+ 2
V
V1500
1
5
0
0
0
0
=
V 1
5
2
5
3
5
4
4
Octal
Octal OUTX
0
0
5
Octal Accumulator Stack
The hex 15 converts to 25 octal, which is added to the base address of V1500 to yield the final destination.
Copy the value in the first level of the stack to the offset address V1525 (V1500+25).
V1525
Handheld Programmer Keystrokes $
B 1
STR SHFT
L ANDST
D
SHFT
L ANDST
D
GX OUT
SHFT
X SET
ENT PREV
3 A 3
D
F 3
5 F
C
5
2
0 B
F 1
E
A 5
E 4
ENT A
0
DL205 User Manual, 4th Edition, Rev. A
4
0
ENT
ENT
Level 1
0
0
0
0
3
5
4
4
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 291
Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data
Out Least (OUTL)
1 2 3 4 A aaa 5 6 7 8 9 Out Most (OUTM) The Out Most instruction copies the value in the upper eight 10 O UT M bits of the lower sixteen bits of the accumulator to the upper
A aaa eight bits of the specified V-memory location (i.e., it copies the
11 high byte of the low word of the accumulator).
Operand Data Type DL260 Range 12 aaa 13 In the following example, when X1 is on, the value in V1400 will be loaded into the lower 16 bits of the accumulator using the Load instruction. The value in the upper 8 bits of the lower 14 16 bits of the accumulator are copied to V1500 using the Out Most instruction. A B C D 230 240 250-1 260
DS Used HPP Used
The Out Least instruction copies the value in the lower eight O UT L bits of the accumulator to the lower eight bits of the specified A aaa V-memory location (i.e., it copies the low byte of the low word of the accumulator). In the following example, when X1 is on, the value in V1400 will be loaded into the lower 16 bits of the accumulator using the Load instruction. The value in the lower 8 bits of the accumulator are copied to V1500 using the Out Least instruction. Operand Data Type DL260 Range V-memory Pointer
V P
X1
All V-memory. See memory map All V-memory. See memory map
V1400
Load the value in V1400 into the lower 16 bits of the accumulater
V1500
Copy the value in the lower 8 bits of the accumulator to V1500
LD
OUTL
V1400
8
9
3
5
9
3
5
0
3
5
The unused accumulator bits are set to zero
Acc.
0
0
0
0
8
Handheld Programmer Keystrokes $
B
GX OUT
ENT
1
STR
SHFT
L ANDST
D
B
SHFT
L ANDST
E
3
A
4
1
B
F
ENT
0
A
5
1
0
A
0
V1500
A
0
ENT
0
230 240
250-1 260
DS Used HPP Used
A V P
V-memory Pointer
X1
All V-memory. See memory map All V-memory. See memory map
Load the value in V1400 into the lower 16 bits of the accumulator
LD
V1400
Copy the value in the upper 8 bits of the lower 16 bits of the accumulator to V1500
OUTM
V1500
V1400
8
9
3
5
9
3
5
9
0
0
The unused accumulator bits are set to zero Acc. 0
0
0
0
8
Handheld Programmer Keystrokes $
B
1
STR
SHFT
GX OUT
L ANDST
D
SHFT
M ORST
8
ENT
V1500
B
E
1
3
B
A
4
F 1
A
0
A 5
0
A 0
0
ENT ENT
DL205 User Manual, 4th Edition, Rev. A
5–69
Page 292
Chapter 5: Standard RLL Instructions - Accumulator/Stack Load and Output Data
Pop (POP)
The Pop instruction moves the value from the first level 1 of the accumulator stack (32 bits) to the accumulator and shifts each value in the stack up one level. In the 2 example below, when C0 is on, the value 4545 that was on top of the stack is moved into the accumulator using the Pop instruction The value is to V2000 using the Out instruction. The next Pop moves the value 3792 into the 3 DS Used output accumulator and outputs the value to V2001. The last Pop moves the value 7930 into the and outputs the value to V2002. Please note if the value in the stack were greater 4 HPP Used accumulator than 16 bits (4 digits) the Out Double instruction would be used and two V-memory locations for each Out Double must be allocated. 5 Discrete Bit Flags Description 6 7 8 9 10 11 12 13 14 A B C D POP
230 240
250-1 260
SP63
On when the result of the instruction causes the value in the accumulator to be zero.
DirectSOFT
Previous Acc. value
C0
POP
Acc. X
X
X
X
X X
X X
X
X
0
44 55 44 55
Accumulator Stack
Current Acc. value
Pop the 1st. value on the stack into the accumulator and move stack values up one location
Acc. 0
0
0
OUT
V2000
V2000
4
5
4
5
Copy the value in the lower 16 bits of the accumulator to V2000
Level 1
0 0 0
0
0
3
7
9
2
Level 2
0 0 0
0
0
7
9
3
0
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
Level 1
0
0
0
0
7
9
3
0
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
Level 1
X
X
X
X
X
X
X
X
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
POP
Previous Acc. value Acc. 0
Pop the 1st. value on the stack into the accumulator and move stack values up one location
0
0
0
44 55 44 55
0
3
Accumulator Stack
Current Acc. value Acc. 0
0
0
7
9
2
OUT
V2001
Copy the value in the lower 16 bits of the accumulator to V2001
V2001
3
7
9
2
POP
Previous Acc. value
Pop the 1st. value on the stack into the accumulator and move stack values up one location
Acc. 0
0
0
0
3
7
9
2
0
7
9
3
0
Accumulator Stack
Current Acc. value Acc. 0
OUT
0
0
V2002
Copy the value in the lower 16 bits of the accumulator to V2002
V2002
Handheld Programmer Keystrokes $
STR
SHFT
P
CV
GX OUT
SHFT
P
CV
GX OUT
SHFT GX OUT
5–70
P
CV
SHFT
C
A
SHFT
O INST#
P
SHFT
V AND
C
SHFT
O INST#
P
SHFT
V AND
C
SHFT
O INST#
P
SHFT
V AND
C
0
2
CV
ENT ENT
A
2
CV
A
0
A
0
ENT
B
1
0
ENT
ENT A
2
0
ENT
A
2
CV
A
0
A 0
C 0
2
ENT
DL205 User Manual, 4th Edition, Rev. A
7
9
3
0