FB_RegisterEvent - Functional Description

Overview

Type:

Function block

Available as of:

V1.0.0.0

Functional Description

The function block FB_RegisterEvent is used to register a callback to the IO-Link events. To update the callback assign the new value to i_ifIoLinkEvent and execute the function block again. A callback can contain up to 16 events. If more events will occur at the same time, these will be splitted to further callbacks.

NOTE: If the IO-Link master is connected by Sercos protocol, the Sercos state must be in state 4 and the outputs of the bus coupler enabled to initiate that which is required for the communication to the IO-Link master and devices and to use this function block.

Interface

Input

Data type

Description

i_xExecute

BOOL

On rising edge, process is started.

i_ifIoLinkEvent

IF_IoLinkEvent

IF_IoLinkEvent to be called in case an event is generated.

NOTE: Provide the IoLink master instance of type FB_IoLinkMaster specified inside the Devices tree.

Output

Data type

Description

q_xDone

BOOL

Indicates that the execution process has been completed successfully.

q_xBusy

BOOL

Indicates that the execution process is in progress.

q_xError

BOOL

If this output is set to TRUE, an error has been detected. For details, refer to q_etResult and q_etResultMsg.

q_etResult

ET_Result

Provides diagnostic and status information as a numeric value.

q_sResultMsg

STRING [80]

Provides additional diagnostic and status information as a text message.

Example

Following example indicates the registration of the function block instance fbCallback as callback to events generated by the IO-Link master and devices. You have to declare the function block FB_Callback inside the application and implement the interface SE_IoLink.IF_IoLinkEvent.

The instance of this function block can then be passed to the function block instance fbRegisterEvent. By executing the function block instance fbRegisterEvent the callback is registered.

In case a callback is generated, the method fbCallback.EventCallback is called by the system. Following example indicates the implementation of the EventCallback method to react on the generated events by the IO-Link device inserted into the first slot of the IO link master TM5SE4IOL.