15 Applied Instructions (External Device (optional device))
15.4 HEX / ASCII to Hexadecimal Conversion
400
FXCPU Structured Programming Manual
[Basic & Applied Instruction]
2. <16-bit conversion mode> When M8161=OFF(M8161 is used commonly with RS, ASCI,
CCD, CRC instructions)
ASCII characters stored in higher and lower 8 bits (bytes) in the device specified by are converted into
HEX data, and transferred to the device specified by in every four digits. The number of characters to be
converted is specified by n.
M8161 is used commonly with RS, ASCI, CCD, CRC instructions. When using in 16 bits, you must keep
always OFF.
M8161 is cleared when changed from RUN to STOP.
Operation
In the case of the program shown below, the conversion is executed as follows.
Conversion source data
ASCII code HEX conversion
D 200 lower 30H 0
D 200 higher 41H A
D 201 lower 42H B
D 201 higher 43H C
D 202 lower 31H 1
D 202 higher 32H 2
D 203 lower 33H 3
D 203 higher 34H 4
D 204 lower 35H 5
Command input
Head device in which ASCII
code to be converted is stored
Head device for storing
converted HEX code
Number of characters in
ASCII code to be converted
(number of bytes)
HEX
EN
s
n
ENO
d
M8000
16-bit mode
M8161
X010
HEX
EN
s
ENO
d
n
D200 D100
K4
M8000
16-bit mode
M8161