The text of a manual · part 33 of 61
DL205 PLC User Manual, Volume 1 of 2: Chapter 5: RLL and Intelligent Box Instructions, pages 303 to 312
Pages 303 to 312 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 303
Chapter 5: Standard RLL Instructions - Logical
Exclusive Or Formatted (XORF) The Exclusive Or Formatted instruction performs an exclusive OR
230 of the binary value in the accumulator and a specified range of 240 discrete memory bits (1 to 32). 250-1 The instruction requires a starting location (Aaaa) and the number 260 of bits (Kbbb) to be exclusive ORed. Discrete status flags indicate if DS Used HPP Used
XORF
A aaa
K bbb the result of the Exclusive Or Formatted is zero or negative (the most significant bit is on). Operand Data Type Inputs Outputs Control Relays Stage bits Timer bits Counter bits Special Relays Global I/O Constant
DL250-1 Range
DL260 Range
A aaa bbb aaa bbb
X Y C S T CT SP GX/GY K
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
Description
SP63 SP70
Will be on if the result in the accumulator is zero Will be on if the result in the accumulator is negative
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the binary pattern of C10–C13 (4 bits) will be loaded into the accumulator using the Load Formatted instruction. The value in the accumulator will be logically Exclusive Ored with the bit pattern from Y20–Y23 using the Exclusive Or Formatted instruction. The value in the lower 4 bits of the accumulator are output to C20–C23 using the Out Formatted instruction. DirectSOFT X1
LDF
C10
Location
Constant
C13 C12 C11 C10
C10
K4
OFF ON
ON OFF
K4 Load the status of 4 consecutive bits (C10-C13) into the accumulator X0RF
The unused accumulator bits are set to zero
Y20 K4
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
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
0
0
0
0
Acc.
0
0
0 0
0
0
0 0
0
0
0
0 0
0
0
0
0 0
1
1
0
1
0
0
0
0 0
0
0
0
0 0
0
0
0
0 1
1
1
0
Accumulator
Exclusive OR the binary bit pattern (Y20-Y23) with the value in the accumulator
Acc.
0
0 0
0
0
0
0
Y23 Y22 Y21 Y20 XORF (Y20-Y23) ON OFF OFF OFF
OUTF
0
C20 K4
Copy the specified number of bits from the accumulator to C20-C23
Handheld Programmer Keystrokes $
B 1
STR SHFT
L ANDST
D
SHFT
X SET
Q
GX OUT
SHFT
F
OR 5
Constant
C23 C22 C21 C20
K4
ON ON ON OFF
ENT F
3
Location C20
NEXT
5 SHFT
F 5 PREV
PREV
NEXT
NEXT
NEXT
NEXT
C
A
C
A 2
2
B
A E
0
4 E
0
E 0
1
4
4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
ENT
ENT
ENT
DL205 User Manual, 4th Edition, Rev. A
5–81
Page 304
Chapter 5: Standard RLL Instructions - Logical
1 2
3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Exclusive Or with Stack (XORS) The Exclusive Or with Stack instruction is a 32-bit instruction that performs an Exclusive Or of the value in the accumulator with the first level of the accumulator stack. The result resides in the accumulator. The value in the first level of the accumulator stack is removed from the stack and all values are moved up one level. Discrete status flags indicate if the result of the Exclusive Or with Stack is zero or a negative number (the most significant bit is on).
230 240 250-1 260
DS Used HPP Used
Discrete Bit Flags
XO R S
Description
SP63 SP70
Will be on if the result in the accumulator is zero Will be on if the result in the accumulator is negative
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example when X1 is on, the binary value in the accumulator will be Exclusive ORed with the binary value in the first level of the accumulator stack. The result will reside in the accumulator.
DirectSOFT V1401
LDD
X1
5
V1400
4
7
V1400 E
2
8
7
A
Load the value in V1400 and V1401 into the accumulator 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
Acc.
0
1
0 1
0
1
0
0 0
1
1
1
1 1
1
0
0 0
1
1
Acc.
0
0
1 0
1
0
0
1
2
1
0
1 0
1
0
XORS
Exclusive OR the value in the accumulator with the value in the first level of the accumulator stack OUTD
0
1
0 1
0
1
0
0 0
1
1
1
1 1
1
0
0
0
1 0
1
0
0
0 0
1
1
1
1 0
1
0
36476A38 XOR (1st level of Stack) 0
0
1 1
0
1
1
0 0
1
0
0
0 1
1
1
0
1
1 0
1
0
1
0 0
0
1
1
1 0
0
0
0
1 0
1 0 0
0
0 1
1 0
0 0
0
1 0
1 0
1 0 0
0
1 0
0
1
0 0
0
0
1
0 0
1
0
0
0 0
1
0
2
9
2
2
Acc.
V1500 6
Copy the value in the accumulator to V1500 and V1501
Handheld Programmer Keystrokes $
B 1
STR
SHFT
L ANDST
D
SHFT
X SET
Q
GX OUT
SHFT
D
5–82
ENT D
3 OR 3
B 3
SHFT
E
ENT
B
F 1
A 4
1 S RST
A 5
3
V1501
A 0
A 0
0
0
ENT
ENT
DL205 User Manual, 4th Edition, Rev. A
4
4
V1500
Page 305
Chapter 5: Standard RLL Instructions - Logical
Compare (CMP)
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 7 NOTE: The status flags are only valid until another instruction that uses the same flags is executed. 8 In the following example when X1 is on, the constant 4526 will be loaded into the lower 16 bits of the accumulator using the Load instruction. The value in the accumulator is compared 9 with the value in V2000 using the Compare instruction. The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in 10 the accumulator is less than the value specified in the Compare instruction, SP60 will turn on, energizing contact C30. 11 12 13 14 A B C D The compare instruction is a 16-bit instruction that
230 compares the value in the lower 16 bits of the 240 accumulator with the value in a specified V-memory 250-1 location (Aaaa). The corresponding status flag will be 260 turned on indicating the result of the comparison. DS Used HPP Used
V-memory
All V See memory map
Pointer
P
SP60 SP61 SP62
-
CMP
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 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.
DirectSOFT X1
CONSTANT
LD
4
K4526
Load the constant value 4526 into the lower 16 bits of the accumulator
5
? 2
6
The unused accumulator bits are set to zero Acc. 0
0
0
0
44 55 2? 2 66
Compared with
CMP
V2000
8
Compare the value in the accumulator with the value in V2000
SP60
9
4
5
V2000
C30
OUT
Handheld Programmer Keystrokes $
B
STR
1
SHFT
L ANDST
SHFT
C
$
STR GX OUT
2
ENT
D
SHFT
3
SHFT
M ORST
P
SHFT
SP STRN
G
SHFT
C
D 2
K JMP
E
F
4
C
CV
2
A
6
0 A
3
0
C
5
A
G
2
A
0
6
A
0
0
ENT ENT
ENT ENT
DL205 User Manual, 4th Edition, Rev. A
5–83
Page 306
Chapter 5: Standard RLL Instructions - Logical
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Compare Double (CMPD) Compare Double instruction is a 32–bit instruction that 230 The compares the value in the accumulator with the value (Aaaa), 240 which is either two consecutive V-memory locations or an 8–digit 250-1 (max.) constant. The corresponding status flag will be turned on 260 indicating the result of the comparison. DS Used HPP Used
Operand Data Type
DL240 Range DL250-1 Range DL260 Range aaa
All V See memory map
V-memory Pointer
P
-
Constant
K
0-FFFFFFFF aaa aaa 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
All See memory map All V-memory. See memory map 0-FFFFFFFF
Discrete Bit Flags
Description
SP60 SP61 SP62
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.
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 the accumulator using the Load Double instruction. The value in the accumulator is compared with the value in V2010 and V2011 using the CMPD instruction. The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value specified in the Compare instruction, SP60 will turn on, energizing contact C30. DirectSOFT X1
V2000
V2001
LDD
4
5
2
6
7
2
9
9
Acc. 4
5
? 2
6
77 72
9
9
2
6
V2000 Load the value in V2000 and V2001 into the accumulator
Compared with
CMPD V2010 6
Compare the value in the accumulator with the value in V2010 and V2011 SP60
7
3
9
5
V2011
0
V2010
C30
OUT
Handheld Programmer Keystrokes $
B STR
1
ENT
SHFT
L ANDST
D 3
3
SHFT
C
SHFT
M ORST
P
SHFT
SP STRN
G
SHFT
C
D
$ STR GX OUT
5–84
DL230 Range A
CMPD A aaa
2
D
C
2
A 2
A 0
D CV
C
0 A
3
0
0 A
2
3 A
6
A 0
ENT ENT
DL205 User Manual, 4th Edition, Rev. A
ENT B
0
A 1
0
ENT
Page 307
Chapter 5: Standard RLL Instructions - Logical
Compare Formatted (CMPF)
1 2 result of the comparison. 3 Operand Data Type DL250-1 Range DL260 Range A aaa bbb aaa bbb 4 5 6 7 8 Discrete Bit Flags Description 9 10 NOTE: Status flags are valid only until another instruction uses the same flag. 11 In the following example, when X1 is on the Load Formatted instruction loads the binary value (6) from C10–C13 into the accumulator. The CMPF instruction compares the value in the accumulator to the value in Y20–Y23 (E hex). The corresponding discrete status flag will 12 be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value specified in the Compare instruction, SP60 will turn on, 13 energizing C30. 14 A B C D
Compare Formatted compares the value in the 230 The accumulator with a specified number of discrete locations 240 (1–32). The instruction requires a starting location (Aaaa) 250-1 and the number of bits (Kbbb) to be compared. The 260 corresponding status flag will be turned on indicating the DS Used HPP Used
Inputs Outputs Control Relays Stage bits Timer bits Counter bits Special Relays Global I/O Constant
X Y C S T CT SP GX/GY K
SP60 SP61 SP62
DirectSOFT X1
A aaa
K bbb
– – – – – – – – 1–32
0–1777 0–1777 0–3777 0–1777 0–377 0–377 0–777 0-3777 -
– – – – – – – – 1–32
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.
LDF
C10
K4
CMPF
Y20
K4
SP60
0–777 0–777 0–1777 0–1777 0–377 0–177 0-777 -
CMPF
Load the value of the specified discrete locations (C10- C13) into the accumulator Compare the value in the accumulator with the value of the specified discrete location (Y20- Y23)
Constant K4
C13 C12 C11 C10
OFF ON ON OFF
The unused accumulator bits are set to zero
Acc.
C30
Y23 Y22 Y21 Y20
OUT
Location
C10
0
0
0
0
0
0
0
6
Compared with
ON ON ON OFF
E
DL205 User Manual, 4th Edition, Rev. A
5–85
Page 308
Chapter 5: Standard RLL Instructions - Logical
1
2
3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Compare with Stack (CMPS) The Compare with Stack instruction is a 32-bit instruction that compares the value in the accumulator with the value in the first level of the accumulator stack. The corresponding status flag will be turned on indicating the result of the comparison. This does not affect the value in the accumulator.
230 240 250-1 260
DS Used HPP Used
Discrete Bit Flags
Description
SP60 SP61 SP62
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.
NOTE: Status flags are valid only until another instruction uses the same flag.
In the following example when X1 is on, the value in V1400 and V1401 is loaded into the accumulator using the Load Double instruction. The value in V1410 and V1411 is loaded into the accumulator using the Load Double instruction. The value that was loaded into the accumulator from V1400 and V1401 is placed on top of the stack when the second Load instruction is executed. The value in the accumulator is compared with the value in the first level of the accumulator stack using the CMPS instruction. The corresponding discrete status flag will be turned on indicating the result of the comparison. In this example, if the value in the accumulator is less than the value in the stack, SP60 will turn on, energizing C30. DirectSOFT
V1400
V1401
X1
Load the value in V1400 and V1401 into the accumulator
LDD
6
5
0
0
3
5
4
4
6
5
0
0
3
5
4
4
V1400 Load the value in V1410 and V1411 into the accumulator
LDD
Acc.
V1410 Compare the value in the accumulator with the value in the first level of the accumulator stack
CMPS
SP60
C30
B STR
1
SHFT
L ANDST
D
SHFT
L ANDST
D
SHFT
C
$ GX OUT
2
ENT D
3
B 3
E
D
B 3
SHFT
M ORST
P
SHFT
SP STRN
G
C
D 2
CV
E 4
S RST
ENT
A
ENT
0 A 0
A 0
B
1
6 3
A 4
1
3
SHFT
5
5
0
0
3
5
4
4
Acc. 5
5
0
0
3
5
4
4
Compared with Top of Stack
Handheld Programmer Keystrokes $
V1410
V1411
OUT
STR
5–86
C MP S
ENT
DL205 User Manual, 4th Edition, Rev. A
0 A
1
0
ENT ENT
Page 309
Chapter 5: Standard RLL Instructions - Logical
Compare Real Number (CMPR) Compare Real Number instruction 230 The compares a real number value in the 240 accumulator with two consecutive V-memory 250-1 locations containing a real number. The 260 corresponding status flag will be turned on DS Used HPP N/A
CMPR A aaa indicating the result of the comparison. Both numbers being compared are 32 bits long. Operand Data Type
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 SP60 SP61 SP62 SP71 SP75
Description 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.
NOTE: Status flags are valid only until another instruction uses the same flag.
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 accumulator contents with the real representation for decimal 6. Since 7 > 6, the corresponding discrete status flag is turned on (special relay SP62). DirectSOFT X1
LDR R7.0
CMPR R6.0
SP62
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
OUT
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–87
Page 310
Chapter 5: Standard RLL Instructions - Math
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 3 the box.) 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 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 will be loaded into the 10 accumulator 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 11 copied to V2010 using the Out instruction. 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 $
B
STR
1
SHFT
L ANDST
D
SHFT
A
D
GX OUT
5–88
All See memory map All V-memory. See memory map
0
V2010
ENT
C
A
2
3
D
A
0
C
3
3
SHFT
V AND
2
C
A 2
A
0
A
0
B 0
DL205 User Manual, 4th Edition, Rev. A
0
A
0
A 1
ENT
G
0
6
ENT
ENT
Page 311
Chapter 5: Standard RLL Instructions - Math
Add Double (ADDD)
230 240 250-1 260 DS Used HPP Used
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. Operand Data Type
ADDD A aaa
DL230 Range DL240 Range DL250-1 Range DL260 Range A aaa aaa aaa aaa
V-memory
V
All See memory map
Pointer
P
-
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
Constant
K
0-99999999
0-99999999
0-99999999
0-99999999
Discrete Bit Flags SP63 SP66 SP67 SP70 SP75
Description 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
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 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 accumulator is copied to V2010 and V2011 using the Out Double instruction. 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
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
Add the value in the accumulator with the value in V2006 and V2007 OUTD V2010
V2011
Copy the value in the accumulator to V2010 and V2011
V2010
Handheld Programmer Keystrokes $
B 1
STR SHFT
L ANDST
D
SHFT
A
D
GX OUT
C 3
3
0 SHFT
ENT D D
3 D 3
A 2
D 3
A 0
C
SHFT
A 2
3 V AND
A 0
C
0 A
2
0 A
6
0 B
0
ENT G A
1
0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
ENT ENT
DL205 User Manual, 4th Edition, Rev. A
5–89
Page 312
Chapter 5: Standard RLL Instructions - Math
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
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
DS Used HPP N/A
5–90
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.
4
1
B
V1400 0
0
0
(Hex number)
Real Value
OUTD
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
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
V1400 Copy the result in the accumulator to V1400 and V1401.
Exponent (8 bits)
Sign Bit
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. A