M800V/M80V Series PLC Programming Manual (1/2)
8 Function Instructions
8.10 Character String Processing Instructions
Operation errors
In the following cases, an arithmetic error occurs, the error flag (SM0) turns ON, and an error code is stored at SD0.
- The ASCII code of each position designated by (S) to (S+5) is a value other than "30H" to "39H", "20H", and "00H".
(Error code: 34)
- The ASCII data designated by (S) to (S+5) is outside the following range. (Error code: 34)
- When DABIN instruction is used: -32768 to 32767
- When DDABIN instruction is used: -2147483648 to 2147483647
- The range of the device designated by (S) exceeds the relevant device range. (Error code: 82)
Program example
The following program converts the sign and 5-digit decimal ASCII data set to D20 to D22 to a BIN value, and stores the
result of the conversion at D0.
[Ladder mode]
SM400
0
4
b15
(space)
D20
20H
D21
32H(2)
D22
36H(6)
"-
276"
The following program converts the sign and 10-digit decimal ASCII data set to D20 to D25 to a BIN value, and stores the
result of the conversion at D10 to D11.
[Ladder mode]
SM400
0
4
b15
20H
(space)
D20
20H
(space)
D21
39H(9)
D22
D23
38H(8)
D24
37H(7)
D25
"
3968370"
DABINP D20 D0
END
[Operation]
b8b7
b0
2DH(-)
(space)
20H
37H(7)
DDABINP D20 D10
END
[Operation]
b8b7
b0
20H
(space)
20H
(space)
(Regarded as +0003968370)
33H(3)
36H(6)
33H(3)
30H(0)
[List mode]
Steps
Inst.
0
LD
1
DABINP
4
END
-276
(Regarded as -00276)
BIN value
[List mode]
Steps
Inst.
0
LD
1
DDABINP D20
4
END
323
Device
SM400
D20
D0
D0
Device
SM400
D10
D11
D10
3968370
BIN value
IB-1501667-B