7-18
Section
Data Control Instructions
424
The result can be calculated by first converting all signed hexadecimal values to
BCD and then using the following formula.
R
+
D
Y
D
X
(S–P1)
Flags
ER:
Indirectly addressed DM word is non-existent. (Content of *DM word is
not BCD, or the DM area boundary has been exceeded.)
P1 and P1+2 are not in the same data area, or other setting error.
CY:
ON when the result, R, is negative.
EQ:
ON when the result, R, is 0000.
Example
When 05000 is turned ON in the following example, the signed binary source
data in 200 (#FFE2) is converted to BCD according to the parameters in
DM 0000 to DM 0002. The result (#0018) is then written to LR 00 and CY is
turned ON because the result is negative.
@SCL2(––)
DM 0000
200
05000
LR 00
Address
Instruction
Operands
00000
LD
05000
00001
@SCL2(––)
200
DM
0000
LR
00
DM 0000
FFFD
DM 0001
0003
DM 0002
0002
IR 200
FFE2
LR 00
0018
FFFD
3
2
CY=1
FFE2
–0018
CY flag is turned ON because
the conversion result is negative.
R
+
0002
0003
(FFE2–FFFD)
+
2
3
(–1B)
+
–18
7-18-3
BCD TO SIGNED BINARY SCALING – SCL3(––)
S:
Source word
IR, SR, AR, DM, HR, LR
Ladder Symbols
Operand Data Areas
@SCL3(––)
S
P1
R
R
: Result word
IR, SR, AR, DM, HR, LR
P1:
First parameter word
IR, SR, AR, DM, HR, LR
SCL3(––)
S
P1
R
Limitations
This instruction is available in the
CPM2A/CPM2C only
.
P1+1 must be BCD.
P1 through P1+4 must be in the same data area.
DM 6144 to DM 6655 cannot be used for R.