25 TYPE CONVERSION FUNCTIONS
25.23 Converting INT to BCD
1819
25
25.23 Converting INT to BCD
INT_TO_BCD(_E)
These functions convert a value from INT data type to BCD data type.
■Description, type, data type
■Operation processing
• These functions convert the value input to (s) from INT data type to BCD (WORD) data type, and output the converted
value from (d).
• Input an INT data type value to (s) within the range of 0 to 9999.
■Operation result
1. Function without EN/ENO
The operation processing is performed. The operation result is output from (d).
2. Function with EN/ENO
The execution conditions and operation results will be as follows.
*1 If the value FALSE is output from ENO, the output data from (d) will be undefined. Create a program so that the undefined value will not
be used in operations.
Ladder, FBD/LD Structured text
[Without EN/ENO] [With EN/ENO] [Without EN/ENO]
d:=INT_TO_BCD(s);
[With EN/ENO]
d:=INT_TO_BCD_E(EN,ENO,s);
Argument Description Type Data type
EN Execution condition (TRUE: Executed, FALSE: Not executed) Input variable BOOL
s (IN) Input Input variable INT
ENO Output status (TRUE: Normal, FALSE: Abnormal) Output variable BOOL
d Output Output variable WORD
(1) Set 0s.
Execution condition Operation result
EN ENO (d)
TRUE (executed) TRUE Operation result output value
FALSE (not executed) FALSE
*1
Undefined value
RnCPU
RnENCPU
RnSFCPU RnSFCPURnPCPURnPCPU
(Standard) (Safety)
(Redundant)
(Process)
EN ENO
ds
(s)
(d)
2
0
1
2
1
2
2
2
4
2
3
8124812481248
2
4
2
5
2
6
2
7
2
8
2
9
2
10
2
11
2
12
2
13
2
14
2
15
9999H
1
1
0
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
1
1
0
1
0
0
1
0
1
1
1
1
09999
9999H9999
ª10
0
ª10
1
ª10
2
ª10
3
(1)
BCD(WORD)INT