Configure user LEDs U1 and U2

Configure user LEDs U1 and U2 1:

The function block FB_SetLedColorEx_BAPI can be used to switch the user LEDs on industrial PCs and embedded PCs with BIOS API support. The LED color is switched via a rising edge at bExecute and the eNewColor parameter. For devices with a user LED, this is selected via nLedID = 0 (default value is 0). For devices with several user LEDs, the U1 LED is selected via nLedID = 1 or the U2 LED via nLedID = 2.

The LED can be switched off (eNewColor = eUsrLED_Off) or set to red (eNewColor = eUsrLED_Red), blue (eNewColor = eUsrLED_Blue) or green (eNewColor = eUsrLED_Green).

Configure user LEDs U1 and U2 2: Inputs

VAR_INPUT
    sNetID         : T_AmsNetID;
    nLedID         : USINT;
    eNewColor      : E_UsrLED_Color;
    bExecute       : BOOL;
    tTimeout       : TIME;
END_VAR

Name

Type

Description

sNetID

T_AmsNetID

AMS network ID of the device (empty string or local network ID) (type T_AmsNetId)

nLedID

USINT

For devices with several user LEDs, the U1 LED is selected via nLedID = 1 or the U2 LED via nLedID = 2. (Default value is 0)

eNewColor

E_UsrLED_Color

New LED color (type E_UsrLED_Color)

bExecute

BOOL

The command is executed with a rising edge. The input must be reset as soon as the function block is no longer active (bBusy=FALSE).

tTimeout

TIME

Time until the internal ADS communication is aborted.

Configure user LEDs U1 and U2 3: Outputs

VAR_OUTPUT
    bBusy    : BOOL;
    bError   : BOOL;
    nErrID   : UDINT;
END_VAR

Name

Type

Description

bBusy

BOOL

TRUE, as long as the function block is active.

bError

BOOL

TRUE if an error occurs during command execution.

nErrID

UDINT

Contains the ADS error code or the command-specific error code of the last executed command. Is reset to 0 by the execution of a command at the inputs.

Prerequisites

Development environment

Target platform

PLC libraries to be integrated (category group)

TwinCAT v3.1.0

PC or CX (x86, x64, Arm®)

Tc2_System (system) v3.6.1.0