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+3) is a value other than "30H" to "39H" and "41H" to "46H".
(Error code: 34)
- The range of the device designated by (S) exceeds the relevant device range. (Error code: 82)
Program example
The following program converts the 4-digit hexadecimal ASCII data set to D20 and D21 to a BIN value, and stores the
result of the conversion at D0.
[Ladder mode]
SM400
0
4
b15
D20
36H(6)
D21
46H(F)
The following program converts the 8-digit hexadecimal ASCII data set to D20 to D23 to a BIN value, and stores the result
of the conversion at D10 and D11.
[Ladder mode]
SM400
0
4
b15
b8b7
46H(F)
D20
D21
32H(2)
37H(7)
D22
D23
30H(0)
"4FD28750"
IB-1501667-B
HABINP D20 D0
END
[Operation]
b8b7
b0
41H(A)
33H(3)
Regarded as
A63FH (-22977 in
"A63F"
decimal value)
DHABINP D20 D0
END
[Operation]
b0
34H(4)
44H(D)
Regarded as 4FD28750H
38H(8)
(1339197264 in decimal
value)
35H(5)
[List mode]
Steps
Inst.
Device
0
LD
SM400
1
HABINP
D20
D0
4
END
D0
-22977
BIN value
[List mode]
Steps
Inst.
Device
0
LD
SM400
1
DHABINP D20
D0
4
END
D11
1339197264
326
D10
BIN value