15 TYPE CONVERSION FUNCTIONS
15.29 Converting DINT to BCD
723
15
15.29 Converting DINT to BCD
DINT_TO_BCD(_E)
These functions convert DINT type data to BCD type data.
â– Descriptions, types, and data types
â– Operation processing
• These functions convert the DINT type data input to (s) to BCD type data and output from (d).
• A value input to (s) is the DINT type data value. When (d) is WORD, the input value is within the range from 0 to 9999.
When (d) is DWORD, the input value is within the range from 0 to 99999999.
• WORD or DWORD can be specified to (d). BOOL cannot be specified.
Ladder diagram Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=DINT_TO_BCD(s);
[With EN/ENO]
d:=DINT_TO_BCD_E(EN,ENO,s);
Argument Description Type Data type
EN Execution condition (TRUE: Execution, FALSE: Stop) Input variable BOOL
s Input Input variable DINT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d Output Output variable ANY_BIT
DINT
Tens place Ones place
99999999
BCD
99999999H
99999999 11010111110100000 110000011111111
11001100110011001
8
4
2
1
8
4
2
1
001100110011001
99999999H
Conversion to Binary Coded Decimal
Make sure to set them to "0".
×10
7
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
×10
6
8
4
2
1
×10
5
8
4
2
1
×10
4
8
4
2
1
×10
3
8
4
2
1
×10
2
8
4
2
1
×10
1
8
4
2
1
×10
0
(s) (d)
Ten-millions
place
Hundred-
thousands
place
Ten-
thousands
place
Thousands
place
Hundreds
place
Millions
place