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.
- When BCDDA instruction is used, the data designated by (S) is out of range of 0 to 9999. (Error code: 34)
- When DBCDDA instruction is used, the data designated by (S) is out of range of 0 to 99999999. (Error code: 34)
- The range of the device designated by (D) exceeds the relevant device range. (Error code: 82)
Program example
The following program converts the BCD 4-digit data (W0 value) to ASCII and stores the result at D0 to D2.
[Ladder mode]
SM400
0
5
The following program converts the BCD 8-digit data (W10 and W11 value) to ASCII and stores the result at D0 to D4.
[Ladder mode]
SM400
0
5
RST SM701
BCDDAP W0 D0
END
[Operation]
W0
D0
1
2
9
5
D1
BCD value
D2
RST SM701
DBCDDAP W10 D0
END
[Operation]
W11
W10
D0
3 5 4 7 8 3 5 2
D1
BCD value
D2
D3
D4
[List mode]
Steps
Inst.
Device
0
LD
SM400
1
RST
SM701
2
BCDDAP
W0
D0
5
END
b15
b8b7
b0
32H(2)
31H(1)
35H(5)
39H(9)
00H
[List mode]
Steps
Inst.
Device
0
LD
SM400
1
RST
SM701
2
DBCDDAP W10
D0
5
END
b15
b8b7
b0
35H(5)
33H(3)
37H(7)
34H(4)
33H(3)
38H(8)
32H(2)
35H(5)
00H
319
IB-1501667-B