The text of a manual · part 36 of 61
DL205 PLC User Manual, Volume 1 of 2: Chapter 5: RLL and Intelligent Box Instructions, pages 333 to 342
Pages 333 to 342 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 333
Chapter 5: Standard RLL Instructions - Math
Multiply Formatted (MULF) Formatted is a 16-bit instruction that multiplies the 230 Multiply BCD value in the accumulator by the BCD value (Aaaa) 240 which is a range of discrete bits. The specified range (Kbbb) 250-1 can be 1 to 16 consecutive bits. The result resides in the 260 accumulator. Operand Data Type
DS Used HPP Used
Inputs Outputs Control Relays Stage Bits Timer Bits Counter Bits Special Relays Global I/O Constant
A aaa
MULF K bbb
DL260 Range A aaa bbb
X Y C S T CT SP GX/GY K
0-1777 0-1777 0-3777 0-1777 0-377 0-377 0-777 0-3777 -
1-16
Discrete Bit Flags
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: Status flags are valid only until another instruction uses the same flag.
In the following example, when X6 is on, the value formed by discrete locations X0–X3 is loaded into the accumulator using the Load Formatted instruction. The value formed by discrete locations C0–C3 is multiplied by the value in the accumulator using the Multiply Formatted instruction. The value in the lower four bits of the accumulator is copied to Y10–Y13 using the Out Formatted instruction. DirectSOFT X3 X6
LDF
X0 K4
Load the value represented by discrete locations X0- X3 into the accumulator
X2
X1
X0
OFF OFF ON ON The unused accumulator bits are set to zero
MULF
C0 K4
Multiply the value in the accumulator with the value represented by discrete locations C0- C3
0
Acc. 0 OUTF
Y10 K4
0
0
0
0
0
0
X 0
0
0
0
0
0
3
(Accumulator)
C3
2
(C0- C3)
OFF OFF ON OFF
6
Copy the lower 4 bits of the accumulator to discrete locations Y10- Y13
Handheld Programmer Keystrokes $
G STR
6
SHFT
L ANDST
D
SHFT
M ORST
U
SHFT
F
GX OUT
Y13 Y12 Y11 Y10
ENT
OFF ON ON OFF
F
A
3
5
ISG
L ANDST
F A 1
4 NEXT
5 B
5
E 0
0
ENT
NEXT
NEXT
E
ENT
4
NEXT
A
E 0
4
ENT
DL205 User Manual, 4th Edition, Rev. A
C2
C1
C0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
5–111
Page 334
Chapter 5: Standard RLL Instructions - Math
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Divide Formatted (DIVF) Formatted is a 16-bit instruction that divides the BCD 230 Divide value in the accumuator by the BCD value (Aaaa), a range of 240 discrete bits. The specified range (Kbbb) can be 1 to 16 250-1 consecutive bits. The first part of the quotient resides in the 260 accumulator and the remainder resides in the first stack
DIVF
A aaa K bbb location.
Operand Data Type
DS Used HPP Used
Inputs Outputs Control Relays Stage Bits Timer Bits Counter Bits Special Relays Global I/O Constant
DL260 Range A aaa bbb
X Y C S T CT SP GX/GY K
0-1777 0-1777 0-3777 0-1777 0-377 0-377 0-777 0-3777 -
1-16
Discrete Bit Flags
Description
SP63 SP70 SP75
5–112
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: Status flags are valid only until another instruction uses the same flag.
In the following example, when X6 is on, the value formed by discrete locations X0–X3 is loaded into the accumulator using the Load Formatted instruction. The value in the accumulator is divided by the value formed by discrete location C0–C3 using the Divide Formatted instruction. The value in the lower four bits of the accumulator is copied to Y10–Y13 using the Out Formatted instruction. DirectSOFT
X3
X6
LDF
X0 K4
Load the value represented by discrete locations X0- X3 into the accumulator
X2
X1
X0
ON OFF OFF OFF The unused accumulator bits are set to zero
DIVF
C0 K4
OUTF
Y10 K4
Divide the value in the accumulator with the value represented by discrete location C0- C3
0
0
0
0
0
G STR
6
SHFT
L ANDST
D
SHFT
D
I
Acc. 0
0
0
0
0
GX OUT
3 SHFT
8 F
E 0
F A 1
4 NEXT
5 B
5
C3
(C0- C3)
OFF OFF ON OFF
4
0
OFF ON OFF OFF
A 5
0
(Accumulator)
Y13 Y12 Y11 Y10
F V AND
0
8 2
0
ENT
NEXT
NEXT
E
ENT
4
0
0
0
0
0
C2
0
First stack location contains the remainder
ENT
3
0
Copy the lower 4 bits of the accumulator to discrete locations Y10- Y13
Handheld Programmer Keystrokes $
0
_..
NEXT
DL205 User Manual, 4th Edition, Rev. A
A
E 0
4
ENT
0
C1
C0
Page 335
Chapter 5: Standard RLL Instructions - Math
Add Top of Stack (ADDS)
1 2 3 Discrete Bit Flags Description 4 5 6 NOTE: Status flags are valid only until another instruction uses the same flag. 7 In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The value in V1420 and V1421 is 8 loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The value in the first level of the accumulator stack is added with the value in the accumulator using the Add Stack 9 instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. 10 11 12 13 14 A B C D
Top of Stack is a 32-bit instruction that adds the BCD 230 Add value in the accumulator with the BCD value in the first 240 level of the accumulator stack. The result resides in the 250-1 accumulator. The value in the first level of the accumulator 260 stack is removed and all stack values are moved up one level.
SP63 SP66 SP67 SP70 SP75
ADDS
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 was encountered.
DS Used HPP Used
DirectSOFT
V1400
V1401
X1
0
Load the value in V1400 and V1401 into the accumulator
LDD
0
3
9
5
0
2
6
V1400
Acc.
0
0
3
9
5
0
Load the value in V1420 and V1421 into the accumulator
V1420
Add the value in the accumulator with the value in the first level of the accumulator stack
ADDS
V1500
1
L ANDST
D
SHFT
L ANDST
D
SHFT
A
D
SHFT
GX OUT
SHFT
B B
3
D
D
3
E
1
3
D
3
0
3
5
6
0
1
7
2
0
5
6
Acc.
0
0
5
6
7
0
8
2
0
5
V1501
D
3
0
0
ENT
3
2
E
S RST
ENT
B
F
C
A
5
A
0
4
1
1
A
4
A
0
0
A
2
0
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
Level 1
0
0
3
9
5
0
2
6
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
Accumulator stack after 2nd LDD
Handheld Programmer Keystrokes STR
7
Acc.
0
B
1
6
Copy the value in the accumulator to V1500 and V1501
OUTD
$
0
2
V1420
V1421
LDD
0
Accumulator stack after 1st LDD
Level 1
0
ENT
6
7
0
8
V1500
2
ENT
ENT
DL205 User Manual, 4th Edition, Rev. A
5–113
Page 336
Chapter 5: Standard RLL Instructions - Math
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Subtract Top of Stack (SUBS) Top of Stack is a 32-bit instruction that subtracts 230 Subtract the BCD value in the first level of the accumulator stack 240 from the BCD value in the accumulator. The result resides in 250-1 the accumulator. The value in the first level of the 260 accumulator stack is removed and all stack values are moved
S UBS up one level.
Discrete Bit Flags
Description
SP63 SP64 SP65 SP70 SP75
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.
NOTE: Status flags are valid only until another instruction uses the same flag.
DS Used HPP Used
5–114
In the following example, when X1 is on, the value in V1400 and V1401 will be loaded into the accumulator using the Load Double instruction. The value in V1420 and V1421 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded into the accumulator onto the accumulator stack. The BCD value in the first level of the accumulator stack is subtracted from the BCD value in the accumulator using the Subtract Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction. DirectSOFT
V1401
X1
0
Load the value in V1400 and V1401 into the accumulator
LDD
0
1
V1400 7
2
0
5
6
V1400 Acc.
Load the value in V1420 and V1421 into the accumulator
LDD V1420
0
1
7
2
0
0
3
0
5
6
V1420
V1421
Subtract the value in the first level of the accumulator stack from the value in the accumulator
SUBS
0
9
5
0
2
6
Acc.
0
0
3
9
5
0
2
6
Acc.
0
0
2
2
2
9
7
0
Accumulator stack after 1st LDD 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
Accumulator stack after 2nd LDD Copy the value in the accumulator to V1500 and V1501
OUTD V1500
0
0
2
2
2
9
7
0
Level 1
0
0
5
6
Level 2
X
X X
1
7
X X
2
0
X X
X
Level 3
X
X X
X X
X X
X
Level 4
X
X X
X X
X X
X
Handheld Programmer Keystrokes
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
V1501
B STR
1
SHFT
L ANDST
D
SHFT
L ANDST
D
SHFT
S RST
SHFT
GX OUT
SHFT
D
ENT B
D 3 D 3
B B 1
ISG
1
A 4
E 1
4 ENT
F
A 5
A 0
C
S RST
3 U
B 3
E 1
3
A 2
A 0
0
0
0
ENT
DL205 User Manual, 4th Edition, Rev. A
ENT ENT
V1500
Page 337
Chapter 5: Standard RLL Instructions - Math
Multiply Top of Stack (MULS) Top of Stack is a 16-bit instruction that multiplies a 230 Multiply 4-digit BCD value in the first level of the accumulator stack 240 by a 4-digit BCD value in the accumulator. The result resides 250-1 in the accumulator. The value in the first level of the 260 accumulator stack is is removed and all stack values are moved
MULS up one level.
Discrete Bit Flags
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: Status flags are valid only until another instruction uses the same flag.
In the following example, when X1 is on, the value in V1400 will be loaded into the accumulator using the Load instruction. The value in V1420 is loaded into the accumulator using the Load instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The BCD value in the first level of the accumulator stack is multiplied by the BCD value in the accumulator using the Multiply Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
DS Used HPP Used
DirectSOFT X1
Load the value in V1400 into the accumulator
LD V1400
5
V1400 0 0 0
5
0
The unused accumulator bits are set to zero Acc.
0
0
0
0
0
0
V1420 0 Load the value in V1420 into the accumulator
LD V1420
Multiply the value in the accumulator with the value in the first level of the accumulator stack
MULS
Copy the value in the accumulator to V1500 and V1501
OUTD V1500
STR
1
SHFT
L ANDST
D
SHFT
L ANDST
D
SHFT
M ORST
U
GX OUT
SHFT
D
ENT B
E 1
3 B 3 ISG 3
L ANDST
A 4
E
0 C
1
4
S RST
ENT
B
F 1
A
2
A 5
0 A 0
A 0
0
0
0
0
0
0
0
2
0
0
Acc.
0
1
0
0
0
0
0
0
0
Handheld Programmer Keystrokes B
0
Acc.
1
0
V1501
$
2
The unused accumulator bits are set to zero
0
0
0
0
V1500
0
Accumulator stack after 1st L DD 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
Accumulator stack after 2nd L DD Level 1
0
0
0
0 5
0
0
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
ENT ENT
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–115
Page 338
Chapter 5: Standard RLL Instructions - Math
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Divide by Top of Stack (DIVS) Top of Stack is a 32-bit instruction that divides the 230 Divide 8-digit BCD value in the accumulator by a 4-digit BCD 240 value in the first level of the accumulator stack. The result 250-1 resides in the accumulator and the remainder resides in the 260 first level of the accumulator stack. Discrete Bit Flags
DIVS
Description
SP53 SP63 SP70 SP75
On when the value of the operand is larger than the accumulator can work with. 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: Status flags are valid only until another instruction uses the same flag.
DS Used HPP Used
5–116
In the following example, when X1 is on, the Load instruction loads the value in V1400 into the accumulator. The value in V1420 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The BCD value in the accumulator is divided by the BCD value in the first level of the accumulator stack using the Divide Stack instruction. The Out Double instruction copies the value in the accumulator to V1500 and V1501. DirectSOFT
V1400
X1
Load the value in V1400 into the accumulator
LD V1400
0
Acc.
0
0
0
0
0
0
0
5
V1420
V1500
1
SHFT
L ANDST
D
SHFT
D
I
GX OUT
SHFT
B
E 1
A 4
B
3
3
8
V AND
3
0
0
5
0
0
0
0
0
Acc.
0
0
0
2
5
0
0
0
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
0
0
0
2
5
0
0
V1500
0
Level 1
0
0
0
0 0
0
2
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
The remainder resides in the first stack location
D
D
0
X
ENT
3
3
0
0
Handheld Programmer Keystrokes
D
0
0
V1501
L ANDST
0
Acc.
Copy the value in the accumulator to V1500 and V1501
OUTD
STR
2
Level 1
Accumulator stack after 2nd L DD
Divide the value in the accumulator by the value in the first level of the accumulator stack
DIVS
SHFT
0
Accumulator stack after 1st L DD
0
Load the value V1420 and V1421 into the accumulator
LDD
B
2
V1420
V1421
$
0
The unused accumulator bits are set to zero
1 S RST
ENT
B
F 1
A 0
E 4
A 5
0 C 2
A 0
ENT A
0
0
ENT
DL205 User Manual, 4th Edition, Rev. A
ENT
Level 1
0
0
0
0 0
0
0
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
Page 339
Chapter 5: Standard RLL Instructions - Math
Add Binary Top of Stack (ADDBS)
1 2 stack values are moved up one level. 3 Discrete Bit Flags Description 4 5 6 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 will be loaded into 7 the accumulator using the Load Double instruction. The value in V1420 and V1421 is loaded into the accumulator using the Load Double instruction, pushing the value previously 8 loaded in the accumulator onto the accumulator stack. The binary value in the first level of the accumulator stack is added with the binary value in the accumulator using the Add Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out 9 Double instruction. 10 11 12 13 14 A B C D
Binary Top of Stack instruction is a 32-bit 230 Add instruction that adds the binary value in the accumulator 240 with the binary value in the first level of the accumulator 250-1 stack. The result resides in the accumulator. The value in 260 the first level of the accumulator stack is removed and all
SP63 SP66 SP67 SP70 SP73
DS Used HPP Used
ADDBS
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 signed addition or subtraction results in a incorrect sign bit.
DirectSOFT
V1400
V1401
X1
0
Load the value in V1400 and V1401 into the accumulator
LDD
0
3
A
5
0
C
6
V1400
Acc.
0
0
3
A
5
V1421
0
Load the value in V1420 and V1421 into the accumulator
LDD
V1420
Add the binary value in the accumulator with the binary value in the first level of the accumulator stack
ADDBS
V1500
B
STR
1
SHFT
L ANDST
D
SHFT
L ANDST
D
SHFT
A
D
GX OUT
SHFT
D
B
3
B
3
1
B 3
1
A
E
1
4
ENT
F
A 5
A
0
C
A 0
0
A
2
0
7
B
0
5
F
0
1
7
B 0
5
F
Acc.
0
0
5
2
0
2
5
0
4
S RST
3
D
D
E
1
3
3
0
B
D
V1420
0
ENT
3
6
Acc.
Handheld Programmer Keystrokes $
1
C
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
Accumulator stack after 2nd LDD
Copy the value in the accumulator to V1500 and V1501
OUTD
0
0
Accumulator stack after 1st LDD
Level 1
0
ENT
0
5
2
0
1
2
5
Level 1
0
0
3
A 5
0
C
6
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
ENT
ENT
DL205 User Manual, 4th Edition, Rev. A
5–117
Page 340
Chapter 5: Standard RLL Instructions - Math
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Subtract Binary Top of Stack (SUBBS) Binary Top of Stack is a 32-bit instruction that 230 Subtract subtracts the binary value in the first level of the accumulator 240 stack from the binary value in the accumulator. The result 250-1 resides in the accumulator. The value in the first level of the 260 accumulator stack is removed and all stack locations are
S UBBS moved up one level.
Discrete Bit Flags
Description
SP63 SP64 SP65 SP70
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.
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 will be loaded into the accumulator using the Load Double instruction. The value in V1420 and V1421 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The binary value in the first level of the accumulator stack is subtracted from the binary value in the accumulator using the Subtract Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
DS Used HPP Used
5–118
DirectSOFT
V1400
V1401
X1
0
Load the value in V1400 and V1401 into the accumulator
LDD V1400
Acc.
0
0
0
1
1
A
A
2
2
V1421 0
Load the value in V1420 and V1421 into the accumulator
LDD V1420
Subtract the binary value in the first level of the accumulator stack from the binary value in the accumulator
SUBBS
V1500
3
B 1
SHFT
L ANDST
D
SHFT
L ANDST
D
SHFT
S RST
SHFT
GX OUT
SHFT
D
B
3 D
B 3
U
B B
3
E 4
2
S RST
ENT
A
A
5
0
0 A
1 F
1
0 C
0
5
0
C
6
Acc.
0 C
6
Acc.
0
0
2
0
3
0
B
6
Accumulator stack after 1st LDD 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
Accumulator stack after 2nd LDD
A
1 B 1
ISG
A
A
5
0
4
1
3
3
E
V1420
A
ENT D
B
3
Handheld Programmer Keystrokes
STR
5
B
0
0
2
V1501
$
0
5
0
Copy the value in the accumulator to V1500 and V1501
OUTD
0
0
0
ENT ENT
ENT
DL205 User Manual, 4th Edition, Rev. A
0
3
0
6
V1500
B
Level 1
0
0
1
A 2
0
5
B
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 341
Chapter 5: Standard RLL Instructions - Math
Multiply Binary Top of Stack (MULBS)
1 2 accumulator stack is removed and all stack locations are 3 moved up one level. Discrete Bit Flags Description 4 5 NOTE: Status flags are valid only until another instruction uses the same flag. 6 In the following example, when X1 is on, the Load instruction moves the value in V1400 into the accumulator. The value in V1420 is loaded into the accumulator using the Load 7 instruction, pushing the value previously loaded in the accumulator onto the stack. The binary value in the accumulator stack’s first level is multiplied by the binary value in the accumulator using the Multiply Binary Stack instruction. The Out Double instruction copies 8 the value in the accumulator to V1500 and V1501. 9 10 11 12 13 14 A B C D
Binary Top of Stack is a 16-bit instruction that 230 Multiply multiplies the 16-bit binary value in the first level of the 240 accumulator stack by the 16-bit binary value in the 250-1 accumulator. The result resides in the accumulator and can be 260 32 bits (8 digits max.). The value in the first level of the
SP63 SP70
MULBS
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.
DS Used HPP Used
DirectSOFT X1
Load the value in V1400 into the accumulator
LD
V1400
C
V1400 3 5 0
The unused accumulator bits are set to zero Acc.
0
0
0
0
C
3
5
0
V1420
0
Load the value in V1420 into the accumulator
LD
V1420
Multiply the binary value in the accumulator with the binary value in the first level of the accumulator stack
Acc.
Copy the value in the accumulator to V1500 and V1501
OUTD
V1500
0
0
0
0
0
1
4
0
0
0
F
4
2
4
0
0
Handheld Programmer Keystrokes B
STR
1
SHFT
L ANDST
D
SHFT
L ANDST
D
SHFT
M ORST
U
GX OUT
SHFT
D
ENT
B
3
E
ISG
L ANDST
E
A
0
C
4
2
1
S RST
ENT
F
A
B
1
5
0
A
1
B
3
4
1
B
3
A
0
A
0
0
4
0
0
0
V1501
$
1
The unused accumulator bits are set to zero Acc.
MULBS
0
F
4
2
4
V1500
0
Accumulator stack after 1st LDD
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
Level 1
0
0
0
0 C
3
5
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
Accumulator stack after 2nd LDD
ENT ENT
ENT
DL205 User Manual, 4th Edition, Rev. A
5–119
Page 342
Chapter 5: Standard RLL Instructions - Math
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Divide Binary by Top of Stack (DIVBS) Divide Binary Top of Stack is a 32-bit instruction that divides
230 the 32-bit binary value in the accumulator by the 16-bit 240 binary value in the first level of the accumulator stack. The 250-1 result resides in the accumulator and the remainder resides in 260 the first level of the accumulator stack. Discrete Bit Flags
DIVBS
Description
SP53 SP63 SP70
On when the value of the operand is larger than the accumulator can work with. 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.
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 will be loaded into the accumulator using the Load instruction. The value in V1420 and V1421 is loaded into the accumulator using the Load Double instruction, pushing the value previously loaded in the accumulator onto the accumulator stack. The binary value in the accumulator is divided by the binary value in the first level of the accumulator stack using the Divide Binary Stack instruction. The value in the accumulator is copied to V1500 and V1501 using the Out Double instruction.
DS Used HPP Used
DirectSOFT
Accumulator stack after 1st LDD
V1400
X1
0
Load the value in V1400 into the accumulator
LD
0
1
4
The unused accumulator bits are set to zero
V1400
Acc. 0
0
0
0
0
0
0
1
4
V1420
V1421 0
0
0
C
3
5
0
Load the value in V1420 and V1421 into the accumulator
LDD V1420
Acc. 0
0
0
0
C
3
5
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
0 Accumulator stack after 2nd LDD
Divide the binary value in the accumulator by the binary value in the first level of the accumulator stack
DIVBS
Acc. 0
Copy the value in the accumulator to V1500 and V1501
OUTD V1500
0
0
0
0
0
V1501
0
0
0
0
9
9
C
C
V1500
4
4
Level 1
0
0
1
4
Level 2
X
X X
0
0
X X
0
0
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
Handheld Programmer Keystrokes $
B STR
1
SHFT
L ANDST
D
SHFT
L ANDST
D
D
I
SHFT GX OUT
5–120
ENT B
E 1
3
3 SHFT
The remainder resides in the first stack location
D
B
3
3
8
V AND
D
B 1 B
3
A 4
1
A 0
E
C
1
4
S RST
ENT
F
A 5
0
A 2
A 0
ENT
0
0
ENT
ENT
DL205 User Manual, 4th Edition, Rev. A
Level 1
0
0
0
0
Level 2
X
X X
0
0
X X
0
0
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