FB_WriteDWordOnDelta

FB_WriteDWordOnDelta 1:

The function block enables event-driven writing of a variable of type DWORD.

The function block FB_WriteDWordOnDelta checks cyclically whether the value at the input nSignal has changed. The cycle time for checking is determined by the parameter tCycleTime. If 0 s is given for tCycleTime, the input signal is examined during every PLC cycle. If the comparison determines that the current value is greater by the value nUpperLimit or lower by the value nLowerLimit, the value of the signal is sent to the specified ADS device. 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.

If the input bEnable is set to FALSE, no further signal transmission is carried out.

FB_WriteDWordOnDelta 2: Inputs

VAR_INPUT
    bEnable          :  BOOL := FALSE;
    sNetId           :  T_AmsNetId;
    nPort            :  T_AmsPort;
    nIdxGrp          :  UDINT;
    nIdxOffs         :  UDINT;
    sVarName         :  STRING;
    nSignal          :  BYTE;
    nLowerLimit      :  BYTE;
    nUpperLimit      :  BYTE;
    tCycleTime       :  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 value is to be transmitted.

nPort

T_AmsNetID

AMS port number of the ADS device to which the value is to be transmitted.

nIdxGrp

UDINT

Index group within the ADS device into which the value is to be transmitted.

nIdxOffs

UDINT

Index offset within the ADS device into which the value is to be transmitted.

sVarName

STRING

Symbol name within the ADS device into which the value is to be transmitted.

nSignal

BYTE

Variable whose value is to be transmitted.

nLowerLimit

BYTE

Lower limit value.

nUpperLimit

BYTE

Upper limit value.

tCycleTime

TIME

Cycle time in which the input signal is checked to see whether it has exceeded the limit values.

bSendNow

BOOL

The value is transmitted immediately by a positive edge.

FB_WriteDWordOnDelta 3: Outputs

VAR_OUTPUT
    bBusy            :  BOOL := FALSE;
    nLastSignal      :  DWORD;
    bError           :  BOOL := FALSE;
    nErrorId         :  UDINT := 0;
    nErrorCnt        :  UDINT := 0;
END_VAR

Name

Type

Description

bBusy

BOOL

The transmission is active.

nLastSignal

DWORD

Most recently transmitted value.

bError

BOOL

An error occurred during the transmission.

nErrorId

UDINT

ADS error number if an error has occurred.

nErrorCnt

UDINT

Number of failed transmission attempts.

Requirements

Development environment

required TC3 PLC library

TwinCAT v3.0.0

Tc2_DataExchange