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: ADSTRANSMODE

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.

Comments

The transmission between the real-time and the ADS-DLL is buffered 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 values are 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

Too many read operations

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

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