FB_SoEAX5000SetMotorCtrlWord
The functionblock FB_SoEAX5000SetMotorCtrlWord can be used to set the ForceLock-Bit (Bit 0) or the ForceUnlock-Bit in the motor control word (P-0-0096), in order to set or release the brake. The brake is set and released automatically via the enable of the drive.
TheForceLock-Bit can be used to set the brake independent of the enable, the ForceUnlock-Bit can be used to release the brake independent of the enable. If ForceLock and ForceUnlock are set simultaneously then the ForceLock (brake locked) has the higher priority.
VAR_INPUT
VAR_INPUT
sNetId : T_AmsNetId := '';
bExecute : BOOL;
tTimeout : TIME := DEFAULT_ADS_TIMEOUT;
bForceLock : BOOL;
bForceUnlock : BOOL;
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.
bForceLock: Lock the brake independent of the enable.
bForceUnlock: Release (unlock) the brake independent of the enable.
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;
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.
Sample
fbSetMotorCtrlWord : FB_SoEAX5000SetMotorCtrlWord;
bSetMotorCtrlWord : BOOL;
bForceLock : BOOL;
bForceUnlock : BOOL;
(* NcAxis *)
stNcToPlc AT %I* : NCTOPLC_AXLESTRUCT;
IF bSetMotorCtrlWord THEN
fbSetMotorCtrlWord(
Axis := stNcToPlc,
bExecute := TRUE,
tTimeout := DEFAULT_ADS_TIMEOUT,
bForceLock := bForceLock,
bForceUnlock:= bForceUnlock
);
IF NOT fbSetMotorCtrlWord.bBusy THEN
fbSetMotorCtrlWord(Axis := stNcToPlc, bExecute := FALSE);
bSetMotorCtrlWord := FALSE;
END_IF
END_IF