3. Instructions
434
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Example Programming
z Converting 3 Words of Numerical Data to ASCII Data
When CIO 0.00 is ON in the following example, the 3 words of numerical data starting at D10 are
converted, one word at a time, to ASCII data. The converted ASCII data is stored in the DM Area
starting at D100.
z Converting Decimal Data to ASCII Data in BCD Format
When CIO 0.01 is ON in the following example, the source data in D0 (&1234 in decimal) is converted
to BCD data and the result is stored temporarily in D10. Next, the BCD data is converted to ASCII data
and the result is output to D100 and D101.
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
D10
IR0
MOVR
D100
IR1
0.00
S
D
Hexadecimal
S: D10
S+1: D11
S+2: D12
ASCII
D: D100
D+1: D101
D+2: D102
D+3: D103
D+4: D104
D+5: D105
0.00
0.00
31 32
33 34
BCD
1 2 4 3
15 8 7 11 12 3 4 0
15 8 7 0
STR4
D100
BCD
D0
D10
0.01
D
0 4 2 D
15 8 7 11 12 3 4 0
D0
&1234 Decimal
(#04D2 hexadecimal)
Binary (hexadecimal)
ASCII (BCD)
BCD
S: D10
D: D100
D+1: D101