FB_EcGetSlaveCrcError
The function block FB_EcGetSlaveCrcError allows the CRC error counters of the individual ports (A, B and C) of a slave to be read. If the call is successful, the output variable crcError, whose type is ST_EcCrcError, contains the requested CRC error counter.
The function block FB_EcGetSlaveCrcError can only be used with slaves with up to 3 ports (i.e. EK1100), the function block FB_EcGetSlaveCrcErrorEx can also be used with slaves with up to 4 ports (i.e. EK1122).
VAR_INPUT
VAR_INPUT
sNetId : T_AmsNetId;
nSlaveAddr : UINT;
bExecute : BOOL;
tTimeout : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR
sNetId: This is a string that contains the AMS network identifier of the EtherCAT master device.
nSlaveAddr: Fixed address of the EtherCAT slave, whose CRC error counter should be read.
bExecute: The block is activated by a rising edge at this input.
tTimeout: Maximum time allowed for the execution of the function block.
VAR_OUTPUT
VAR_OUTPUT
bBusy : BOOL;
bError : BOOL;
nErrId : UDINT;
crcError : ST_EcCrcError;
END_VAR
bBusy: This output is set when the function block is activated and remains set until an acknowledgement is received.
bError: This output is set up after the bBusy output has been reset if there has been an error in transmission of the command.
nErrId: Supplies the ADS error code associated with the most recently executed command if the bError output is set.
crcError: CRC error counter of all ports.
Example of an implementation in ST:
PROGRAM TEST_GetSlaveCrcError
VAR
fbGetSlaveCrcError : FB_EcGetSlaveCrcError;
sNetId : T_AmsNetId := '172.16.2.131.2.1';
bExecute : BOOL;
crcError : ST_EcCrcError;
nSlaveAddr : UINT := 1001;
bError : BOOL;
nErrId : UDINT;
END_VAR
fbGetSlaveCrcError(sNetId:= sNetId, nSlaveAddr:= nSlaveAddr, bExecute:=bExecute);
crcError:=fbGetSlaveCrcError.crcError;
bError:=fbGetSlaveCrcError.bError;
nErrId:=fbGetSlaveCrcError.nErrId;
Requirements
Development environment | Target system type | PLC libraries to be linked |
---|---|---|
TwinCAT v2.10.0 or higher | PC or CX (x86) | TcEtherCAT.lib |
TwinCAT v2.10.0 Build >= 1301 or higher | CX (ARM) |