bcd_to_bin

PLCopen motion icon

 Function - Converts a Binary Coded Decimal (BCD) value to a binary value.

Inputs

Input

Data Type

Range

Unit

Default

Description

IN

DINT

 

 

 

Integer value in BCD.

Outputs

Output

Data Type

Range

Unit

Description

Q

DINT

 

 

Converts a Binary Coded Decimal (BCD) value to a binary value.

Value converted to integer or 0 (zero) if IN is not a valid positive BCD value.

Remarks

  • The input must:
    • Be positive.
    • Represent a valid BCD value.

Truth Table

IN

Q

-2

0 (invalid)

0

0

16 (16#10)

10

15 (16#0F)

0 (invalid)

FBD Language Example

FFLD Language Example

  • In the FFLD Language, the operation is executed only if the input rung (EN) is TRUE.
    • The output rung (ENO) keeps the same value as the input rung.

IL Language Example

  • In the IL Language, the input must be loaded in the current result before calling the function.
Op1: LD         IN
     BCD_TO_BIN
     ST         Q

ST Language Example

Q := BCD_TO_BIN (IN);

See Also

bin_to_bcd