Type
| Function |
Description
| Converts an unsigned integer value into a binary coded decimal value (BCD value) of the data type LWORD. The function is an overloaded function. It can operate on all unsigned input data types (UDINT, UINT, ULINT and USINT). |
Parameters
| Input
IN
Data type: | The function can process the UDINT, UINT, ULINT and USINT unsigned integer values at its input. |
Output
OUT
|
Conversion rules
| In a BCD LWORD, integer values between 0 and 9999999999999999 can be stored. Each digit is represented by four bits. If the input value has more than 16 digits (exceeds the maximum value of the BCD LWORD), the function returns the maximum value 16#FFFFFFFFFFFFFFFF. |
Examples
| Examples in ST
out := TO_BCD_LWORD(USINT#14); (* results in 16#0000000000000014 *)
out := TO_BCD_LWORD(ULINT#9999999999999999); (* results in 16#9999999999999999 *)
out := TO_BCD_LWORD(ULINT#10000000000000000); (* results in 16#FFFFFFFFFFFFFFFF *)
|
Error behavior
| Error behavior
The following table shows the errors which may occur while executing the function and the value returned by the function in the corresponding error case.
Error case | Output value |
Overflow | LIMIT (maximum value) |
|
Additional information
| EN/ENO behavior
The POU is only executed if TRUE is applied to the EN input. If EN = FALSE, the POU is not executed and ENO = FALSE indicates the inactivity.
If any of the errors listed under "Error behavior" occurs while executing the function, ENO is set to FALSE.
|