FB_PcWatchdog

This functionality is only available on IPCs with the following mainboards: IP-4GVI63, CB1050, CB2050, CB3050, CB1051, CB2051, CB3051.

 

FB_PcWatchdog 1:

The function block FB_PcWatchdog enables a hardware watchdog on the PC. The watchdog is enabled via bEnable = TRUE and the timeout period. The timeout time can range between 1 and 255 seconds. The watchdog is enabled via bEnable = TRUE and tTimeOut >= 1 s.

Once the watchdog has been activated, the function block must be called cyclically at shorter intervals than tTimeOut, since the PC 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 disabled via bEnable = FALSE or tTimeOut = 0.

FB_PcWatchdog 2:

The watchdog must be disabled 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 enabled, because otherwise the PC would reboot immediately once the timeout has elapsed.

VAR_INPUT

VAR_INPUT
    tTimeOut        : TIME;
    bEnable     : BOOL;
END_VAR

tTimeOut: watchdog time, after which a restart is performed.

bEnable: error when enabling or disabling the watchdog.

VAR_OUTPUT

VAR_OUTPUT
    bEnabled        : BOOL;
    bBusy       : BOOL;
    bError      : BOOL;
    nErrId      : UDINT;
END_VAR

bEnabled  : TRUE enables the K-bus Watchdog, FALSE disables the K-bus Watchdog.

bBusy : this output remains TRUE until the function block has executed a command.

bError: this output is set to TRUE if an error occurs during the execution of a command. The command-specific error code is contained in 'nErrId'. Is reset to FALSE by the execution of a command at the inputs.

nErrId: contains the command-specific error code of the most recently executed command. Is reset to 0 by the execution of a command at the inputs.

 

Sample of calling the function block in ST:

VAR

    fbPcWatchDog  : FB_PcWatchdog;

    tWDTime       :
TIME := T#10s;

    bEnableWD     : BOOL;

    bWDActive     : BOOL;

END_VAR
IF bEnableWD OR bWDActive THEN

    fbPcWatchDog(tTimeOut := tWDTime, bEnable :=
bEnableWD);

    bWDActive := fbPcWatchDog.bEnabled;

END_IF


 

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v2.9.0 from Build 1004

PC with mainboards: IP-4GVI63, CB1050, CB2050, CB3050, CB1051, CB2051, CB3051

TcSystem.Lib