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.

FB_EnOceanSTM250 3: Inputs

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

Name

Type

Description

bEnable

BOOL

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

tWatchdog

TIME

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

nTransmitterId

UDINT

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

stEnOceanReceivedData

ST_EnOceanReceivedData

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

FB_EnOceanSTM250 4: Outputs

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

Name

Type

Description

bState

BOOL

When the reed contact on the STM250 module is activated, this output becomes TRUE (contact closed).

bLearn

BOOL

This output becomes FALSE if the learn button at the STM250 module is activated.

bError

BOOL

This output goes TRUE as soon as an error occurs. This error is described via the variable nErrorID.

nErrorId

UDINT

Describes the type of error.

The following sample program illustrates the operating principle of this function 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 sample 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 function block FB_EnOceanReceive and is only active (input bEnable) if the receive function block is active and not in error. The values output to the function block are assigned to variables for further evaluation.

Requirements

Development environment

required TC3 PLC library

TwinCAT v3.1.4020.14

Tc2_EnOcean from v3.3.5.0