FB_WriteLRealOnDelta

FB_WriteLRealOnDelta 1:

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

The FB_WriteLRealOnDelta function block checks cyclically whether the value at the fSignal input 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 establishes that the current value is greater than the value fUpperLimit or lower than the value fLowerLimit, then the value of the signal is sent to the ADS device that is to be specified. 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 bEnable input is set to FALSE, no further signal transmission is carried out.

VAR_INPUT

VAR_INPUT
    bEnable          :  BOOL := FALSE;
    sNetId           :  T_AmsNetId;
    nPort            :  T_AmsPort;
    nIdxGrp          :  UDINT;
    nIdxOffs         :  UDINT;
    sVarName         :  STRING;
    fSignal          :  LREAL;
    fLowerLimit      :  LREAL;
    fUpperLimit      :  LREAL;
    tCycleTime       :  TIME := t#0s;
    bSendNow         :  BOOL;
END_VAR

bEnable: Enable function block.

sNetId: AMS NetID of the ADS device to which the value is to be transmitted. (Type T_AmsNetId)

nPort: AMS port number of the ADS device to which the value is to be transmitted. (T_AmsPort)

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.

fSignal: Variable whose value is to be transmitted.

fLowerLimit: Lower limit value.

fUpperLimit: Upper limit value.

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

bSendNow: The value is transmitted immediately in response to a positive edge.

VAR_OUTPUT

VAR_OUTPUT
    bBusy            :  BOOL := FALSE;
    fLastSignal      :  LREAL;
    bError           :  BOOL := FALSE;
    nErrorId         :  UDINT := 0;
    nErrorCnt        :  UDINT := 0;
END_VAR

bBusy: The transmission is active.

fLastSignal: Most recently transmitted value.

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

required TC3 PLC library

TwinCAT v3.0.0

Tc2_DataExchange