FB_SoEAX5000ReadActMainVoltage

FB_SoEAX5000ReadActMainVoltage 1:

The functionblock FB_SoEAX5000ReadActMainVoltage can be used to read the main voltage (P-0-0200) of the AX5000.

VAR_INPUT

VAR_INPUT
    sNetId  : T_AmsNetId := '';
    bExecute : BOOL;
    tTimeout : TIME := DEFAULT_ADS_TIMEOUT;
END_VAR

sNetId: A string containing the AMS network identifier of the PC.

bExecute: The block is activated by a rising edge at this input.

tTimeout: Maximum time allowed for the execution of the function block.

VAR_IN_OUT

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

Axis: Axis structure.

VAR_OUTPUT

VAR_OUTPUT
    bBusy              : BOOL;
    bError             : BOOL;
    iAdsErrId          : UINT;
    iSercosErrId       : UINT;
    dwAttribute        : DWORD;
    fActualMainVoltage : LREAL;
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.

iAdsErrId: Supplies the ADS error code associated with the most recently executed command if the bError output is set.

iSercosErrId: Supplies the Sercos error code associated with the most recently executed command if the bError output is set.

dwAttribute: Supplies the Sercos parameter attribute.

fActualMainVoltage: Supplies the main voltage of the AX5000 (i.e. 303.0 means 303.0V ).

Sample

fbReadActMainVoltage : FB_SoEAX5000ReadActMainVoltage;
bReadActMainVoltage  : BOOL;
fActualMainVoltage   : REAL;

(* NcAxis *)
stNcToPlc AT %I* : NCTOPLC_AXLESTRUCT;
IF bReadActMainVoltage THEN
    fbReadActMainVoltage(
        Axis     := stNcToPlc,
        bExecute := TRUE,
        tTimeout := DEFAULT_ADS_TIMEOUT,
        fActualMainVoltage=>fActualMainVoltage
    );
    IF NOT fbReadActMainVoltage.bBusy THEN
       fbReadActMainVoltage(Axis := stNcToPlc, bExecute := FALSE);
       bReadActMainVoltage := FALSE;
    END_IF
END_IF