Conversion instructions
622
Part III FP Instructions
F71_HEX2A
HEX -> ASCII conversion
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
s1[0]
s1[0]
s1[1]
d[1]
d[1]
d[0]
d[0]
d[2]d[3]
12 34
56 78
21 4 3
65 8 7
Hexadecimal data
Converted
result
Hexadecimal
data
Converted result
ASCII HEX codes to express hexadecimal characters:
Hexadecimal
number
ASCII HEX
code
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
16#30
16#31
16#32
16#33
16#34
16#35
16#36
16#37
16#38
16#39
16#41
16#42
16#43
16#44
16#45
16#46
This instruction also exists as a P instruction (for FP2/2SH, FP3/5, FP10/10SH PLC types), which
is only executed at the rising edge of the EN trigger. Select [Insert P instruction] from the
"Instructions" pane if you require a P instruction. To facilitate reuse, the instruction then appears
under "Recently used" in the pop-up menu. Press <Ctrl>+<Shift>+<v> within the programming
area to open the list of recently used elements.
Description
Converts the data byte-wise from the 16-bit area specified by s1_Start to ASCII codes that express
the equivalent hexadecimals if the trigger EN is in the TRUE-state. The number of bytes to be
converted is specified by s2_Number. The converted result is stored in the area starting with the
16-bit area specified by d_Start. ASCII code requires 8 bits (one byte) to express one hexadecimal
character. Upon conversion to ASCII, the data length will thus be twice the length of the source
data.