AdsNotificationAttrib

This structure contains all the attributes for the definition of a notification.

typedef struct {
  ULONG cbLength;
  ADSTRANSMODE nTransMode;
  ULONG nMaxDelay;
  ULONG nCycleTime;
} AdsNotificationAttrib, *PAdsNotificationAttrib;

Elements

cbLength

Length of the data that is to be passed to the callback function.

nTransMode

ADSTRANS_SERVERCYCLE: The notification's callback function is invoked cyclically.

ADSTRANS_SERVERONCHA: The notification's callback function is only invoked when the value changes.

nMaxDelay

The notification's callback function is invoked at the latest when this time has elapsed. The unit is 100 ns.

nCycleTime

The ADS server checks whether the variable has changed after this time interval. The unit is 100 ns.

Remarks

The ADS DLL is buffered from the real time transmission by a FIFO. TwinCAT first writes every value that is to be transmitted by means of the callback function into the FIFO. If the buffer is full, or if the nMaxDelay time has elapsed, then the callback function is invoked for each entry. The nTransMode parameter affects this process as follows:

ADSTRANS_SERVERCYCLE
The value is written cyclically into the FIFO at intervals of nCycleTime. The smallest possible value for nCycleTime is the cycle time of the ADS server; for the PLC, this is the task cycle time. The cycle time can be handled in 1ms steps. If you enter a cycle time of 0 ms, then the value is written into the FIFO with every task cycle.

ADSTRANS_SERVERONCHA
A value is only written into the FIFO if it has changed. The real-time sampling is executed in the time given in nCycleTime. The cycle time can be handled in 1ms steps. If you enter 0 ms as the cycle time, the variable is written into the FIFO every time it changes.

Notice

Balance read operations

Too many read operations can load the system so heavily that the user interface becomes much slower.

AdsNotificationAttrib 1:

Using ADS Notifications

Folgen

    • Set the cycle time to the most appropriate values
    • Always close connections when they are no longer required.