FB_CheckWatchdog

FB_CheckWatchdog 1:

Monitoring of a watchdog signal, which is transferred with the function block FB_WriteWatchdog.

The device to be monitored regularly sends a variable counter value to the device that is to monitor the transmission. The function block FB_CheckWatchdog is used there to monitor the state of the counter. If this does not change within a specific period, the bWatchdog output is set to TRUE. If a value of 0 s is specified for tWatchdogTime, the bWatchdog signal is set to FALSE. The period specified by tWachtdogTime should be a multiple (5-10 times) of the time in which the monitoring signal is transmitted.

VAR_INPUT

VAR_INPUT
    bEnable        :  BOOL := FALSE;
    tWatchdogTime  :  TIME := t#0s;
    nCnt           :  UDINT;
END_VAR

bEnable: Enable function block.

tWatchdogTime: Duration during which nCnt has to change.

nCnt: Current counter value of the watchdog signal.

VAR_OUTPUT

VAR_OUTPUT
    bWatchdog  : BOOL := FALSE;
    nLastCnt   : UDINT;
END_VAR

bWatchdog: FALSE indicates a valid monitoring signal. The output will become TRUE if no change is detected in nCnt during the period of time specified by tWatchdogTime.

nLastCnt: Most recent successfully transmitted counter state of the monitoring signal.

Requirements

Development environment

required TC3 PLC library

TwinCAT v3.0.0

Tc2_DataExchange