Type
| Function |
Description
| Converts any BCD input value (binary-coded decimal number) into an output value of the connected unsigned integer data type."*" is a placeholder for the supported data types. The function is available
for the output data types USINT, UINT, UDINT and ULINT.The function is an overloaded function. It can operate on all BCD input data types (BYTE, WORD, DWORD and LWORD). |
Parameters
| Input
IN
Data type: | The function can process the BCD data types BYTE (BYTE_BCD), WORD (WORD_BCD), DWORD (DWORD_BCD) and LWORD (LWORD_BCD) at its input. |
Output
OUT
Data type: | The function is available for the output data types USINT, UINT, UDINT and ULINT. |
|
Conversion rules
| If an incorrect input value (outside the permissible value range 0 to 9) is connected or an overflow occurs, the maximum value is output. For example, the input values 16#0A (BYTE) or 16#0A23 (WORD) or 16#0A0B0A0B (DWORD) or 16#00000000110A0B (LWORD) result in the maximum output value (e.g., 4,294,967,295 for an UDINT output).
Note
In some cases it is not possible to differ whether the returned value is a correct value or the maximum value which is returned when a wrong BCD value is connected. If, for example, the input value WORD#255 is connected to the BCD_TO_USINT function, the function returns the correct value 255, the same value as the maximum USINT value / error indication value (see item above). |
|
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) |
Invalid hex character A-F | 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.
|