FB_EnOceanSTM250

FB_EnOceanSTM250 1:

The function block FB_EnOceanSTM250() provides a user-friendly evaluation of the data of an EnOcean STM250 module. The function block FB_EnOceanReceive() is required for this purpose.

FB_EnOceanSTM250 2:

A new instance of this function block must be created for each STM100 module used.

VAR_INPUT

bEnable               : BOOL := FALSE;
tWatchdog             : TIME;
nTransmitterId        : UDINT;
stEnOceanReceivedData : ST_EnOceanReceivedData;

bEnable: A positive signal at this input activates the block. A negative signal at the input disables the block functionality, and all outputs are set to 0 or FALSE.

tWatchdog: Monitoring time. Within this time, new information must reach this block via the input stEnOceanReceivedData described below. If this time is set to t#0s, the watchdog function is inactive.

nTransmitterId: ID of the EnOcean module, to which the block should respond.

stEnOceanReceivedData: Information and required connection to the EnOcean receive block FB_EnOceanReceive(). This information is stored in a structure (see ST_EnOceanReceivedData).

VAR_OUTPUT

bState   : BOOL;
bLearn   : BOOL;
bError   : BOOL := FALSE;
nErrorId : UDINT := 0;

bState: Upon activation of the reed contact in the STM250 module, this output becomes TRUE (contact closed).

bLearn: This output becomes FALSE if the teach-in button at the STM250 module is activated.

bError: this output goes TRUE as soon as an error occurs. This error is described via the variable nErrorId.

nErrorId: Describes the error type (see error codes).

The following sample program illustrates the operating principle of this block:

PROGRAM MAIN
VAR
    fbEnOceanReceive : FB_EnOceanReceive;
    fbEnOceanSTM250 : FB_EnOceanSTM250;
    bState : BOOL;
    bLearn : BOOL;
END_VAR

fbEnOceanReceive(
    bEnable := TRUE,
    stEnOceanInData := stEnOceanInData,
    stEnOceanOutData := stEnOceanOutData);

fbEnOceanSTM250(
    bEnable := NOT fbEnOceanReceive.bError AND fbEnOceanReceive.bEnable,
    nTransmitterId := 16#000008CA,
    tWatchdog:=t#0s,
    stEnOceanReceivedData := fbEnOceanReceive.stEnOceanReceivedData
    bState => bState,
    bLearn => bLearn);

In this example program an STM250 module with the transmitter ID 16#000008CA is queried. To this end the function block FB_EnOceanSTM250 is created. This function blocks obtains its information from the upstream receive block FB_EnOceanReceive and is only active (input bEnable) if the receive block is active and not in error. The output values at the function blocks are assigned variables for further evaluation.

Requirements

Development environment

required TC3 PLC library

TwinCAT v3.1.4020.14

Tc2_EnOcean from v3.3.5.0