244
6 BASIC INSTRUCTIONS
6.5 Data Conversion Instructions
Converting binary data to BCD 8-digit data
DBCD(P)
These instructions convert the binary data in the device specified by (s) to BCD data, and store the converted data in the
device specified by (d).
Binary data is used in operations in CPU module. Use this instruction to display numeric values on seven-segment display
unit equipped with BCD decoder.
■Descriptions, ranges, and data types
■Applicable devices
• These instructions convert 32-bit binary data (0 to 99999999) in device specified by (s) to BCD 8-digit data, and store the
converted data in the device specified by (d).
• Data specified by (s) can be converted if it is within the range from K0 to K99999999 BDC (decimal).
• The table below shows nibble specification for the data in the device specified by (s) and (d).
Ladder diagram Structured text
ENO:=DBCD(EN,s,d);
ENO:=DBCDP(EN,s,d);
Operand Description Range Data type Data type (label)
(s) Binary data or the head device where the binary data is
stored
0 to 99999999 32-bit signed binary ANY32
(d) Head device for storing the BCD data BCD 8-digit ANY32
Operand Bit Word Double word Indirect
specification
Constant Others
X, Y, M, L,
SM, F, B, SB
U\G T, ST,
C, LC
T, ST, C, D,
W, SD, SW, R
U\G Z LC LZ K, H E $
(s)
(d)
(s)
(d)
0
BIN 99999999
0
0 0 0 1 0 1 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1
0
BCD 99999999
1
0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
4
8 218421842184218421842184218421
×10
7
×10
6
×10
5
×10
4
×10
3
×10
2
×10
1
×10
0
2
31
2
30
2
29
2
28
2
27
2
26
2
25
2
24
2
23
2
22
2
21
2
20
2
19
2
18
2
17
2
16
2
15
2
14
2
13
2
12
2
11
2
10
2
9
2
8
2
7
2
6
2
5
2
4
2
3
2
2
2
1
2
0
(s)+1 (Upper 16 bits) (s) (Lower 16 bits)
(d)+1 (Upper 4 digits) (d) (Lower 4 digits)
Ten-millions
place
Millions
place
Hundred-
thousands place
Ten-thousands
place
Thousands
place
Hundreds
place
Tens place Ones place
Make sure to set them to "0".
(Upper 5 bits)
BCD conversion
DBCD
(s)
(d)
BIN
BCD
Command
input
When "K8Y0" is specified
Y34 to
Y37
Y30 to
Y33
Y24 to
Y27
Y20 to
Y23
Y14 to
Y17
Y10 to
Y13
Y4 to
Y7
Y0 to
Y3
CPU module DBCD