7-191
BCDDA(P),DBCDDA(P)
1
2
3
4
6
6
7
8
7.11 Character string processing instructions
7.11.3
Conversion from BCD 4-digit and 8-digit to decimal ASCII data (BCDDA(P),DBCDDA(P))
Program Example
(1) The following program uses the PR instruction to convert BCD 4-digit data (the value at W0)
to decimal, and outputs it in ASCII format to Y40 to Y48.
[Ladder Mode] [List Mode]
[Operation]
Conducts ASCII output of Y40 to Y48 by using the PR instruction when X0 goes ON.
Because SM701 is OFF, The PR instruction will output ASCII code until 00
H is encountered.
(2) The following program uses the PR instruction to convert BCD 8-digit data (the values at
W10 and W11) to decimal, and outputs it in ASCII format to Y40 to 48.
[Ladder Mode] [List Mode]
[Operation]
Conducts ASCII output of Y40 to Y48 by using the PR instruction when X0 goes ON.
Because SM701 is OFF, The PR instruction will output ASCII code until 00
H is encountered.
Step Instruction Device
D1
D2
31
H
(1)32
H
(2)
39
H
(9)35
H
(5)
b15 b8b7 b0
00
H
D0
W0
BCD value
PR
Y40 to Y48
1
Outputs "1295"
29
5
Step Instruction Device
D1
D2
D3
33
H
(3)
35
H
(5)
34
H
(4)37
H
(7)
b15 b8b7 b0
38
H
(8)33
H
(3)
D0
35
H
(5)32
H
(2)
00
H
D4
3
W11
W10
PR
Y40 to Y48
Outputs "35478352"
5
4
7
83
5
2
BCD value