High−level Instructions
3 − 187
Explanation of example
Converts the contents of data register DT10 to BCD code that expresses a 4-digit decimal when trigger R0
turns on. The converted data is stored in data register DT20.
If DT10 is 16 using decimal number conversion, the following will be stored in DT20.
····
Bit position
·····
DT10
15
000
12
0
11
000
8
0
7
000
4
1
3
000
0
0
Source [S]: K16
Conversion (to BCD code)
Destination [D]: H16 (BCD)
Decimal
K16
····
Bit position
·····
DT20
15
000
12
0
11
000
8
0
7
000
4
1
3
011
0
0
BCD H code
0
016
Description
Converts the 16-bit binary data specified by S to BCD code that expresses a 4-digit decimal. The converted
data is stored in D.
Precautions during programming
The maximum value of 16−bit binary data that can be converted to BCD code is K9999 (H270F).
Flag conditions
・Error flag (R9007): Turns on and stays on when:
・Error flag (R9008): Turns on for an instant when:
− The area specified using the index modifier exceeds the limit.
− The range that binary data can be BCD converted is exceeded.
(When minus or when K9999 is exceeded)