FB_CX5020SetWatchdog
The function block FB_CX5020SetWatchdog activates a hardware watchdog on the CX5020. The watchdog is activated via bEnable = TRUE and the tTimeOut time. The tTimeOut time can be a minimum of 2 seconds and a maximum of 255 seconds.
Once the watchdog has been activated, the function block instance must be called cyclically at shorter intervals than tTimeOut, since the CX5020 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.
Notice | |
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 CX5020 would reboot immediately once tTimeOut has elapsed. |
Inputs
VAR_INPUT
tTimeOut : TIME;
bEnable : BOOL;
END_VAR
Name | Type | Description |
---|---|---|
tTimeOut | TIME | Watchdog time, after which a restart is performed. |
bEnable | BOOL | Activating/deactivating the watchdog. |
Outputs
VAR_OUTPUT
bEnabled : BOOL;
bError : BOOL;
END_VAR
Name | Type | Description |
---|---|---|
bEnabled | BOOL | TRUE = Watchdog is active, FALSE = Watchdog is not active. |
bError | BOOL | Error when activating or deactivating the watchdog. |
Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT v3.1.0 | CX (x86) | Tc2_SystemCX |