Incrementing Watchdog
medium
Raises an alarm when an incrementing heartbeat value stops changing for the configured timeout.
What it teaches
Monitor a heartbeat counter instead of a pulsing bit. Save the last value, reset the watchdog whenever a different value arrives, and alarm when the value stays unchanged for the timeout. Any change proves fresh data, so skipped counts and signed rollover remain valid.
Parameters
| Tag | Direction | Type | Default | Description |
|---|---|---|---|---|
| In_HeartbeatCount | Input | DINT | 0 | Heartbeat value incremented by the monitored controller |
| Cfg_Timeout | Input | DINT | 1000 | Maximum time without a new heartbeat value, in milliseconds |
| Sts_Alarm | Output | BOOL | 0 | 1 when the heartbeat value has stopped changing |
Required behavior
- Whenever In_HeartbeatCount differs from its saved previous value, save the new value and restart the timeout.
- If In_HeartbeatCount remains unchanged for Cfg_Timeout milliseconds, set Sts_Alarm to 1.
- Clear Sts_Alarm as soon as a different In_HeartbeatCount value arrives.
- Treat every changed value as a valid heartbeat, including skipped counts and signed DINT rollover.