385
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Conversion Instructions
3
BCD/BCDL
Function
Example Programming
When CIO 0.00 is ON in the following example, the hexadecimal value in CIO 11 and CIO 10 is
converted to a BCD value and stored in D100 and D101.
z BCD
BCD(024) converts the binary data in S to BCD data and
writes the result to R.
The following diagram shows an example BCD-to-binary conversion.
z BCDL
BCDL(059) converts the 8-digit hexadecimal (32-bit binary)
data in S and S+1 to 8-digit BCD data and writes the result
to R and R+1.
The following diagram shows an example of 8-digit BCD-to-binary conversion.
(BCD)(BIN)
R
R
×16
3
×16
2
×16
1
×16
0
×10
3
×10
2
×10
1
×10
0
RR+1
(BCD)
(BCD)
S+1
S
(BIN) (BIN)
R+1 R
×16
3
×16
2
×16
1
×16
0
×16
7
×16
6
×16
5
×16
4
×10
3
×10
2
×10
1
×10
0
×10
7
×10
6
×10
5
×10
4
320A002D
×16
7
×16
6
×16
5
×16
4
S+1: CIO 11 S: CIO 10
19300296
×10
7
×10
6
×10
5
×10
4
×16
3
×16
2
×16
1
×16
0
×10
3
×10
2
×10
1
×10
0
2×16
5
+13×16
4
+3×16
3
+2×16
2
+10=2961930
R+1: D101 R: D100
MBS
MBS
LSB
LSB
10
D100
0.00