-

TO_BCD_BYTE

Type Function
Description Converts an unsigned integer value into a binary coded decimal value (BCD value) of the data type BYTE.
The function is an overloaded function. It can operate on all unsigned input data types (UDINT, UINT, ULINT and USINT).
Parameters Input

IN

Output

OUT
Conversion rules

In a BCD BYTE, integer values between 0 and 99 can be stored. Each digit is represented by four bits. If the input value has more than 2 digits (exceeds the maximum value of the BCD BYTE), the function returns the maximum value 16#FF.

Error behavior Error behavior
Examples Examples in ST
Additional information EN/ENO behavior