ADSLOGEVENT

ADSLOGEVENT 1:

The function block permits the sending and the acknowledgement of messages to the TwinCAT EventLogger.

ADSLOGEVENT 2: Inputs

VAR_INPUT
    NETID             : T_AmsNetId;
    PORT              : T_AmsPort;
    Event             : BOOL;
    EventQuit         : BOOL;
    EventConfigData   : TcEvent;
    EventDataAddress  : PVOID;
    EventDataLength   : UDINT;
    FbCleanup         : BOOL;
    TMOUT             : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR

Name

Type

Description

NETID

T_AmsNetId

String containing the AMS network ID of the target device to which the ADS command is addressed (type: T_AmsNetId).

PORT

T_AmsPort

Port number of the ADS device. The TwinCAT EventLogger has the port number 110 (type: T_AmsPort).

Event

BOOL

The "coming" of the event is signaled with the rising edge, the "going" of the event with the falling edge.

EventQuit

BOOL

The event is acknowledged with the rising edge.

EventConfig
Data

TcEvent

Data structure with the event parameters (type: TcEvent).

EventData
Address

PVOID

Address with the data to be sent with the event.

EventData
Length

UDINT

Length of the data to be sent with the event.

FbCleanup

BOOL

If TRUE, the function block is completely initialized.

TMOUT

TIME

Indicates the time before the function is canceled.

ADSLOGEVENT 3: Outputs

VAR_OUTPUT
    EventState : UDINT;
    Err        : BOOL;
    ErrId      : UDINT;
    Quit       : BOOL;
END_VAR

Name

Type

Description

EventState

UDINT

State of the event.

Err

BOOL

This output is switched to TRUE as soon as an error occurs during the execution of a command. The command-specific error code is contained in ErrId. If the function block has a timeout error, Err is TRUE and ErrId is 1861 (hexadecimal 0x745). Is reset to FALSE by the execution of a command at the inputs.

ErrId

UDINT

ADS error code or command-specific error code of the last executed command. Is reset to 0 by the execution of a command at the inputs.

Quit

BOOL

Acknowledges the event.

Acknowledge messages

ADSLOGEVENT 4:

The upper figure represents the general sequence.

In the case of messages not requiring acknowledgment, the event is announced with the rising edge at the event input of the function block and is thus active in the EventLogger. The falling edge at the event input initiates the reset. This signal deletes the event in the EventLogger again.

In the case of messages requiring acknowledgment, the event is activated again with the rising edge at the event input. The event is deactivated either

If there is a reset of the event between event activation and the arrival of the acknowledgement, the next arrival of the event input is called "signal". A request is thus announced in case of already active events.

Example for the use of the ADSLOGEVENT function block in ST:

Requirements

Development environment

Target system type

PLC libraries to include (Category group)

TwinCAT v3.1.0

PC or CX (x86, x64, ARM)

Tc2_System (System)