FB_SoEReadDiagNumberList

FB_SoEReadDiagNumberList 1:

With the FB_SoEReadDiagNumberList function block a history of the diagnosis numbers can be read out as a list (S-0-0375).

FB_SoEReadDiagNumberList 2: Inputs

VAR_INPUT
    NetId       : T_AmsNetID := '';
    Execute     : BOOL;
    Timeout     : TIME := DEFAULT_ADS_TIMEOUT;
    pDiagNumber : POINTER TO ST_SoE_DiagNumList;
    Size        : UDINT;
END_VAR

Name

Type

Description

NetId

T_AmsNetID

String which contains the AMS Network ID of the PC (type: T_AmsNetId).

Execute

BOOL

The function block is enabled via a positive edge at this input.

Timeout

TIME

Maximum time allowed for the execution of the function block.

pDiagNumber

POINTER TO ST_SoE_DiagNumList

Pointer to the list of the last max. 30 error numbers. The list consists of the current and maximum number of bytes in the list as well as the 30 list items.

Size

UDINT

Size of the list in bytes (as Sizeof())

FB_SoEReadDiagNumberList 3: Inputs/outputs

VAR_IN_OUT
   Axis : AXIS_REF;
END_VAR

Name

Type

Description

Axis

AXIS_REF

Axis data structure that unambiguously addresses an axis in the system. Among other parameters it contains the current axis status, including position, velocity or error state.

FB_SoEReadDiagNumberList 4: Outputs

VAR_OUTPUT
    busy        : BOOL;
    Error       : BOOL;
    AdsErrId    : UINT;
    SercosErrId : UINT;
    Attribute   : DWORD;
END_VAR

Name

Type

Description

Busy

BOOL

This output is set when the function block is activated, and remains set until a feedback is received.

Error

BOOL

This output is set after the Busy output has been reset when an error occurs in the transmission of the command.

AdsErrId

UINT

In the case of a set Error output returns the ADS error code of the last executed command.

SercosErrId

UINT

In the case of a set Error output returns the Sercos error of the last executed command.

Attributes

DWORD

Returns the attributes of the Sercos parameter.

Sample

fbDiagNumberList : FB_SoEReadDiagNumberList;
DiagNumberList   : BOOL;
stDiagNumberList : ST_SoE_DiagNumList;
(* NcAxis *)
Axis             : AXIS_REF; 

IF DiagNumberList THEN
 fbDiagNumberList(
    Axis        := Axis,
    Execute     := TRUE,
    Timeout     := DEFAULT_ADS_TIMEOUT,
    pDiagNumber := ADR(stDiagNumberList),
    Size        := SIZEOF(stDiagNumberList),
 );
 IF NOT fbDiagNumberList.Busy THEN
    fbDiagNumberList(Axis := Axis, Execute := FALSE);
    DiagNumberList := FALSE;
 END_IF
END_IF