ADSLOGEVENT

ADSLOGEVENT 1:

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

VAR_INPUT

VAR_INPUT
    NETID           : STRING(23); 
    PORT             : UINT;
    Event            : BOOL; 
    EventQuit        : BOOL; 
    EventConfigData  : TcEvent; 
    EventDataAddress : UDINT; 
    EventDataLength  : UDINT; 
    FbCleanup        : BOOL; 
    TMOUT            : TIME; 
END_VAR

NETID : Is a string containing the AMS network identifier of the target device to which the ADS command is directed.

PORT : Contains the port number of the ADS device. The TwinCAT Eventlogger has the port number 110.

Event : With a rising edge the "coming" of the event is signaled, with a falling edge the "going" of the event.  

EventQuit : With a rising edge the event is acknowledged.

EventConfigData : Data structure in the event parameters.

EventDataAddress : Address with the data, which sould be sent with the event.

EventDataLength : Length of the data, which should be sent with the event.

FbCleanup : At TRUE the function block is initialised completely.

TMOUT : States the time before the function is cancelled.

VAR_OUTPUT

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

EventState : State of the events.

ERR : This output is switched to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in ‘ErrorId’. If the block has a timeout error, ‘Error’ is TRUE and ‘ErrorId’ is 1861 (hexadecimal 0x745). Is reset to FALSE by the execution of a command at the inputs.

ERRID : Contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a command at the inputs.

Quit : The Event is acknowledged.

ADSLOGEVENT 2:

The picture above shows the fundamental construction. 

At non obligatory acknowledge messages, the event is reported with the rising edge at the event input of the function block and therewith active in the Eventlogger. The falling edge at the event input triggers the reset. With this signal the event is cancelled again in the Eventlogger.

At obligatory acknowledge messages the event is again activated wtih the rising edge at the event input. The event can be deactivated 

* with a falling edge at the event input (if before an acknowledgement signal has come from the PLC  with the quit input, or from the visualisation) or

* with a rising edge at the quit input ( if before a reset was released by a falling edge at the event input)

If a reset occurs between event activation and occurence of the acknowledgement, the next occurence of the event input is called "signal". Therewith a request is reported at already active event.

Stepwise flow:

After an event was sent to the Eventlogger, the Status of the event changes visibly at the eventstate output.

 

Example:

Configuration of the event:

ADSLOGEVENT 3:

Call FB ADSLOGEVENT:

ADSLOGEVENT 4:

Dowload sample

The sample consists of

 

Requirements

Development environment

Target system type

PLC libraires to include

TwinCAT v2.7.0

PC or CX (x86)

PLCEvent.Lib

TwinCAT v2.8.0

PC or CX (x86)

TcSystem.Lib

TwinCAT v2.10.0 Build >= 1301

CX (ARM)

TcSystem.Lib