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 00H 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 00H is encountered.
Step Instruction Device
D1
D2
31H (1)32H (2)
39H (9)35H (5)
b15 b8b7 b0
00H
D0
W0
BCD value
PR
Y40 to Y48
1
Outputs "1295"
295
Step Instruction Device
D1
D2
D3
33H (3)
35H (5)
34H (4)37H (7)
b15 b8b7 b0
38H (8)33H (3)
D0
35H (5)32H (2)
00H
D4
3
W11 W10 PR
Y40 to Y48
Outputs "35478352"
5478352
BCD value