FB_EnOceanSTM250

FB_EnOceanSTM250 1:

The function-block FB_EnOceanSTM250() allows a user-friendly anaysis of the data sent by an EnOcean STM250-module. It gets its information from the receiver-unit FB_EnOceanReceive().

It is very important , that for every new EnOcean STM250-module a new instance of the FB_EnOceanSTM250 has to be programmed.

VAR_INPUT

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

bEnable: A positive signal at this input sets the function-block to the active-state. With a negative signal at the bEnable input the unit is without function and all outputs will be set to 0 or FALSE.

tWatchdog: Within this time the information at the input stEnOceanReceivedData has to be updated. The watchdog is disabled, if the entered time is set to t#0s.

nTransmitterId: The ID of the EnOcean-Transmitter, the function-block is assigned to.

stEnOceanReceivedData: Raw-information and therefore neccessary connection to the EnOcean receive function block FB_EnOceanReceive(). This information is assemled in a structure of the type ST_EnOceanReceivedData.

VAR_OUTPUT

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

bState: This output will be TRUE, if the contact of the Reed-relay on the STM250-transmitter-modul is activ (contact closed).

bLearn: This output will be FALSE, if the learn-button on the STM250-transmitter-modul is pressed.

bError: If the function-block is in an error-state, this output will be set to TRUE. This error is described by the variable nErrorId.

nErrorId: Type of error (see Errorcodes).

The following example should give some idea, how the function-block has to be used:

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 program one EnOcean STM250-modules with the ID 16#000000C4 is observed. The transmitter has its own instance of the function-block FB_EnOceanSTM250(). This unit is getting this information of the pre-posted receiver FB_EnOceanReceive() and is only active (Input bEnable), if the receiver is active and not in an error-state. The transmitter is observed by the watchdog-function, in this case the information has to be updated every hour. The resulting information is then assigned to variables for further usage in the program.