Conversion instructions
628
Part III FP Instructions
F73_BCD2A
BCD -> ASCII conversion
s2=16#
0 0
1
2
Number of bytes for BCD data
1: 1 byte (BCD code that expresses a 2-digit decimal)
2: 2 bytes (BCD code that expresses a 4-digit decimal)
3: 3 bytes (BCD code that expresses a 6-digit decimal)
4: 4 bytes (BCD code that expresses a 8-digit decimal)
Direction of converted data
0: Normal direction
1: Reverse direction
The two characters that make up one byte are interchanged when stored. Two bytes are converted
as one segment of data:
1 2 3 41 2 3 4
s1
d[1] d[0]
s1
d[1] d[0]
2 1 4 3 4 3 2 1
Normal direction
Converted
result
Reverse direction
The converted result is stored in the area specified by d. ASCII code requires 8 bits (one byte) to
express one BCD character. Upon conversion to ASCII, the data length will thus be twice the
length of the BCD source data.
ASCII HEX code to express BCD character:
BCD character ASCII HEX
code
0
1
2
3
4
5
6
7
8
9
H30
H31
H32
H33
H34
H35
H36
H37
H38
H39
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
Description
Converts the BCD code starting from the 16-bit area specified by s1 to the ASCII code that
expresses the equivalent decimals according to the contents specified by s2 if the trigger EN is in
the ON-state. s2 specifies the number of source data bytes and the direction of converted data
(normal/reverse).