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), 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
NetId : T_AmsNetId := '';
Execute : BOOL;
Timeout : TIME := DEFAULT_ADS_TIMEOUT;
ForceLock : BOOL;
ForceUnlock : BOOL;
END_VAR
NetId: A string containing the AMS network identifier of the PC.
Execute: The block is activated by a rising edge at this input.
Timeout: Maximum time allowed for the execution of the function block.
ForceLock: Lock the brake independent of the enable.
ForceUnlock: Release (unlock) the brake independent of the enable.
VAR_IN_OUT
VAR_IN_OUT
Axis : AXIS_REF; (* Axis reference *)
END_VAR
Axis: Axis structure (see TcMC2.lib).
VAR_OUTPUT
VAR_OUTPUT
Busy : BOOL;
Error : BOOL;
AdsErrId : UINT;
SercosErrId : UINT;
END_VAR
Busy: This output is set when the function block is activated and remains set until an acknowledgement is received.
Error: This output is set up after the bBusy output has been reset if there has been an error in transmission of the command.
AdsErrId: Supplies the ADS error code associated with the most recently executed command if the Error output is set.
SercosErrId: Supplies the Sercos error code associated with the most recently executed command if the Error output is set.
Sample
fbSetMotorCtrlWord : FB_SoEAX5000SetMotorCtrlWord;
SetMotorCtrlWord : BOOL;
ForceLock : BOOL;
ForceUnlock : BOOL;
(* NcAxis *)
Axis : AXIS_REF;
IF SetMotorCtrlWord THEN
fbSetMotorCtrlWord(
Axis := Axis,
Execute := TRUE,
Timeout := DEFAULT_ADS_TIMEOUT,
ForceLock := ForceLock,
ForceUnlock:= ForceUnlock
);
IF NOT fbSetMotorCtrlWord.Busy THEN
fbSetMotorCtrlWord(Axis:= Axis, Execute := FALSE);
SetMotorCtrlWord :=FALSE;
END_IF
END_IF