Omron SYSMAC CP Series Instruction & Reference Manual page 224

Cpu unit
Hide thumbs Also See for SYSMAC CP Series:
Table of Contents

Advertisement

2 Instructions
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.
15
12
11
8
7
4
3
1
0
E
C
S
×16
×16
×16
×16
3
2
1
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.
S+1
0
0
2
D
3
2
×16
×16
×16
×16
×16
×16
7
6
5
4
3
Sample program
When CIO 0.00 is ON in the following example, the hexadecimal value in CIO 11 and CIO 10 is con-
verted to a BCD value and stored in D100 and D101.
0.00
MBS
0
×
7
16
MBS
0
×
7
10
2-188
0
15
12
11
8
7
4
3
0
4
3
3
2
R
×10
×10
×10
×10
0
3
2
1
0
R+1
S
0
A
0
2
9
6
1
×16
×16
×10
×10
×10
×10
×10
2
1
0
7
6
5
4
3
BCDL
10
D100
S+1 : CIO 11
0
2
D
×
×
×
6
5
4
16
16
16
×
×
×
5
4
2
16
13
16
3
16
R+1 : D101
2
9
6
×
×
×
6
5
4
10
10
10
(BIN)
S
S+1
(BCD)
R
9
3
0
×10
×10
×10
2
1
0
S: CIO 10
3
2
0
×
×
×
16
3
2
1
16
16
×
3
2
16
2
10 2961930
R : D100
1
9
3
×
×
×
3
10
2
1
10
10
CP1E CPU Unit Instructions Reference Manual(W483)
(BCD)
R
S
R+1
R
(BCD)
(BIN)
(BIN)
A
LSB
×
0
16
LSB
0
×
0
10

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents