5 Applied Functions
5.1 Type Conversion Functions
74
FXCPU Structured Programming Manual
(Application Functions)
5.1.20 DINT_TO_BCD(_E)
Outline
This function converts double word [signed] data into BCD data, and outputs the data obtained by conversion.
1. Format
*1. Output variable
2. Set data
In explanation of functions, I/O variables inside ( ) are described.
Explanation of function and operation
This function converts double word [signed] data stored in a device specified in into BCD data, and
outputs the data obtained by conversion to a device specified in .
Cautions
1) Use the function having "_E" in its name to connect a bus.
2) When handling 32-bit data in structured programs, you cannot specify 16-bit devices directly, different
from simple projects. Use labels when handling 32-bit data.
You can specify 32-bit counters directly, however, because they are 32-bit devices.
Use global labels when specifying labels.
FX3U(C) FX3G FX2N(C) FX1N(C) FX1S
FX
U
/FX
2C
FX0N FX0(S)
Function name
Expression in each language
Structured ladder ST
DINT_TO_BCD
DINT_TO_BCD(_DINT);
Example:
Label 2:=
DINT_TO_BCD(Label 1);
DINT_TO_BCD_E
DINT_TO_BCD_E(EN,_DINT,
Output label);
Example:
DINT_TO_BCD_E(X000, Label 1,
Label 2);
Variable Description Data type
Input
variable
EN Execution condition Bit
_DINT ( )
Conversion source double word [signed] data Double Word [signed]
Output
variable
ENO Execution status Bit
*1 ( )
BCD data after conversion ANY_BIT
DINT_TO_BCD
_DINT *1
Label 1 Label 2
DINT_TO_BCD_E
EN ENO
*1
Label 2
X000
Label 1
_DINT
s
d
s
d
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
8
4
2
1
2
16
2
17
2
18
2
19
2
20
2
21
2
22
2
23
2
24
2
25
2
26
2
27
2
28
2
29
2
30
2
31
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
1
0
0
1
1
0
0
11
0
0
1
1
0
0
1
99999999
99999999H
Double word [signed] data ANY_BIT data
99999999H
0
0
0
0
1
0
1
1
1
1
1
0
1
0
1
0
1
1
1
0
0
0
0
0
1
1
1
1
1
111
99999999
Ten-millions
place
Millions
place
Hundred-
thousands
place
Ten-
thousands
place
Thousands
place
Hundreds
place
Tens
place
Ones
place
10
7
10
6
10
5
10
4
10
3
10
2
10
1
Conversion into BCD data
Make sure to set them to "0".