F_CX9000SetWatchdog 1:

The function F_CX9000SetWatchdog activates a hardware watchdog on the CX9000. The watchdog is activated via bEnable = TRUE and the tTimeOut time. The tTimeOut time can be a maximum of 65 seconds and 535 milliseconds.

Once the watchdog has been activated, the function must be called cyclically at shorter intervals than tTimeOut, since the CX9000 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 = T#0s.


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 CX9000 would reboot immediately once tTimeOut has elapsed.

FUNCTION F_CX9000SetWatchdog: BOOL

    tTimeout : TIME;
    bEnable  : BOOL;

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

bEnable: Activate or deactivate the watchdog.


Development environment

Target system type

PLC libraries to include

TwinCAT v3.1.0