FB_HVACConvertEnum

FB_HVACConvertEnum 1:

Application

This function block converts an Enum into an integer value and vice versa. This conversion is particularly suitable for Enums that are used as VAR_IN_OUT variables on function blocks.

VAR_INPUT

pEnum           : UDINT;
udiLenEnum      : UDINT;
pInt            : UDINT;
udiLenInt       : UDINT;

pEnum: address of the Enum to be converted. The address is determined with the ADR operator.

udiLenEnum: number of bytes of which the data type Enum consists. The number is determined with the SIZEOF operator.

pInt: address of the integer variable to be converted. The address is determined with the ADR operator.

udiLenInt: number of bytes of which the data type Integer consists. The number is determined with the SIZEOF operator.

VAR_OUTPUT

bError          : BOOL;
eErrorCode      : E_HVACErrorCodes;

bError: this output indicates with a TRUE that there is an error. (The number of bytes of which the data types Integer or Enum consist is wrong.)

eErrorCode: returns the error number when the bError output is set. The following errors can occur in this function block: eHVACErrorCodes_Error_LEN_Int (43), eHVACErrorCodes_Error_LEN_Enum (44)

Application example

Download

Required library

TcHVAC.pro

TcHVAC.lib