2 Instructions
2-186
CP1E CPU Unit Instructions Reference Manual(W483)
Function
Sample program
When CIO 0.00 is ON in the following example, the 8-digit BCD value in CIO 0010 and CIO 0011 is con-
verted to hexadecimal and stored in D200 and D201.
BIN
BIN(023) converts the BCD data in S to binary data
and writes the result to R.
The following diagram shows an example BCD-to-binary conversion.
BINL
BINL(058) converts the 8-digit BCD data in S and
S+1 to 8-digit hexadecimal (32-bit binary) 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)RS
×10
3
×10
2
×10
1
×10
0
×16
3
×16
2
×16
1
×16
0
RS
3452 0D7C
0347811121503478111215
RR+1
(BCD)
(BCD)
S+1
S
(BIN) (BIN)
×10
3
×10
2
×10
1
×10
0
×10
7
×10
6
×10
5
×10
4
S+1 S
×16
3
×16
2
×16
1
×16
0
×16
7
×16
6
×16
5
×16
4
R+1 R
00 000 0520030D270
0
×10
7
0
×10
6
2
×10
5
0
×10
4
0
×10
3
0
×10
2
5
×10
1
0
×10
0
200050=3×16
4
+13×16
2
+7×16
1
+2×16
0
0
×16
7
0
×16
6
0
×16
5
3
×16
4
0
×16
3
D
×16
2
7
×16
1
2
×16
0
BINL
10
D200
0.00
R : D200R+1 : D201
S+1 : CIO 11 S : CIO 10