5 Applied Functions
5.1 Type Conversion Functions
120
FXCPU Structured Programming Manual
(Application Functions)
5.1.42 BCD_TO_DINT(_E)
Outline
This function converts BCD data into double word [signed] 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 BCD data stored in a device specified in
into double word [signed] data, and
outputs the data obtained by conversion to a device specified in
.
Cautions
Use the function having "_E" in its name to connect a bus.
Error
When the source data is not BCD (decimal number), M8067 (operation error) turns ON.
FX
3U(C)
FX
3G
FX
2N(C)
FX
1N(C)
FX
1S
FX
U
/FX
2C
FX
0N
FX
0(S)
Function name
Expression in each language
Structured ladder
ST
BCD_TO_DINT
BCD_TO_DINT(_BCD);
Example:
Label 2:=
BCD_TO_DINT(Label 1);
BCD_TO_DINT_E
BCD_TO_DINT_E(EN,_BCD,
Output label);
Example:
BCD_TO_DINT_E(X000, Label 1,
Label 2);
Variable
Description
Data type
Input
variable
EN
Execution condition
Bit
_BCD (
)
Conversion source BCD data
ANY_BIT
Output
variable
ENO
Execution status
Bit
*1
(
)
Double word [signed] data after conversion
Double Word [signed]
BCD_TO_DINT
_BCD
*1
Label 2
Label 1
BCD_TO_DINT_E
EN
ENO
*1
Label 2
X000
Label 1
_BCD
s
d
s
d
99999999H
99999999
ANY_BIT data
Double word [signed] data
10
7
10
6
10
5
10
4
10
3
10
2
10
1
10
0
Conversion into DINT data
Always becomes "0".
0 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
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 1 0 0 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
Ten-
millions
place
Millions
place
Hundred-
thousands
place
Ten-
thousands
place
Thousands
place
Hundreds
place
Tens
place
Ones
place
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
99999999H
99999999