FB_WriteWatchdog
Writing a watchdog signal to another ADS device (TwinCAT PLC, Bus Terminal Controller, ...).
The FB_WriteWatchdog() function block cyclically writes the contents of a 32-bit counter into another ADS device. The counter is incremented every time the transmission is successful. The FB_CheckWatchdog() function block can be used at the receiver to evaluate this signal. The receiver is addressed by means of the AMS-NetId and the port number (see also ADS Device Identification). The position within the receiver is specified by the index group/index offset or by the symbol name. Usually this is the input image or the flags area.
The period for tWachtdogTime should not be shorter than 1 second, to avoid transmitting the counter state too frequently. If 0 seconds is given for tWatchdogTime, the signal is not transmitted. Please also note the description of the FB_CheckWatchdog() block. If the bEnable input is set to FALSE, no further transmission of the watchdog signal is carried out.
VAR_INPUT
bEnable : BOOL := FALSE;
sNetId : T_AmsNetId;
nPort : T_AmsPort := AMSPORT_R0_PLC_RTS1;
nIdxGrp : UDINT;
nIdxOffs : UDINT;
sVarName : STRING;
tWatchdogTime : TIME := t#0s;
bSendNow : BOOL;
bEnable: Enable block. | sNetId: AMS-NetId of the ADS device to which the value is to be transmitted. | nPort: AMS- port number of the ADS device to which the value is to be transmitted. | nIdxGrp: Index group within the ADS device into which the value is to be transmitted. | nIdxOffs: Index offset within the ADS device into which the value is to be transmitted. | sVarName: Symbol name within the ADS device into which the value is to be transmitted. | tWatchdogTime: Cycle time with which the watchdog signal is to be transmitted. | bSendNow: The value is transmitted immediately in response to a rising edge. |
VAR_OUTPUT
bBusy : BOOL;
nLastCnt : UDINT;
bError : BOOL;
nErrorId : UDINT;
bBusy: Transmission is active. | nLastCnt: Most recently transmitted counter state. | bError: An error occurred during the transmission. | nErrorId: Error number if an error has occurred. | nErrorCnt: Number of transmission attempts that have returned faults. |
Requirements
Development environment | Target system | Required libraries |
---|---|---|
TwinCAT 2.11 R3/x64 | PC/CX, BX or BC | TcDataExchange-Bibliothek from V1.0.0 |