Integer to BCD


These functions convert from Binary Coded Decimal (BCD) to integer:

Function NameDescription
SINT_TO_BCD_BYTEConvert a small integer (SINT) to two BCD digits encoded in a BYTE.
INT_TO_BCD_WORDConvert an integer (INT) to four BCD digits encoded in a WORD.
DINT_TO_BCD_DWORDConvert a double integer (DINT) to eight BCD digits encoded in a DWORD.
LINT_TO_BCD_LWORDConvert a long integer (LINT) to sixteen BCD digits encoded in a LWORD.


The function call SINT_TO_BCD_BYTE( 69 ) returns 16#69.
In this example the bit pattern 0100 0101 is converted to 0110 1001.

Standards Compliance

Table 22.4 - IEC 61131-3 Second Edition.

Table 22.4 - IEC 61131-3 Third Edition.

Further Information

Binary Coded Decimal (BCD) to Integer

To learn about converting BCD to Integers.

Conversion Functions

To learn about other conversion functions.


For the meaning of terms used in Fernhill SCADA.