270
6 BASIC INSTRUCTIONS
6.5 Data Conversion Instructions
Converting decimal ASCII to 16-bit binary data
DABIN(P)(_U)
These instructions convert the decimal ASCII data in the device areas specified by (s) and later to 16-bit binary data, and
store the converted data in the device specified by (d).
■Descriptions, ranges, and data types
■Applicable devices
*1 T, ST, C cannot be used.
• These instructions convert the decimal ASCII data in the device areas specified by (s) and later to 16-bit binary data, and
store the converted data in the device specified by (d).
When the ASCII data, -25108 (signed), is specified by (s)
• The ASCII data that can be specified by (s) to (s)+2 is -32768 to +32767 for signed data, and 0 to 65535 for unsigned data.
• As signed data, "20H" is stored if the ASCII data is positive, and "2DH" is stored if the data is negative. (If a value other than
"20H" and "2DH" is set, the data will be processed as positive data.) (DABIN(P))
• A value "30H" to "39H" can be set in the each place of the ASCII code.
• If a value "20H" or "00H" is set, the value will be processed as "30H".
Ladder diagram Structured text
ENO:=DABIN(EN,s,d);
ENO:=DABINP(EN,s,d);
ENO:=DABIN_U(EN,s,d);
ENO:=DABINP_U(EN,s,d);
Operand Description Range Data type Data type (label)
(s) ASCII data or the head device where the ASCII
data is stored
Character string ANYSTRING_SINGLE
(d) DABIN(P) Head device for storing the converted data 16-bit signed binary ANY16_S
DABIN(P)_U 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)
*1
(s)
(s)+1
(s)+2
b15 b0··· ···b7b8
b0···b15
(d)
ASCII code for the ten-thousands place
ASCII code for the hundreds place
ASCII code for ones place
ASCII code for sign
ASCII code for the thousands place
ASCII code for the tens place
16-bit binary data
(s)
(s)+1
(s)+2
b15 b0··· ···b7b8
b0···b15
(d)
- 2 5108
32H (2)
31H (1)
38H (8)
2DH (-)
35H (5)
30H (0)