FB_KL8528

FB_KL8528 1:
Function block FB_KL8528

Application

This function block is used to configure the KL8528, to read out the digital signals and to set the outputs/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 byDisCh switches the standard function of the LEDs off. The LEDs can now be switched independently of the digital input signal via the PLC with the variables byLEDGn or byLEDYe. Each LED can be changed individually here.

The respective output can be set to "TRUE" with byKBusOff in the event of a K-bus error (or PLC stopped) and switch position "auto". Bit 0..7 for the outputs 1..8. If the flag in byKBusOff is not set the output goes "FALSE" in the event of a K-bus error (or PLC stopped).

VAR_INPUT

bEn           : BOOL;
bExecCfg      : BOOL;
byDisCh       : BYTE;
byKBusOff     : BYTE;
byOut         : BYTE;
byLEDGn       : BYTE;
byLEDYe       : BYTE;
dwOpt         : DWORD;

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 byDisCh and byKBusOff are written to the terminals on a positive edge. bBusy goes TRUE. Note that the inputs/outputs are not updated during this time.

byDisCh: Configuration: Disablement of the standard function of the LEDs. The LEDs can be set by the PLC. Bit 0 = LED 1, ... , bit 7 = LED 8. 255dec (FFhex) deactivates the standard function of all LEDs. These can then be set from the PLC via byLEDGn or byLEDYe.

byKBusOff: Configuration: Reaction of the outputs in the event of a K-bus error. The respective output is set with bit 0 = output 1, ... , bit 7 =output 8 in the event of a K-bus error (or PLC stopped) provided that the switch is set to "auto".

byOut: Bit 0 = TRUE, ... , Bit 7 = TRUE sets the respective output, provided the switch is set to "auto". All outputs are set with 255dec (FFhex). The FB_KL85xx8BitToByte function block is available for preparing the signals for the graphic programming languages.

byLEDGn: Bit 0 = TRUE,..., bit 7 = TRUE sets the green LEDs, provided that the standard function of the LEDs has been disabled with byDisCh. All green LEDs are set with 255dec (FFhex). The FB_KL85xx8BitToByte function block is available for preparing the signals for the graphic programming languages.

byLEDYe: Bit 0 = TRUE,..., bit 7 = TRUE sets the yellow LEDs, provided that the standard function of the LEDs has been disabled with byDisCh. All yellow LEDs are set with 255dec (FFhex). The FB_KL85xx8BitToByte function block is available for preparing the signals for the graphic programming languages.

dwOpt: For future options.

VAR_OUTPUT

bBusy         : BOOL;
byStaSwiAuto  : BYTE;
byStatOut     : BYTE;
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.

byStaSwiAuto: Status of the "auto" switch. Bit 0 = switch 1, ... , bit 7 = switch 8. The FB_KL85xxByteTo8Bit function block is available for preparing the signals for the graphic programming languages.

byStatOut: Status of the digital output signals. Bit 0 = output 1, ... , bit 7 = output 8. The FB_KL85xxByteTo8Bit 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_KL8528InData;
stOutData     : ST_KL8528OutData;

ST_KL8528OutData ST_KL8528InData

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

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