boardWatchdog (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


boardWatchdog offers a software watchdog that can be used for detecting and recovering from problems in the running application.

The watchdog will monitor that it has been called within a certain time frame, and if this does not occur, the device will be restarted.

 

To ensure recovery in case of any problems in the application and/or the firmware, it is recommended to integrate the use of boardWatchdog() into any application. This will ensure that the device will reset if any problems should occur.

 

 

Input:

timeout : INT

 

The use of the timeout parameter is:

timeout >  0:

Start watchdog with the timeout specified in number of seconds.

timeout =  0:

Stop watchdog.

timeout = -1:

Reset watchdog.

Must be called with this parameter periodically and within the timeout period, or the device will restart.

 

Returns:

None

 

Declaration:

FUNCTION boardWatchdog;
VAR_INPUT
  timeout : INT := -1;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
  // Start Watchdog. This will restart the device if boardWatchdog() is not called within 10 seconds.
  boardWatchdog(timeout:=10);
 
BEGIN
  ...
  // Reset Watchdog
  boardWatchdog();
  ...
END;
 
END_PROGRAM;