BCD to Integer

Introduction

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

Function NameDescription
BYTE_BCD_TO_SINTConvert two BCD digits encoded in a BYTE to a small integer (SINT).
WORD_BCD_TO_INTConvert four BCD digits encoded in a WORD to an integer (INT).
DWORD_BCD_TO_DINTConvert eight BCD digits encoded in a DWORD to a double integer (DINT).
LWORD_BCD_TO_LINTConvert sixteen BCD digits encoded in a LWORD to a long integer (LINT).

Examples

The function call WORD_BCD_TO_INT( 16#1492 ) returns 1492.
In this example the bit pattern 0001 0100 1001 0010 is converted to 0000 0101 1101 0100.

Standards Compliance

Table 22.3 - IEC 61131-3 2nd Edition.

Table 22.3 - IEC 61131-3 3rd Edition.

Further Information

Integer to Binary Coded Decimal (BCD)

To learn about converting integers to BCD.

Conversion Functions

To learn about other conversion functions.

Glossary

For definitions of the terms used in Fernhill SCADA.