Conversion instructions
631
Part III FP Instructions
F74_A2BCD
ASCII -> BCD conversion
s2 = 16# 0 0
1
2
Number of bytes for ASCII characters
Direction of converted data
0: Normal direction
1: Reverse direction
1: 1 byte (1 ASCII character)
2: 2 bytes (2 ASCII characters)
3: 3 bytes (3 ASCII characters)
4: 4 bytes (4 ASCII characters)
5: 5 bytes (5 ASCII characters)
6: 6 bytes (6 ASCII characters)
7: 7 bytes (7 ASCII characters)
8: 8 bytes (8 ASCII characters)
Four characters are converted as one segment of data:
2 1 4 3 4 3 2 1
1 2 3 4
3 4
1 2
Normal direction
Reverse direction
BCD data
ASCII
code
The converted result is stored in byte units in the area starting from the 16-bit area specified by d.
ASCII code requires 8 bits (1 byte) to express 1 BCD character. Upon conversion to a BCD number,
the data length will thus be half the length of the ASCII code source data.
If an odd number of characters is being converted, "0" will be entered for bit position 0 to 3 of the
final data (byte) of the converted results if data is sequenced in the normal direction, and "0" will be
entered for bit position 4 to 7 if data is being sequenced in the reverse direction:
s1[3] s1[2] s1[1] s1[0]
d[1] d[0]
37 36 35 34 33 32 31
7654321
01 23 45 67
ASCII code
F74_A2BCD instruction execution
This position is
filled with “0”
Converted result
BCD HEX code
7 ASCII characters (7 bytes)
character
ASCII HEX
code
ASCII HEX code to express BCD character:
Description
Converts the ASCII codes that express the decimal characters starting from the 16-bit area
specified by s1 to BCD if the trigger EN is in the ON-state. s2 specifies the number of source data
bytes and the direction of converted code source data.