FB_AdsReadEvents

FB_AdsReadEvents 1:

The function block queries the active messages of the EventLogger via ADS and makes them available in the form of an array aEvents. To display the messages in the visualization element Event table, the array aEvents has to be entered in its property Message data array.

Messages with a text length less than or equal to 255 characters can be output in full at the output. Messages with a text length greater than 255 characters and less than or equal to 1023 characters are output with truncated text. Messages with a text length greater than 1023 characters cannot be output and the function block returns an error.

VAR_INPUT

VAR_INPUT
    sNetId             : T_AMSNetId;
    bReadEvents        : BOOL;
    nLanguageId        : DWORD;
    eDateAndTimeFormat : E_DateAndTimeFormat;
    tRefreshTime       : TIME
    tTimeout           : TIME
END_VAR

sNetId: AmsNetID of the device, from which the messages of the EventLogger are to be queried. If the messages are to be read locally, an empty string can be specified.

bReadEvents: The input can be used to enable reading of the messages. When the enable is reset, the error outputs (bError and nErrId) are also reset.

nLanguageId: (Language Id) Defines the language in which message texts are displayed.

eDateAndTimeFormat: Defines the timestamp format. The available options are:

tRefreshTime: Defines the time interval, after which the message query is repeated.

tTimeout: Defines the time interval, after which a timeout error is triggered.

VAR_OUTPUT

VAR_OUTPUT
    aEvents         : ARRAY[1..80] OF ST_ReadEvent;
    nNumberOfEvents : UDINT;
    bBusy           : BOOL;
    bDone           : BOOL;
    bError          : BOOL
    nErrorId        : UDINT;
END_VAR

aEvents: The function block uses this array to make the read messages available. The array can store a maximum of 80 messages. (see ST_ReadEvent)

nNumberOfEvents: Indicates how many messages are currently stored in the array aEvents.

bBusy: Indicates whether the function block is currently busy.

bDone: TRUE, if the function block is not busy at present, but has carried out at least one operation.

bError: Indicates whether an error has occurred.

nErrorId: Indicates the error ID.

Requirements

Development environment

Target platform

PLC libraries to be integrated (category group)

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_Utilities (System)