FB_CoE_DiagHistory_ReadAxis
The function block FB_ReadCoEDiagHistory_Axis is a variation of the function block FB_ReadCoEDiagHistory, which can be assigned an AXIS_REF structure instead of an address. Only messages that belong either to the device or to the specific axis are output (e.g. for an AX8206 dual-axis module).
Syntax
VAR_INPUT
sNetId : T_AmsNetId;
nSlaveAddr : UINT;
bEnable : BOOL;
bAck : BOOL;
tTimeout : TIME := DEFAULT_ADS_TIMEOUT;
tReadInterval : TIME := T#10S;
stOptions : ST_CoE_DiagHistory_Options;
END_VAR
VAR_IN_OUT
aDiagHistory : ARRAY[*] OF ST_CoE_DiagHistoryEntry;
END_VAR
VAR_INPUT
refAxis : REFERNCE TO AXIS_REF;
END_VAR
VAR_OUTPUT
bBusy : BOOL;
bValid : BOOL;
bError : BOOL;
hrErrorCode : HRESULT;
ipErrorMessage : I_TcMessage := fbResult;
stInfo : ST_CoE_DiagHistory_Info;
END_VAR
Inputs
Name | Type | Description |
---|---|---|
sNetId | T_AmsNetId | This input is not used and should not be assigned. |
nSlaveAddr | UINT | This input is not used and should not be assigned. |
bEnable | BOOL | Pulse: the Diag History is read out once. With each new edge, everything is reset first. The connection is then re-established and the slave is read. |
bAck | BOOL | All messages are acknowledged when bAck is triggered. |
tTimeout | TIME | Timeout for the respective ADS reads/writes in the function block. The default is the ADS timeout of five seconds. |
tReadInterval | TIME | Time interval between repeated reading of the slave with a permanent "bEnable" signal. The default is a time interval of 10 seconds. |
stOptions | Controls for handling CoE Diag History | |
refAxis | REFERNCE TO AXIS_REF | AXIS_REF of an axis, from which the address of the corresponding slave can be determined. |
Inputs/outputs
Name | Type | Description |
---|---|---|
aDiagHistory | ARRAY[*] OF ST_CoE_DiagHistory_Entry | An array of any length from ST_CoE_DiagHistory_Entry is assigned to this In-Out variable. The FB automatically adapts to the length of the array. If it is too short, older messages in the slave's Diag History Object are ignored. If it is too long, superfluous entries are deleted. A length greater than 250 makes no sense here, as the ETG standard defines a maximum of 250 messages for the Diag History Object. |
Outputs
Name | Type | Description |
---|---|---|
bBusy | BOOL | Simple busy signal, indicates that the function block is reading a slave. |
bValid | BOOL | The Diag History Object has been successfully read and the messages issued are valid. |
bError | BOOL | Becomes TRUE as soon as an error situation occurs. |
hrErrorCode | HRESULT | Returns an error code if the bError output is set. |
ipErrorMessage | I_TcMessage | Returns detailed information if a bError output is set. The interface pointer used here is always valid (not equal to zero) and is of the type I_TcMessage. In particular, the corresponding error is immediately visible as plain text in the PLC OnlineView. |
stInfo | Provides information from the read EtherCAT Slave Diag History Object. This includes, among other things, the Buffer Mode used and information on the available messages. This output is only updated after a successful read operation. |
Requirements
TwinCAT version | Hardware | Libraries to be integrated |
---|---|---|
TwinCAT 3.1 >= Build 4024.57 | x86, x64, ARM | Tc3_EtherCATDiag |