FB_WriteWatchdog
Writing of 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 s is given for tWatchdogTime, the signal is not transmitted. Please also note the description of the function block FB_CheckWatchdog ().
If the input bEnable is set to FALSE, no further transfer of the watchdog signal takes place.
Inputs
VAR_INPUT
bEnable : BOOL := FALSE;
sNetId : T_AmsNetId;
nPort : T_AmsPort;
nIdxGrp : UDINT;
nIdxOffs : UDINT;
sVarName : STRING;
tWatchdogTime : TIME := t#0s;
bSendNow : BOOL;
END_VAR
Name | Type | Description |
---|---|---|
bEnable | BOOL | Enable function block. |
sNetId | T_AmsNetID | AMS NetID of the ADS device to which the watchdog signal is to be transmitted. |
nPort | T_AmsNetID | AMS port number of the ADS device to which the watchdog signal is to be transmitted. |
nIdxGrp | UDINT | Index group within the ADS device to which the watchdog signal is to be transmitted. |
nIdxOffs | UDINT | Index offset within the ADS device to which the watchdog signal is to be transmitted. |
sVarName | STRING | Symbol name within the ADS device to which the watchdog signal is to be transmitted. |
tWatchdogTime | TIME | Cycle time in which the watchdog signal is transmitted. |
bSendNow | BOOL | The watchdog signal is transmitted immediately by a positive edge. |
Outputs
VAR_OUTPUT
bBusy : BOOL := FALSE;
nLastCnt : UDINT := 0;
bError : BOOL := FALSE;
nErrorId : UDINT := 0;
END_VAR
Name | Type | Description |
---|---|---|
bBusy | BOOL | The transmission is active. |
nLastCnt
| BOOL | Most recently transmitted counter value. |
bError | BOOL | An error occurred during the transmission. |
nErrorId | UDINT | ADS error number if an error has occurred. |
Requirements
Development environment | required TC3 PLC library |
---|---|
TwinCAT v3.0.0 | Tc2_DataExchange |