Y_AX_Home_LS
This function block combines the PLCopen function blocks
MC_StepLimitSwitch,
MC_MoveRelative, and
MC_SetPosition
to make a sequence that detects the limit switch, performs an offset move away from the limit, and sets a home position.
Parameters:
| * | Parameter | Data Type | Description | Default |
|---|---|---|---|---|
| VAR_IN_OUT | ||||
| B | Axis | AXIS_REF | Logical axis reference. This value can be located on the Configuration tab in the Hardware Configuration (logical axis number). | |
| VAR_INPUT | ||||
| B | Execute | BOOL | Upon the rising edge, all other function block inputs are read and the function is initiated. To modify an input, change the value and re-trigger the execute input. | FALSE |
| B | HomeData | Yt_AX_HomeStruct | User defined Data Type in the Axis Toolbox, contains all related homing parameters. | All zeros in structure |
| VAR_OUTPUT | ||||
| B | Busy | BOOL | Set high upon the rising edge of the Execute or Enable input, and reset when Done, CommandAborted, or Error is true. | |
| B | Done | BOOL | Set high when the commanded action has completed successfully. If another block takes control before the action is completed, the Done output will not be set. This output is reset when Execute goes low. | |
| B | CommandAborted | BOOL | Set high if motion is aborted by another motion command or MC_Stop. This output is cleared with the same behavior as the Done output. | |
| B | Error | BOOL | Set high if an error has occurred during the execution of the function block. This output is cleared when 'Execute' or 'Enable' goes low. | |
| E | ErrorID | UINT | If Error is true, this output provides the Error ID. This output is reset when 'Execute' or 'Enable' goes low. | |
Notes:
See
Yt_AX_HomeStruct for important details regarding the input data to this function block.
(** Copy & Paste, then search & replace the headings in the following section to speed the initialization of the homing data. **)
HomeStruct_ReplaceMe.AccDec:=LREAL#500.0;(* In User units /sec2 as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.ApproachDistanceLimit:=LREAL#500.0;(* In User units as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.ApproachTimeLimit:=LREAL#500.0;(* In seconds *)
HomeStruct_ReplaceMe.ApproachVelocity:=LREAL#500.0;(* In User units / sec as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.LimitBackOffDistance:=LREAL#0.0;(* In User units as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.CreepDistanceLimit:=LREAL#500.0;(* In User units as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.CreepTimeLimit:=LREAL#500.0;(* In seconds *)
HomeStruct_ReplaceMe.CreepVelocity:=LREAL#500.0;(* In User units / sec as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.Direction:=INT#0;(*MC_Direction#Positive_Direction; *)
HomeStruct_ReplaceMe.Offset:=LREAL#500.0;(* In User units as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.OffsetVelocity:=LREAL#500.0;(* In User units / sec as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.Position:=LREAL#500.0;(* In User units as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.SwitchMode:=INT#2;(*MC_SwitchMode#EdgeOn; *)
HomeStruct_ReplaceMe.TorqueLimit:=LREAL#500.0;(* In percentage of rated torque of the servo *)
HomeStruct_ReplaceMe.AccDec:=LREAL#500.0;(* In User units /sec2 as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.ApproachDistanceLimit:=LREAL#500.0;(* In User units as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.ApproachTimeLimit:=LREAL#500.0;(* In seconds *)
HomeStruct_ReplaceMe.ApproachVelocity:=LREAL#500.0;(* In User units / sec as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.LimitBackOffDistance:=LREAL#0.0;(* In User units as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.CreepDistanceLimit:=LREAL#500.0;(* In User units as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.CreepTimeLimit:=LREAL#500.0;(* In seconds *)
HomeStruct_ReplaceMe.CreepVelocity:=LREAL#500.0;(* In User units / sec as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.Direction:=INT#0;(*MC_Direction#Positive_Direction; *)
HomeStruct_ReplaceMe.Offset:=LREAL#500.0;(* In User units as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.OffsetVelocity:=LREAL#500.0;(* In User units / sec as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.Position:=LREAL#500.0;(* In User units as set in the Hardware Configuration *)
HomeStruct_ReplaceMe.SwitchMode:=INT#2;(*MC_SwitchMode#EdgeOn; *)
HomeStruct_ReplaceMe.TorqueLimit:=LREAL#500.0;(* In percentage of rated torque of the servo *)
The following diagram summarizes an example speed profile followed by the motor for
Y_AX_Home_LS
in the negative direction.
Error Description:
See the
Function Block ErrorID List.
Example:
Use a ST POU to initialize the data required for HomeData.
Power on the Axis and Enable the
Y_AX_Home_LS
Function Block.
The function block will perform the homing routine and Done = TRUE when the sequence is complete. The Logic Analyzer trace is shown for the homing sequence: