Conversion instructions
677
Part III FP Instructions
F251_ATOB
ASCII -> Binary conversion
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
"Instructions" pane if you require a P instruction. To facilitate reuse, the instruction then appears
under "Recently used" in the pop-up menu. Press <Ctrl>+<Shift>+<v> within the programming
area to open the list of recently used elements.
PLC types Availability of F251_ATOB (see page 1323)
Variable Data type Function
s1_Control STRING Control string
D16
16:
32:
D:
H:
+
-
converts decimal ASCII data
converts hexadecimal ASCII da
Normal direction
Reverse direction
converts the ASCII data to 16-bi
-32,768 to +32,767 (16#0 to 16#
converts the ASCII data to 32-bi
-2,147,483,648 to +2,147,483,64
16#FFFFFFFF)
s2_AsciiData ANY Starting area for storing ASCII data
n_ConversionMethod ANY16 Conversion method
16#
Number of ASCII characters p
Offset in ASCII character units
Number of 16-bit (1-word) or 3
un
(for details, see explanation following the tables)
d_BinaryData ANY Starting area for storing binary data
Description
Converts ASCII code stored in the area specified by s2_AsciiData to 16-bit/32-bit binary data. The
conversion method is specified by n_ConversionMethod according to the four control characters
of s1_Control. The converted result is stored in the area specified by d_BinaryData.
Data types