The text of a manual · part 32 of 60
DL205 PLC User Manual, Volume 1 of 2, pages 311 to 320
Pages 311 to 320 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 311
Chapter 5: Standard RLL Instructions
Compare Real Number (CMPR)
1 2 32 bits long. 3 Operand Data Type DL250-1 Range DL260 Range aaa aaa 4 5 6 Discrete Bit Flags Description 7 8 9 NOTE: Status flags are valid only until another instruction uses the same flag. 10 In the following example, when X1 is on, the LDR instruction loads the real number representation for 7 decimal into the accumulator. The CMPR instruction compares the 11 accumulator contents with the real representation for decimal 6. Since 7 > 6, the corresponding discrete status flag is turned on (special relay SP62). 12 13 14 A B OUT C D
Compare Real Number instruction compares a real 230 The number value in the accumulator with two consecutive 240 V-memory locations containing a real number. The 250-1 corresponding status flag will be turned on indicating the 260 result of the comparison. Both numbers being compared are DS Used HPP N/A
CMPR A aaa
A
V-memory
V
Pointer
P
Constant
R
SP60 SP61 SP62 SP71 SP75
LDR
R7.0
CMPR
R6.0
SP62
All. See memory map All V-memory. See memory map -3.402823E+038 to + 3.402823E+038
On when the value in the accumulator is less than the instruction value. On when the value in the accumulator is equal to the instruction value. On when the value in the accumulator is greater than the instruction value. On anytime the V-memory specified by a pointer (P) is not valid On when a real number instruction is executed and a non-real number encountered.
DirectSOFT X1
All. See memory map All V-memory. See memory map -3.402823E+038 to + 3.402823E+038
Load the real number representation for decimal 7 into the accumulator
Compare the value with the real number representation for decimal 6
Acc.
4
0
E
0
0
0
0
0
CMPR
4
0
D
0
0
0
0
0
C1
DL205 User Manual, 4th Edition, Rev. D
5-87
Page 312
Chapter 5: Standard RLL Instructions
Math Instructions
1 Add (ADD) is a 16-bit instruction that adds a BCD value in the 2 Add accumulator with a BCD value in a V-memory location (Aaaa).
(You cannot use a constant (K) as the BCD value in the box.) 3 The result resides in the accumulator.
Operand Data Type DL230 Range DL240 Range DL250-1 Range DL260 Range 4 A aaa aaa aaa aaa 5 6 Discrete Bit Flags Description 7 8 NOTE: The status flags are only valid until another instruction that uses the same flags is executed. 9 In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator 10 using the Load instruction. The value in the lower 16 bits of the accumulator are added to the value in V2006 using the Add instruction. The value in the accumulator is copied to V2010 using the Out instruction. 11 12 13 14 A B C D ADD
230
A aaa
240
250-1 260
DS Used HPP Used
V-memory
All V See memory map
Pointer
P
SP63 SP66 SP67 SP70 SP75
All See memory map All V-memory. See memory map
-
All See memory map All V-memory. See memory map
On when the result of the instruction causes the value in the accumulator to be zero On when the 16-bit addition instruction results in a carry On when the 32-bit addition instruction results in a carry On anytime the value in the accumulator is negative On when a BCD instruction is executed and a NON-BCD number is encountered
DirectSOFT
V2000
X1
4
LD
9
3
5
V2000
Load the value in V2000 into the lower 16 bits of the accumulator
The unused accumulator bits are set to zero 0 0 0 0 4
ADD
+
V2006
Acc.
Add the value in the lower 16 bits of the accumulator with the value in V2006
9
3
5
(Accumulator)
2
5
0
0
(V2006)
7
4
3
5
7
4
3
5
OUT
V2010
Copy the value in the lower 16 bits of the accumulator to V2010 Handheld Programmer Keystrokes $
5-88
B
STR
SHFT
L ANDST
D
SHFT
A
D
GX OUT
All See memory map All V-memory. See memory map
0
1
ENT
C
3 3
SHFT
V2010
D
2
C
3
V AND
A
C
2
A
0
2
0
A A B
0 0 1
A A A
DL205 User Manual, 4th Edition, Rev. D
0 0 0
ENT
G
6
ENT
ENT
Page 313
Chapter 5: Standard RLL Instructions
Add Double (ADDD)
230 240 250-1 260 DS Used HPP Used
1 2 Operand Data Type DL230 Range DL240 Range DL250-1 Range DL260 Range 3 A aaa aaa aaa aaa 4 5 6 Discrete Bit Flags Description 7 8 9 NOTE: The status flags are only valid until another instruction that uses the same flags is executed. In the following example, when X1 is on, the value in V2000 and V2001 will be loaded into 10 the accumulator using the Load Double instruction. The value in the accumulator is added with the value in V2006 and V2007 using the Add Double instruction. The value in the 11 accumulator is copied to V2010 and V2011 using the Out Double instruction. 12 13 14 A B C D Add Double is a 32-bit instruction that adds the BCD value in the accumulator with a BCD value (Aaaa), which is either two consecutive V-memory locations or an 8–digit (max) BCD constant. The result resides in the accumulator.
-
All See memory map All V-memory. See memory map
All See memory map All V-memory. See memory map
All See memory map All V-memory. See memory map
0-99999999
0-99999999
0-99999999
0-99999999
V-memory
V
All See memory map
Pointer
P
Constant
K
SP63 SP66 SP67 SP70 SP75
ADDD A aaa
On when the result of the instruction causes the value in the accumulator to be zero On when the 16-bit addition instruction results in a carry On when the 32-bit addition instruction results in a carry On anytime the value in the accumulator is negative On when a BCD instruction is executed and a NON-BCD number is encountered
DirectSOFT X1
V2001
LDD
V2000
6
7
3
9
5
0
2
6
V2000
Load the value in V2000 and V2001 into the accumulator ADDD
V2006
Add the value in the accumulator with the value in V2006 and V2007
6
7
3
9
5
0
2
6
(Accumulator)
+ 2
0
0
0
4
0
4
6
(V2006 and V2007)
Acc. 8
7
3
9
9
0
7
2
8
7
3
9
9
0
7
2
OUTD
V2010
V2010
V2011
Copy the value in the accumulator to V2010 and V2011
Handheld Programmer Keystrokes $
B
STR
SHFT
L ANDST
D
SHFT
A
D
GX OUT
0
SHFT
D
1
3 3
3
ENT
D D
C
3
3
D
2
C
3
SHFT
A
V AND
C
0
2 2
A
A A
0
0 0
A
A B
0
0 1
ENT
G A
6 0
ENT ENT
DL205 User Manual, 4th Edition, Rev. D
5-89
Page 314
Chapter 5: Standard RLL Instructions
Add Real (ADDR)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
230 240 250-1 260 DS Used HPP N/A
5-90
Add Real is a 32-bit instruction that adds a real number, which is either two consecutive V-memory locations or a 32-bit constant, to a real number in the accumulator. Both numbers must conform to the IEEE floating point format. The result is a 32-bit real number that resides in the accumulator. Operand Data Type
ADDR A aaa
DL250-1 Range
DL260 Range
A aaa aaa
V-memory
V
Pointer
P
Constant
R
All. See memory map All V-memory. See memory map -3.402823E+038 to + 3.402823E+038
All. See memory map All V-memory. See memory map -3.402823E+038 to + 3.402823E+038
Discrete Bit Flags Description SP63 SP70 SP71 SP72 SP73 SP74 SP75
On when the result of the instruction causes the value in the accumulator to be zero On anytime the value in the accumulator is negative On anytime the V-memory specified by a pointer (P) is not valid On anytime the value in the accumulator is an invalid floating point number On when a signed addition or subtraction results in a incorrect sign bit On anytime a floating point math operation results in an underflow error On when a real number instruction is executed and a non-real number was encountered
NOTE: Status flags are valid only until another instruction uses the same flag. DirectSOFT X1
LDR
4
0
E
0
0
0
0
0
R7.0 Load the real number 7.0 into the accumulator
4
0
E
0
0
0
0
0
(Accumulator)
1
5
+ 4
1
7
0
0
0
0
0
(ADDR)
2
2
Acc. 4
1
B
0
0
0
0
0
0
0
7 +
(decimal)
ADDR R15.0
V1401
Add the real number 15.0 to the accumulator contents, which is in real number format.
OUTD V1400 Copy the result in the accumulator to V1400 and V1401.
4
1
B
V1400 0
0
0
(Hex number)
Real Value
Acc.
Sign Bit
8 4
2
1
8
4 2
1
8
4
2 1
8
4
2
1
8 4
2
1
8
4 2
1
8
4
2 1
8
4
2
1
0 1
0
0
0
0 0
1
1
0
1 1
0
0
0
0
0 0
0
0
0
0 0
0
0
0
0 0
0
0
0
0
Exponent (8 bits)
128 + 2 + 1 = 131 131 - 127 = 4 Implies 2 (exp 4)
Mantissa (23 bits)
1.011 x 2 (exp 4) = 10110. binary= 22 decimal
NOTE1: The current HPP does not support real number entry with automatic conversion to the 32-bit IEEE format. You must use DirectSOFT for this feature. NOTE2: If the value being added to a real number is 16,777,216 times smaller than the real number, the calculation will not work.
DL205 User Manual, 4th Edition, Rev. D
Page 315
Chapter 5: Standard RLL Instructions
Subtract (SUB) Subtract is a 16-bit instruction that subtracts the BCD
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 7 8 NOTE: constant (K) cannot be used for the BCD value. Status flags are only valid until another instruction that uses the same flags is executed. 9 In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator using the Load instruction. The value in V2006 is subtracted from the value 10 in the accumulator using the Subtract instruction. The value in the accumulator is copied to V2010 using the Out instruction. 11 12 13 14 A B C D
230 value (Aaaa) in a V-memory location from the BCD value 240 in the lower 16 bits of the accumulator. The result resides 250-1 in the accumulator. 260 DS Used HPP Used
V-memory
V
All See memory map
Pointer
P
-
SP63 SP66 SP67 SP70 SP75
SUB
A aaa
All See memory map All V-memory. See memory map
All See memory map All V-memory. See memory map
All See memory map All V-memory. See memory map
On when the result of the instruction causes the value in the accumulator to be zero On when the 16 bit addition instruction results in a carry On when the 32 bit addition instruction results in a carry On anytime the value in the accumulator is negative On when a BCD instruction is executed and a NON-BCD number is encountered
V2000
Direct SOFT X1
2
LD
4
7
5
V2000
Load the value in V2000 into the lower 16 bits of the accumulator
The unused accumulator bits are set to zero 0 0 0 0
_
SUB
V2006
Acc.
Subtract the value in V2006 from the value in the lower 16 bits of the accumulator OUT
V2010
2
4
7
5
(Accumulator)
1
5
9
2
(V2006)
0
8
8
3
0
8
8
3
V2010
Copy the value in the lower 16 bits of the accumulator to V2010
Handheld Programmer Keystrokes $
B
STR
SHFT
L ANDST
D
SHFT
S RST
U
GX OUT
1
ENT
C
3
ISG
SHFT
B
2
1
V AND
C
2
A
0
A
0
A
SHFT
V AND
C
A
B
A
0
1
0 2 0
ENT
A
0
A
0
G
6
ENT
ENT
DL205 User Manual, 4th Edition, Rev. D
5-91
Page 316
Chapter 5: Standard RLL Instructions
Subtract Double (SUBD)
Subtract Double is a 32-bit instruction that subtracts the 1 SUBD BCD value (Aaaa), which is either two consecutive V-memory A aaa locations or an 8-digit (max) constant, from the BCD value in the accumulator. The result resides in the accumulator. 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 7 8 NOTE: The status flags are only valid until another instruction that uses the same flags is executed. 9 In the following example, when X1 is on, the value in V2000 and V2001 will be loaded into the accumulator using the Load Double instruction. The value in V2006 and V2007 10 is subtracted from the value in the accumulator. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction. 11 12 13 14 A B C D 230 240
250-1 260
V-memory
V
All (See page 3 - 53)
Pointer
P
-
Constant
K
0-99999999
SP63 SP64 SP65 SP70 SP75
DS Used HPP Used
All (See page 3-54) All V-memory (See page 3-54) 0-99999999
All (See page 3-55) All V-memory (See page 3-55) 0-99999999
All (See page 3-56) All V-memory (See page 3-56) 0-99999999
On when the result of the instruction causes the value in the accumulator to be zero On when the 16 bit subtraction instruction results in a borrow On when the 32 bit subtraction instruction results in a borrow On anytime the value in the accumulator is negative On when a BCD instruction is executed and a NON-BCD number was encountered
V2001
DirectSOFT X1
0
LDD
1
0
V2000
6
3
2
7
4
V2000
Load the value in V2000 and V2001 into the accumulator
0 1
0
6
3
2
7
4
6
7
2
3
7
5
0
3
9
0
8
9
9
0
3
9
0
8
9
9
_
SUBD
V2006
0
ACC.
The value in V2006 and V2007 is subtracted from the value in the accumulator OUTD
0
V2010
V2011
V2010
Copy the value in the accumulator to V2010 and V2011
Handheld Programmer Keystrokes $
5-92
B
STR
D
1
SHFT
L ANDST
SHFT
S RST
SHFT
GX OUT
SHFT
D
3
3
ENT
D U
C
3
ISG
B
C
1
2
D A
2
A
0
C
3
0
DL205 User Manual, 4th Edition, Rev. D
A
B
1
A
0
2
0
A
A
0
0
ENT
ENT
A
0
G
6
ENT
Page 317
Chapter 5: Standard RLL Instructions
Subtract Real (SUBR)
1 2 3 Operand Data Type DL250-1 Range DL260 Range A aaa aaa 4 5 Discrete Bit Flags Description 6 7 8 9 NOTE: Status flags are valid only until another instruction uses the same flag. 10 11 12 13 14 A B C D NOTE: The current HPP does not support real number entry with automatic conversion to the 32-bit IEEE
Subtract Real is a 32-bit instruction that subtracts a real 230 The number, which is either two consecutive V-memory locations or 240 a 32-bit constant, from a real number in the accumulator. The 250-1 result is a 32-bit real number that resides in the accumulator. Both 260 numbers must be Real data type (IEEE floating point format).
V-memory Pointer
V All. (See page 3-55) All. (See page 3-56) P All V-memory (See page 3-55) All V-memory (See page 3-56) -3.402823E+038 to -3.402823E+038 to R + 3.402823E+038 + 3.402823E+038
Constant
SP63 SP70 SP71 SP72 SP73 SP74 SP75
On when the result of the instruction causes the value in the accumulator to be zero On anytime the value in the accumulator is negative On anytime the V-memory specified by a pointer (P) is not valid On anytime the value in the accumulator is an invalid floating point number On when a signed addition or subtraction results in an incorrect sign bit On anytime a floating point math operation results in an underflow error On when a real number instruction is executed and a non-real number was encountered
DirectSOFT X1
LDR
4
1
B
0
0
0
0
0
R22.0
Load the real number 22.0 into the accumulator.
_
2
2
B
0
0
0
0
0
(Accumulator)
5
4 _ 4
1
1
1
7
0
0
0
0
0
(SUBR)
7
Acc. 4
0
E
0
0
0
0
0
0
0
(decimal)
SUBR
R15.0
V1401
Subtract the real number 15.0 from the accumulator contents, which is in real number format.
OUTD
V1400
Copy the result in the accumulator to V1400 and V1401.
4
0
E
V1400 0
0
0
(Hex number)
Real Value
Acc.
8 4
2
1
8
4 2
1
8
4
2 1
8
4
2
1
8 4
2
1
8
4 2
1
8
4
2 1
8
4
2
1
0 1
0
0
0
0 0
0
1
1
1 0
0
0
0
0
0 0
0
0
0
0 0
0
0
0
0 0
0
0
0
0
Sign Bit
Exponent (8 bits)
128 + 1 = 129 129 - 127 = 2 Implies 2 (exp 2)
Mantissa (23 bits)
1.11 x 2 (exp 2) = 111. binary= 7 decimal ndard RLL structions
DS Used HPP N/A
SUBR A aaa format. You must use DirectSOFT for this feature.
DL205 User Manual, 4th Edition, Rev. D
5-93
Page 318
Chapter 5: Standard RLL Instructions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Multiply (MUL) is a 16-bit instruction that multiplies the BCD value 230 Multiply (Aaaa), which is either a V-memory location or a 4–digit 240 (max) constant, by the BCD value in the lower 16 bits of the 250-1 accumulator The result can be up to 8 digits and resides in 260 the accumulator. Operand Data Type
MUL A aaa
DL230 Range
DL240 Range
DL250-1 Range
A aaa aaa aaa aaa
V-memory
V
All (See page 3-53)
Pointer
P
-
Constant
K
0-9999
All (See page 3-54) All V-memory (See page 3-54) 0-9999
All (See page 3-55) All V-memory (See page 3-55) 0-9999
All (See page 3-56) All V-memory (See page 3-56) 0-9999
Discrete Bit Flags
DL260 Range
Description
SP63 SP70 SP75
On when the result of the instruction causes the value in the accumulator to be zero. On anytime the value in the accumulator is negative. On when a BCD instruction is executed and a NON-BCD number was encountered.
NOTE: The status flags are only valid until another instruction that uses the same flags is executed.
In the following example, when X1 is on, the value in V2000 will be loaded into the accumulator using the Load instruction. The value in V2006 is multiplied by the value in the accumulator. The value in the accumulator is copied to V2010 and V2011 using the Out Double instruction. DS Used HPP Used
5-94
V2000
DirectSOFT X1
1
LD
0
0
0
V2000 The unused accumulator bits are set to zero
Load the value in V2000 into the lower 16 bits of the accumulator
0
0
0
0
1 0 0 0
X
MUL
Acc.
V2006
2 0
0
0
2
5
0
0
2
5
5
0
0
0
0
0
0
The value in V2006 is multiplied by the value in the accumulator 0 OUTD
V2011
V2010
V2010
Copy the value in the accumulator to V2010 and V2011 Handheld Programmer Keystrokes $
B
STR
SHFT
L ANDST
D
SHFT
M ORST
U
GX OUT
SHFT
D
1
ENT C
3 ISG 3
2
L ANDST
A C
C
2
A
0 2 0
DL205 User Manual, 4th Edition, Rev. D
A A B
0 0 1
A A A
0 0 0
ENT G
6
ENT
ENT
(Accumulator) (V2006)
Page 319
Chapter 5: Standard RLL Instructions
Multiply Double (MULD)
1 2 accumulator stack. 3 Operand Data Type DL250-1 Range DL260 Range A aaa aaa 4 5 Discrete Bit Flags Description 6 7 NOTE: Status flags are valid only until another instruction uses the same flag. 8 In the following example, when X1 is on, the constant Kbc614e hex will be loaded into the accumulator. When converted to BCD the number is ”12345678”. That number is stored in 9 V1400 and V1401. After loading the constant K2 into the accumulator, we multiply it times 12345678, which is 24691356. 10 11 12 13 14 A B C D Multiply Double is a 32-bit instruction that multiplies the
230 8-digit BCD value in the accumulator by the 8-digit BCD 240 value in the two consecutive V-memory locations specified 250-1 in the instruction. The lower 8 digits of the results reside 260 in the accumulator. Upper digits of the result reside in the
V-memory Pointer
SP63 SP70 SP75
DS Used HPP Used
V P
All V-mem (See page 3-55) All V-mem (See page 3-55)
MULD A aaa
All V-mem (See page 3-56) All V-mem (See page 3-56)
On when the result of the instruction causes the value in the accumulator to be zero On anytime the value in the accumulator is negative On when a BCD instruction is executed and a NON-BCD number was encountered
DirectSOFT
1
X1
2
3
4
5
6
7
8
(Accumulator)
Load the hex equivalent of 12345678 decimal into the accumulator.
LDD
Kbc614e
Convert the value to BCD format. It will occupy eight BCD digits (32 bits).
BCD
V1401
Output the number to V1400 and V1401 using the OUTD instruction.
OUTD
V1400
V1400
1
2
3
4
5
6
7
8
2
4
6
9
1
3
5
6
2
4
6
9
1
3
5
6
X
2
Acc.
(Accumulator)
Load the constant K2 into the accumulator.
LD
K2
Multiply the accumulator contents (2) by the 8-digit number in V1400 and V1401.
MULD
V1400
V1403
V1402
Move the result in the accumulator to V1402 and V1403 using the OUTD instruction.
OUTD
V1402
Handheld Programmer Keystrokes $
B
STR
SHFT
L ANDST
D
SHFT
B
C
GX OUT
SHFT
D
SHFT
L ANDST
D
SHFT
M ORST
U
SHFT
D
GX OUT
1
1
3 2
ENT
D D
3
3
B
3
ISG 3
1
PREV
3
L ANDST
PREV
SHFT
B
E
A
A
1
C
2
SHFT
G
A
ENT
6
B
1
E
4
SHFT
E
4
ENT
ENT
D B
C
4
2
1
E
4
0
ENT
ENT
B
3
0
A
1
0
E
C
4 2
A
0
0
ENT
DL205 User Manual, 4th Edition, Rev. D
5-95
Page 320
Chapter 5: Standard RLL Instructions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Multiply Real (MULR) Multiply Real instruction multiplies a real number in 230 The the accumulator with either a real constant or a real number 240 occupying two consecutive V-memory locations. The result 250-1 resides in the accumulator. Both numbers must be Real data 260 type (IEEE floating point format). DS Used HPP N/A
5-96
Operand Data Type
DL250-1 Range
DL260 Range aaa aaa
A V-memory Pointer
MULR A aaa
V All. (See page 3-55) All. (See page 3-56) P All V-memory (See page 3-55) All V-memory (See page 3-56) -3.402823E+038 to -3.402823E+038 to R + 3.402823E+038 + 3.402823E+038
Constant
Discrete Bit Flags SP63 SP70 SP71 SP72 SP73 SP74 SP75
Description On when the result of the instruction causes the value in the accumulator to be zero On anytime the value in the accumulator is negative On anytime the V-memory specified by a pointer (P) is not valid On anytime the value in the accumulator is an invalid floating point number On when a signed addition or subtraction results in an incorrect sign bit On anytime a floating point math operation results in an underflow error On when a real number instruction is executed and a non-real number was encountered
NOTE: Status flags are valid only until another instruction uses the same flag. DirectSOFT X1
LDR
4
0
E
0
0
0
0
0
R 7.0 Load the real number 7.0 into the accumulator.
4
0
E
0
0
0
0
0
(Accumulator)
x
1
5
X 4
1
7
0
0
0
0
0
(MULR)
1
0
5
Acc. 4
2
D
2
0
0
0
0
2
0
7
(decimal)
MULR R 15.0
V1401
Multiply the accumulator contents by the real number 15.0
4
2
D
V1400 0
0
0
(Hex number)
Real Value
OUTD V1400 Copy the result in the accumulator to V1400 and V1401.
Acc.
8 4
2
1
8
4 2
1
8
4
2 1
8
4
2
1
8 4
2
1
8
4 2
1
8
4
2 1
8
4
2
1
0 1
0
0
0
0 1
0
1
1
0 1
0
0
1
0
0 0
0
0
0
0 0
0
0
0
0 0
0
0
0
0
Exponent (8 bits)
Sign Bit 128 + 4 + 1 = 133 133 - 127 = 6 Implies 2 (exp 6)
Mantissa (23 bits)
1.101001 x 2 (exp 6) = 1101001. binary= 105 decimal
NOTE: The current HPP does not support real number entry with automatic conversion to the 32-bit IEEE format. You must use DirectSOFT for this feature.
DL205 User Manual, 4th Edition, Rev. D