FB_BA_GetBACnetAdapterTime

FB_BA_GetBACnetAdapterTime 1:

The function block can be used to determine the local BACnet system time of a TwinCAT system.

Internally, an internal software clock is implemented by means of the function block "RTC_EX2" (Extended Real Time Clock). This software clock is initialized with the BACnet system time and output by the two structures stDateTime and stTimeStruct.

The function block should be called in every PLC cycle, so that the current time can be calculated.

Illustration

FUNCTION_BLOCK FB_BA_GetBACnetAdapterTime
VAR_INPUT
     bTrig                      : BOOL;
     {attribute 'parameterUnit':= 'ms'}
     nTiAuto                    : UDINT;
END_VAR
VAR_OUTPUT
     bSuccess                   : BOOL;
     stDateTime                 : ST_BA_DateTime;
     stTimeStruct               : TIMESTRUCT;
     bError                     : BOOL;
END_VAR

FB_BA_GetBACnetAdapterTime 2: Inputs

Name

Type

Description

bTrig

BOOL

A rising edge at this input determines the local BACnet system time of a TwinCAT system.

nTiAuto

UDINT

Based on this time information, the local BACnet system time of a TwinCAT system is regularly determined automatically.

The time specification must be greater than or equal to 500ms.

FB_BA_GetBACnetAdapterTime 3: Outputs

Name

Type

Description

bSuccess

BOOL

The system time was read successfully from the target system. The variable is TRUE for one cycle.

stDateTime

ST_BA_DateTime

Current BACnet system time of a TwinCAT system.

stTimeStruct

TIMESTRUCT

Current BACnet system time of a TwinCAT system.

bError

BOOL

Error while reading the BACnet system time.

Requirements

Development environment

Required PLC library

TwinCAT from v3.1.4024.22

Tc3_BA2 from v5.2.5.0