F_CX1000SetWatchdog 1:

The function F_CX1000SetWatchdog activates a hardware watchdog on the CX1000. The watchdog is activated via bEnable = TRUE and the tTimeout time. The tTimeout time can be a minimum of several PLC task cycles (multiple of the call time of the function F_CX1000SetWatchdog) and a maximum of 65 s and 535 ms.

Once the watchdog has been activated, the function must be called cyclically at shorter intervals than tTimeOut, since the CX1000 restarts automatically when tTimeOut has elapsed. The watchdog can therefore be used to automatically reboot systems, which have entered an infinite loop or where the PLC has become stuck.

The watchdog can be deactivated via bEnable = FALSE or tTimeOut = 0.


The watchdog must be deactivated before breakpoints are used, before a PLC reset or an overall reset, before a TwinCAT stop, before switching to Config mode or before the configuration is activated, because otherwise the CX1000 would reboot immediately once the timeout has elapsed.

FUNCTION F_CX1000SetWatchdog: BOOL

    tTimeout : TIME;
    bEnable  : BOOL;

tTimeOut: Watchdog time, if expired a reboot is automatically executed.

bEnable: Activate or deactivate the watchdog.


Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.0

CX (x86)