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
    sNetId       : T_AmsNetId := '';
    bExecute     : BOOL;
    tTimeout     : TIME := DEFAULT_ADS_TIMEOUT;
    piDiagNumber : POINTER TO ST_SoE_DiagNumList;
    iSize        : UDINT;
END_VAR

Name

Type

Description

sNetId

T_AmsNetId

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

bExecute

BOOL

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

tTimeout

TIME

Maximum time allowed for the execution of the function block.

piDiagNumber

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.

iSize

UDINT

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

FB_SoEReadDiagNumberList 3: Inputs/outputs

VAR_IN_OUT
    Axis : NCTOPLC_AXIS_REF;(* reference to NC axis *)
END_VAR

Name

Type

Description

Axis

NCTOPLC_AXIS_REF

Axis data structure of the type NCTOPLC_AXIS_REF

FB_SoEReadDiagNumberList 4: Outputs

VAR_OUTPUT
    bBusy        : BOOL;
    bError       : BOOL;
    iAdsErrId    : UINT;
    iSercosErrId : UINT;
    dwAttribute  : DWORD;
END_VAR

Name

Type

Description

bBusy

BOOL

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

bError

BOOL

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

iAdsErrId

UINT

Returns the ADS error code of the last executed command when the bError output is set.

iSercosErrId

UINT

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

dwAttribute

DWORD

Returns the attributes of the Sercos parameter.

Sample

fbDiagNumberList : FB_SoEReadDiagNumberList;
bDiagNumberList : BOOL;
stDiagNumberList : ST_SoE_DiagNumList;
(* NcAxis *)
NcToPlc AT %I* : NCTOPLC_AXIS_REF; 

IF bDiagNumberList THEN
 fbDiagNumberList(
    Axis := NcToPlc,
    bExecute := TRUE,
    tTimeout := DEFAULT_ADS_TIMEOUT,
    piDiagNumber:= ADR(stDiagNumberList),
    iSize := SIZEOF(stDiagNumberList),
 );
 IF NOT fbDiagNumberList.bBusy THEN
    fbDiagNumberList(Axis := NcToPlc, bExecute := FALSE);
    bDiagNumberList := FALSE;
 END_IF
END_IF