543
Conversion Instructions Section 3-12
Examples
■ Example 1: Converting 3 Sets of 4 ASCII Characters to the Equivalent
Hexadecimal Digits
When CIO 000000 is ON in the following example, the 6 words of ASCII data
starting at D00010 are converted, two words at a time, to numerical data. The
converted numerical data is stored in the DM Area starting at D00100.
■ Example 2: Converting ASCII Data in BCD Format to Hexadecimal Data
When CIO 000001 is ON in the following example, the ASCII characters in
D00000 and D00001 are converted to BCD data and the result is stored tem-
porarily in D00010. Next, the BCD data is converted to hexadecimal and the
result is output to D00100.
8 9 F E
1 2 B A
0 0 0 0
15 8 7 11 12 3 4 0
NEXT
NUM4
,IR0++
FOR
&3
,IR1+
MOVR
D00010
IR0
MOVR
D00100
IR1
000000
000000
000000
31 32
41 42
38 39
45 46
30 30
30 30
15 8 7 0
S
D
Hexadecimal
S: D00010
S+1: D00011
S+2: D00012
S+3: D00013
S+4: D00014
S+5: D00015
ASCII
D: D00100
D+1: D00101
D+2: D00102
31 32
33 34
1 2 4
15 8 7 11 12 3 4 0
15 8 0
BIN
D00010
D00100
NUM4
D00000
D00010
S
D
000001
0 4 2 D
15 8 7 11 12 3 4
7
0
3
BCD
S: D00000
S+1: D00001
Binary (hexadecimal)
ASCII (BCD)
BCD
D: D00010
D00100
&1234 Decimal
(#04D2 hexadecimal)