Function
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.
R
×
×
×
×
×
3
2
1
0
16
16
16
16
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.
×
×
×
×
×
×
×
×
7
6
5
4
3
2
1
0
16
16
16
16
16
16
16
16
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.
0.00
MBS
0
×16
×16
7
MBS
0
×10
×10
7
CS/CJ/NSJ Series Instructions Reference Manual (W474)
×
×
×
3
2
1
0
10
10
10
10
R+1
R
×
×
×
×
×
×
×
×
7
6
5
4
3
2
1
10
10
10
10
10
10
10
10
10
D100
S+1: CIO 11
0
2
D
×16
×16
×16
6
5
4
5
4
3
2×16
+13×16
+3×16
+2×16
R+1: D101
2
9
6
×10
×10
×10
6
5
4
(BIN)
S+1
(BCD)
0
S: CIO 10
3
2
0
A
×16
×16
×16
3
2
1
0
2
+10=2961930
R: D100
1
9
3
0
×10
×10
×10
3
2
1
0
3. Instructions
R
(BCD)
S
R+1
R
(BCD)
(BIN)
(BIN)
LSB
LSB
3
385
Need help?
Do you have a question about the CJ - INSTRUCTIONS and is the answer not in the manual?
Questions and answers