5.1 Type Conversion Functions
5.1.13 Word (signed), double word (signed) type
→
BCD type conversion
5-41
5
APPLICATION
FUNCTIONS
INT_TO_BCD(_E),
DINT_TO_BCD(_E)
INT_TO_BCD(_E), DINT_TO_BCD(_E)
Operation Error
An operation error occurs when the value input exceeds 9999 or 99999999 respectively in
the execution of the INT_TO_BCD(_E) or DINT_TO_BCD(_E) function. (Error code: 4100)
Program Example
(1) The program which converts word (signed) type data input to into BCD type data, and
outputs the operation result from .
(a) Function without EN/ENO (INT_TO_BCD)
[Structured ladder]
[ST]
g_word1:= INT_TO_BCD(g_int1);
(b) Function with EN/ENO (INT_TO_BCD_E)
[Structured ladder]
[ST]
g_bool3 := INT_TO_BCD_E(g_bool1, g_int1, g_word1);
(2) The program which converts double word (signed) type data input to into BCD type data,
and outputs the operation result from .
(a) Function without EN/ENO (DINT_TO_BCD)
[Structured ladder]
[ST]
s_dword1:= DINT_TO_BCD(g_dint1);
s
d
s
d