FB_SoEAX5000SetMotorCtrlWord

FB_SoEAX5000SetMotorCtrlWord 1:

With the function block FB_SoEAX5000SetMotorCtrlWord the ForceLock bit (Bit 0) or the ForceUnlock bit can be set in the Motor Control Word (P-0-0096) to activate or release the brake. Normally the brake is automatically controlled via the Enable of the drive.

With the ForceLock bit, the brake can be activated independently from the Enable, with the ForceUnlock bit, the brake can be released independently from the Enable. In the case of simultaneously set ForceLock and ForceUnlock, ForceLock (Brake activated) has the higher priority.

FB_SoEAX5000SetMotorCtrlWord 2: Inputs

VAR_INPUT
    sNetId       : T_AmsNetId := '';
    bExecute     : BOOL; 
    tTimeout     : TIME := DEFAULT_ADS_TIMEOUT;
    bForceLock   : BOOL;
    bForceUnlock : BOOL;
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.

bForceLock

BOOL

Activates the brake independently of the enable.

bForceUnlock

BOOL

Releases the brake independently of the enable.

FB_SoEAX5000SetMotorCtrlWord 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_SoEAX5000SetMotorCtrlWord 4: Outputs

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

Sample

fbSetMotorCtrlWord : FB_SoEAX5000SetMotorCtrlWord;
bSetMotorCtrlWord : BOOL;
bForceLock : BOOL;
bForceUnlock : BOOL;
(* NcAxis *)
NcToPlc AT %I* : NCTOPLC_AXIS_REF; 

IF bSetMotorCtrlWord THEN
   fbSetMotorCtrlWord(
     Axis := NcToPlc,
     bExecute := TRUE,
     tTimeout := DEFAULT_ADS_TIMEOUT,
     bForceLock := bForceLock,
     bForceUnlock:= bForceUnlock
   );
   IF NOT fbSetMotorCtrlWord.bBusy THEN
      fbSetMotorCtrlWord(Axis := NcToPlc, bExecute := FALSE);
      bSetMotorCtrlWord := FALSE;
   END_IF
END_IF