537
Conversion Instructions Section 3-12
■ Example 2: Converting Hexadecimal Data to ASCII Data in BCD Format
When CIO 000001 is ON in the following example, the source data in D00000
(&1234 in decimal) is converted to BCD data and the result is stored tempo-
rarily in D00010. Next, the BCD data is converted to ASCII data and the result
is output to D00100 and D00101.
3-12-20EIGHT-DIGIT NUMBER TO ASCII: STR8(602)
Purpose Converts an 8-digit hexadecimal number (#0000 0000 to #FFFF FFFF) to
ASCII data (8 characters).
This instruction is supported by CS/CJ-series CPU Units with unit version 4.0
or later only.
4 5 7 6
30 31
32 33
0 1 3 2
34 35
36 37
8 9 B A
38 39
41 42
15 8 7 11 12 3 4 0
15 8 7 0
NEXT
STR4
,IR0+
FOR
&3
,IR1++
MOVR
D00010
IR0
MOVR
D00100
IR1
00000
000000
000000
S
D
Hexadecimal
S: D00010
S+1: D00011
S+2: D00012
ASCII
D: D00100
D+1: D00101
D+2: D00102
D+3: D00103
D+4: D00104
D+5: D00105
31 32
33 34
BCD
1 2 4 3
15 8 7 11 12 3 4 0
15 8 7 0
STR4
D00010
D00100
BCD
D00000
D00010
000001
S
D
0 4 2 D
15 8 7 11 12 3 4 0
D00000
&1234 Decimal
(#04D2 hexadecimal)
Binary (hexadecimal)
ASCII (BCD)
BCD
S: D00010
D: D00100
D+1: D00101