Setting the limit value for counters

This step shows you how to set a limit value in TwinCAT from which the counter value is automatically reset to zero. When counting upwards, the counter value is reset to zero when the limit value is reached. When counting downwards, the counter value is reset to the set limit value when zero is reached.

The counter value is a UDINT variable. The counter counts only in the positive range from 0 to 0xFFFF_FFFF (4294967295). If the value falls below zero, the counter is set to the maximum positive value. If it exceeds 4294967295, the counter is set to zero. The two variables Counter underflow or Counter overflow respectively indicate the overflow and are reset either on reaching 0x4000 in the positive direction or on reaching 0xFFFFC000 in a negative direction or if the corresponding other overflow has been reached.

Proceed as follows:

1. Click the CX7028 device on the left in the structure tree.
2. Click the CoE-Online tab.
Setting the limit value for counters 1:
3. Double-click the CoE object 8000:22 Counter reload value and set the limit value.
4. Then double-click the CoE object 8000:03 Enable reload and set the value to True.
Only when the CoE object 8000:03 Enable reload is set to True are the function and the defined limit value active.