BCD to Integer

Help Contents

Introduction

These functions convert from 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

  1. Convert BCD value 16#1492 to an integer:
    WORD_BCD_TO_INT( 16#1492 )

    The function call returns 1492. The bit pattern 0001 0100 1001 0010 is converted to 0000 0101 1101 0100.

Standards Compliance

IEC 61131-3 Second Edition: Table 22.3.

IEC 61131-3 Third Edition: Table 22.3.

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 the meaning of terms used in Fernhill SCADA.