Converting Ascii To Hex - Mitsubishi MELSEC iQ-F FX5 series Programming Manual

Melsec iq-f fx5 series
Hide thumbs Also See for MELSEC iQ-F FX5 series:
Table of Contents

Advertisement

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.
Ladder diagram
(s)
Setting data
■Descriptions, ranges, and data types
Operand
Description
(s)
Head device for storing the ASCII data to be converted to
hexadecimal code
(d)
Head device for storing the hexadecimal code after
conversion
(n)
Number of characters (number of bytes) of ASCII data to
be converted
■Applicable devices
Operand
Bit
X, Y, M, L,
SM, F, B, SB
(s)
(d)
(n)
*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.
• 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:
SM400
X10
HEXA
6 BASIC INSTRUCTIONS
274
6.5 Data Conversion Instructions
(d)
(n)
Word
U\G T, ST,
T, ST, C, D,
C, LC
W, SD, SW, R
*1
D200
D100
K4
Structured text
ENO:=HEXA(EN,s,n,d);
ENO:=HEXAP(EN,s,n,d);
Range
1 to 16383
Double word Indirect
U\G
Z
LC
SM8161
16-bit conversion mode
Data type
Character string
16-bit signed binary
16-bit unsigned binary
Constant
specification
LZ
K, H
Data type (label)
ANYSTRING_SINGLE
ANY16
ANY16_U
Others
E
$

Advertisement

Table of Contents
loading

Table of Contents