FB_KL8519

FB_KL8519 1:
Function block FB_KL8519

Application

This function block is used to configure the KL8519, to read out the digital signals and to set the LEDs.

The function block must be called once per cycle.

The parameters are transferred to the terminal with a positive edge on bExecCfg.

The variable wDisCh switches the standard function of the LED off. The LEDs can now be switched independently of the digital input signal via the PLC with the variables wLEDGn or wLEDRd. Each LED can be changed individually here.

The variable wSetCol defines how the LED should light up when the input is occupied. If it is "0" the LED will be green, if "1" the LED will be red. If the input is not occupied the LED remains off.

The variable wInv inverts the behavior of the LED. If the input is "FALSE" the LED turns on, if "TRUE" the LED turns off.

The variable wBiCol can be used to switch between green and red. If the variable is "1" the LED is red if the input is "FALSE" and green if it is TRUE. This behavior can be inverted with the variable wInv.

The variable eKBusOff defines how the LEDs should behave in the event of a K-bus error (or PLC stopped), if these are controlled by the PLC. If the variable is "0" (eKL8519_WatchdogOff) the LEDs remain off, if it is "1" (eKL8519_Watchdog500ms) the last state of the LED is toggled every 500 ms and with "2" (Watchdog1000ms) it is toggled every second.

VAR_INPUT

bEn        : BOOL;
bExecCfg   : BOOL;
wDisCh     : WORD;
wSetCol    : WORD;
wInv       : WORD;
wBiCol     : WORD;
eKBusOff   : E_KL8519_KBusOffReact;
dwOpt      : DWORD;
wLEDGn     : WORD;
wLEDRd     : WORD;

bEn: The function block is enabled by setting bEn to TRUE in the PLC program. With bEn = FALSE the execution of the function block will be stopped and all outputs reset.

bExecCfg: The configurations wDisCh, wSetCol, wInv, wBiCol and eKBusOff are written to the terminals when a positive edge is detected. bBusy goes TRUE. Note that the inputs are not updated during this time.

wDisCh: Configuration: Disablement of the standard function of the LEDs. The LEDs can be set by the PLC. Bit 0 = LED 1, ... , bit 15 = LED 16. 65535dec (FFFFhex) deactivates the standard function of all LEDs. These can then be set from the PLC via wLEDGn or wLEDRd.

wSetCol: Configuration: Using this variable you can define the color for the status LEDs of the individual channels (0=green or 1=red). With 65535dec (FFFFhex) all LEDs turn red if the input is occupied.

wInv: Configuration: Using this variable you can invert the display of the status LEDs of the individual channels. The process data (input signals) transmitted to the PLC are not affected by this.

wBiCol: Configuration: Using this variable you can switch the display of the status LEDs of the individual channels between two colors. Input unoccupied - LED is red, input occupied - LED is green, or vice versa if wInv is active.

eKBusOff: Configuration: In the event of a K-bus error all LEDs that are set via the PLC turn off, unless this contains a value other than 00bin. In addition the standard function of the LED must have been disabled with wDisCh.

dwOpt: For future options.

wLEDGn: Bit 0 = TRUE,..., bit 15 =TRUE sets the green LEDs, provided that the standard function of the LED has been disabled with wDisCh. All green LEDs are set with 65535dec (FFFFhex). The FB_KL85xx16BitToWord function block is available for preparing the signals for the graphic programming languages.

wLEDRd: Bit 0 = TRUE,..., bit 15 =TRUE sets the red LEDs, provided that the standard function of the LED has been disabled with wDisCh. All red LEDs are set with 65535dec (FFFFhex). The FB_KL85xx16BitToWord function block is available for preparing the signals for the graphic programming languages.

VAR_OUTPUT

bBusy      : BOOL;
wStaIn     : WORD;
bErr       : BOOL;
udiErrID   : UDINT;

bBusy: bBusy is TRUE as long as the configuration is being written (start with bExecCfg). Note that the inputs are not updated during this time.

wStaIn: Status of the digital input signals. Bit 0 = input 1,…, bit 15 = input 16. The FB_KL85xxWordTo16Bit function block is available for preparing the signals for the graphic programming languages.

bErr: The bError output goes TRUE as soon as an error occurs. This error is described via the udiErrID variable.

udiErrID: In the event of an error the output issues an error code (see error codes). bError goes TRUE at the same time.

VAR_IN_OUT

stInData       : ST_KL8519InData;
stOutData      : ST_KL8519OutData;

stInData: Process image of the inputs (see ST_KL8519InData).

stOutData: Process image of the outputs (see ST_KL8519OutData).