BCD_TO_DEC

BCD_TO_DEC 1:

The function block "BCD_TO_DEC" allows BCD numbers to be converted into decimal format. The BCD number to be converted is checked for admissibility of the values.

BCD_TO_DEC 2: Inputs

VAR_INPUT
  START  : BOOL;
  BIN    : BYTE;
END_VAR

Name

Type

Description

START

BOOL

The function block is activated by a positive edge at this input.

BIN

BYTE

The BCD number to be converted.

BCD_TO_DEC 3: Outputs

VAR_OUTPUT
    BUSY   : BOOL;
    ERR    : BOOL;
    ERRID  : UDINT;
    DOUT   : BYTE;
END_VAR

Name

Type

Description

BUSY

BOOL

This output is set at the start of the conversion procedure, and remains set until the conversion has been completed. Once the BUSY output has been reset, the decimal value is available at the DOUT output.

ERR

BOOL

This variable is set to TRUE if an error occurs.

ERRID

UDINT

Error code

DOUT

BYTE

The converted variable in decimal format is available at this output if the process is successful.

Error Codes:

Error code

Error descriptions

0

no error

0x000F

Unreliable value in the low nibble of the BCD number

0x00F0

Unreliable value in the high nibble of the BCD number

Requirements

Development environment

Target platform

PLC libraries to be integrated (category group)

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_Utilities (System)