Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4LabVIEW)  1.26.2
WatchdogLib
Collaboration diagram for WatchdogLib:

Modules

 Watchdog handling
 
 Version and Permission
 
 Structs, Types, ...
 

Detailed Description

Using the Watchdog library, you can establish a mechanism between your application and the firmware in order to react to exceptions or problems within your client program execution.

The following steps are necessary:

Here is some sample code:

// initialization of the watchdog (2 seconds).
// configure that the watchdog will fire a warning if it doesn't get triggered in time.
// starting the Watchdog
mlpiWatchdogStart(connection);
// enter main loop
printf("\nWatchdog active! Press any key to block watchdog reset or 'q' to quit.");
bool done = false;
while(!done)
{
// you may want to do some work here...
Sleep(1000);
// reset watchdog to prevent watchdog from triggering, do this every loop
mlpiWatchdogReset(connection);
// print current state of watchdog
mlpiWatchdogGetState(connection, &state);
switch(state)
{
printf("\nWATCHDOG_DISABLED");
break;
printf("\nWATCHDOG_ENABLED");
break;
printf("\nWATCHDOG_TIMEOUT");
break;
}
// on key press by user, delay and block reset of the watchdog --> simulate watchdog timeout
if (_kbhit())
{
char key = _getch();
if (key=='q'){
done = true;
}else{
printf("\nBlocking reset of Watchdog.");
Sleep(5000);
}
}
}
mlpiWatchdogStop(connection);
Note
The WatchdogLib functions trace their debug information mainly into module the MLPI_WATCHDOG_LIB and in addition into the module MLPI_BASE_MODULES. For further information, see also the detailed description of the library TraceLib.