High−level Instructions
3 − 159
Explanation of example
Converts 2 bytes of data stored in data register DT0 to ASCII codes that express the equivalent
hexadecimals when trigger R0 turns on. The converted data is stored in data registers DT11 and DT10.
····
Hexadecimal
Bit position
·····
Binary data
A
1010
B
1011
C
1100
D
1101
15 1211 8 7 4 3 0
DT0
ASCII HEX code
ASCII character
4
B
24
A
1 4
D
44
C
3
DT11 DT10
Description
Converts the data starting from the 16-bit area specified by S1 to ASCII codes that express the equivalent
hexadecimals.
The converted result is stored in the area starting from the 16-bit area specified by D.
S2 specifies the number of source data bytes to be converted.
Since ASCII code requires eight bits (one byte) to express one hexadecimal character, the data length when
converted to ASCII code becomes double the source data.
Precautions during programming
The two characters that make up one byte are interchanged when stored.
Two bytes are converted as one segment of data.
4241
ABCD
4443
BADC
Hexadecimal data
Converted
result
S1
S1+1
D+1
D
D+2D+3
Hexadecimal
data
Converted result
1 2 3 4
5 6 7 8
2 1 4 3
6 5 8 7
Flag conditions
Σ Error flag (R9007): Turns on and stays on when:
Σ Error flag (R9008): Turns on for an instant when:
− The area specified using the index modifier exceeds the limit.
− The number of bytes specified by S2 exceeds the area specified by S1.
− The converted result exceeds the area specified by D.
− The data specified by S2 is recognized as “0”.