ADSLOGEVENT
This function block allows the sending and acknowledgment of messages to the TwinCAT EventLogger.
TwinCAT EventLogger vs. TwinCAT 3 EventLogger The TwinCAT EventLogger was replaced by the successor TwinCAT 3 EventLogger. The older TwinCAT EventLogger is supported by TwinCAT 3 up to version 3.1.4024. Newer TwinCAT versions (>= 3.1.4026.0) only support the newer TwinCAT 3 EventLogger. PLC function blocks for this can be found in the PLC library Tc3_EventLogger. |
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 | TcEvent | Data structure with the event parameters (type: TcEvent). |
EventData | PVOID | Address with the data to be sent with the event. |
EventData | 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. |
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
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
- by the falling edge at the event input (if an acknowledgment signal had previously come from the PLC with the Quit input or from the visualization) or
- by the rising edge at the Quit input (if a reset had previously been initiated by a falling edge at the event input).
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 platform | PLC libraries to be integrated (category group) |
---|---|---|
TwinCAT v3.1.0 | PC or CX (x86, x64, ARM) | Tc2_System (system) |