FB_SoEReadClassXDiag
The function block FB_SoEReadClassXDiag can be used to read the actual Class 1 Diagnose (S-0-0011) ... Class 3 Diagnose (S-0-0013) as a WORD. There is a conversion function F_ConvWordToSTAX5000C1D for evaluation of the Class 1 Diagnose as a structure ST_AX5000_C1D. See Documentation of TcDrive.lib.
VAR_INPUT
VAR_INPUT
NetId : T_AmsNetId := '';
Execute : BOOL;
DiagClass : USINT:= 1; (* 1: C1D (S-0-0011) is default, 2: C2D (S-0-0012), 3: C3D (S-0-0013) *)
Timeout : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR
NetId: A string containing the AMS network identifier of the PC.
Execute: The block is activated by a rising edge at this input.
DiagClass: Selects which diagnose should be read. The diagnose info can be different with different drive vendors. Not always all diagnose parameters (C1D ... C3D) or all bits in these parameters are implementiert.
1: Error: Class 1 Diag (S-0-0011)
2: Warning: Class 2 Diag (S-0-0012)
3: Informationen: Class 3 Diag (S-0-0013)
Timeout: Maximum time allowed for the execution of the function block.
VAR_IN_OUT
VAR_IN_OUT
Axis : AXIS_REF; (* Axis reference *)
END_VAR
Axis: Axis structure (see TcMC2.lib).
VAR_OUTPUT
VAR_OUTPUT
Busy : BOOL;
Error : BOOL;
AdsErrId : UINT;
SercosErrId : UINT;
ClassXDiag : WORD;
Attribute : DWORD;
END_VAR
Busy: This output is set when the function block is activated and remains set until an acknowledgement is received.
Error: This output is set up after the bBusy output has been reset if there has been an error in transmission of the command.
AdsErrId: Supplies the ADS error code associated with the most recently executed command if the Error output is set.
SercosErrId: Supplies the Sercos error code associated with the most recently executed command if the Error output is set.
ClassXDiag: Supplies the class X diagnose.
Attribute: Supplies the Sercos parameter attribute.
Sample
fbClassXDiag : FB_SoEReadClassXDiag;
bClassXDiag : BOOL;
DiagClass : USINT := 1;
Class1Diag : WORD;
stAX5000C1D : ST_AX5000_C1D;
Class2Diag : WORD;
(* NcAxis *)
Axis : AXIS_REF;
IF bClassXDiag THEN
fbClassXDiag(
Axis := Axis,
Execute := TRUE,
DiagClass := DiagClass,
Timeout := DEFAULT_ADS_TIMEOUT
);
IF NOT fbClassXDiag.Busy THEN
fbClassXDiag(Axis := Axis, Execute := FALSE);
bClassXDiag := FALSE;
CASE
fbClassXDiag.DiagClass OF
1:
Class1Diag := fbClassXDiag.ClassXDiag;
stAX5000C1D := F_ConvWordToSTAX5000C1D(Class1Diag);
2:
Class2Diag := fbClassXDiag.ClassXDiag;
END_CASE
END_IF
END_IF