437
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Conversion Instructions
3
NUM4/NUM8/NUM16
Example Programming
z Converting 3 Sets of 4 ASCII Characters to the Equivalent Hexadecimal Digits
When CIO 0.00 is ON in the following example, the 6 words of ASCII data starting at D10 are
converted, two words at a time, to numerical data. The converted numerical data is stored in the DM
Area starting at D100.
z Converting ASCII Data in BCD Format to Hexadecimal Data
When CIO 0.01 is ON in the following example, the ASCII characters in D0 and D1 are converted to
BCD data and the result is stored temporarily in D10. Next, the BCD data is converted to hexadecimal
and the result is output to D100.
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
D10
IR0
MOVR
D100
IR1
0.00
0.00
0.00
31 32
41 42
38 39
45 46
30 30
30 30
15 8 7 0
S
D
Hexadecimal
S: D10
S+1: D11
S+2: D12
S+3: D13
S+4: D14
S+5: D15
ASCII
D: D100
D+1: D101
D+2: D102
31 32
33 34
1 2 4
15 8 7 11 12 3 4 0
15 8 0
BIN
D10
D100
NUM4
D0
D10
S
D
0.01
0 4 2 D
15 8 7 11 12 3 4
7
0
3
BCD
S: D0
S+1: D1
Binary (hexadecimal)
ASCII (BCD)
BCD
D: D10
D100
&1234 Decimal
(#04D2 hexadecimal)