5 - 18
Project name QB-13
Program name MAIN
5.2.3 BCD (P) BIN → BCD data conversion instruction
DS
X7 T0
T0
T0
K50
C10
K1500
X6
K2Y40
T037 BCD
K4Y50C10BCD
0
When the input condition is turned on, the data in the device specified in
S
is
recognized as a binary (BIN code), converted into a binary coded decimal
(BCD code), and transferred to the device specified in
D
.
D
S
1
9999
8000
4000 2000 1000
800
400 200 100 80 40 20 10 8 4 2 1
BCD
side
Thousand digits
0
0 1 1 0 0 1 1 0 0 1 1 0 0 1
Hundred digits Ten digits Unit digits
Converted into BCD.
0
9999
163848192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1
BIN
side
Must be set to "0".
0
1 0 0 1 1 1 0 0 0 0 1 1 1 1
The ordinary digital displays display numbers in the BCD code. Therefore, the
BCD instruction is required for displaying data of the programmable controller
(current values of timers and counters, data resister values of operation
results).
Y5F
8
Y5E
4
Y5D
2
Y5C
Y5B
8
Y5A
4
Y59
Y58
1
Y57
8
Y56
4
Y55
2
Y54
Y53
8
Y52
4
Y51
Y50
Digital display
+ 1
4
8
16
32
1213
0000010010111101
C10
(BIN)
K4Y50
16384
8192
4096
2048
1024
512
256
128
64
32
16
8
4
2
1
0001001000010011
(BCD)
128
1024
1)2)
1) 1)2)