
274
6 BASIC INSTRUCTIONS
6.5 Data Conversion Instructions
Converting ASCII to HEX
HEXA(P)
These instructions convert the ASCII data stored in the number of characters specified by (n) in the device numbers specified
by (s) and later to HEX code data, and store the converted data in the device numbers specified by (d) and later.
Setting data
■
Descriptions, ranges, and data types
■
Applicable devices
*1
T, ST, C cannot be used.
Processing details
• These instructions convert the ASCII data stored in the number of characters specified by (n) in the device numbers
specified by (s) and later to HEX code data, and store the converted data in the device numbers specified by (d) and later.
16-bit conversion mode and 8-bit conversion mode options are available for these instructions. For operation in each mode,
refer to the succeeding pages.
Ladder diagram
Structured text
ENO:=HEXA(EN,s,n,d);
ENO:=HEXAP(EN,s,n,d);
Operand
Description
Range
Data type
Data type (label)
(s)
Head device for storing the ASCII data to be converted to
hexadecimal code
Character string
ANYSTRING_SINGLE
(d)
Head device for storing the hexadecimal code after
conversion
16-bit signed binary
ANY16
(n)
Number of characters (number of bytes) of ASCII data to
be converted
1 to 16383
16-bit unsigned binary
ANY16_U
Operand
Bit
Word
Double word
Indirect
specification
Constant
Others
X, Y, M, L,
SM, F, B, SB
U
\G
T, ST,
C, LC
T, ST, C, D,
W, SD, SW, R
U
\G
Z
LC
LZ
K, H
E
$
(s)
(d)
(n)
• 16-bit conversion mode (while SM8161 is OFF)
The ASCII data stored in high-order 8 bits and low-order 8 bits (byte) of the device specified by (s) is converted to hexadecimal code, and transferred to
the device specified by (d) in units of 4 digits. The number of characters to be converted is specified by (n).
SM8161 is also used for the RS2, ASCI(P), CCD(P), and CRC(P) instructions. When using the 16-bit conversion mode, set SM8161 to normally OFF.
SM8161 is cleared when the CPU module mode is changed from RUN to STOP.
Moreover, when using the 16-bit conversion mode, the ASCII data must also be stored in high-order 8 bits of the device specified by (s).
In the following program, conversion is executed as follows:
(s)
(d)
(n)
HEXA
D200
SM8161
SM400
X10
D100
K4
16-bit conversion mode
Summary of Contents for MELSEC iQ-F FX5 series
Page 1: ...MELSEC iQ F FX5 Series Programming Manual Instructions Standard Functions Function Blocks ...
Page 2: ......
Page 21: ...19 PART 1 PART 1 OVERVIEW Part 1 consists of the following chapter 1 OVERVIEW ...
Page 98: ...96 4 STANDARD FUNCTIONS FUNCTION BLOCKS 4 2 Standard Function Blocks MEMO ...
Page 840: ...838 23 TIME DATA FUNCTIONS 23 4 Division MEMO ...
Page 887: ......