MC_StepLimitSwitch (FB)
FUNCTION_BLOCK MC_StepLimitSwitch
This function block performs a homing function by searching for sensor using only limit switches. A limit switch has one “Off” or “On” area.
The signal of the Limit Switches have to be written to the variables “limitSwitchPos” and “limitSwitchNeg” of the data type CMC_Axis_IO
Note
Inside the operation area the limit switches have to be logically FALSE and outside the borders the signal of the corresponding limit switch has to be logically TRUE. If needed the signal from the sensor must be inverted before it is connected to an element the AXIS_IO data type
- Example
In this case the limit switches (always active once moving part working area has been surpassed) are used for homing procedure.
The axis State is changed to Homing.
Home is commanded by user in the desired homing direction at the selected Velocity.
If LimitSwitch is found “On” on rising “Execute”, then the process is started in the opposite direction as specified, LimitSwitch is search for “Off” (or On depending in LimitSwitchMode setting) Edge (released), and process is restarted again in original direction. This ensures that the end conditions are always the same.
The time and distance limits can cause error if exceeded.
The direction changes only when the specified velocity is reached, this ensures acceleration and deceleration spaces are fixed.
This function block does not modify actual position.
This function block does not leave the Homing State when done.
This function block can only be used once for a homing sequence
- InOut:
Scope
Name
Type
Initial
Comment
Input
ExecuteBOOLStarts the function block at rising edge
DirectionMC_Positive
- Specifies the direction of the motion and corresponding LimitSwitch to search for, just MC_Positive and MC_Negative are possible:
MC_Positive = Positive direction searching positive LimitSwitch
MC_Negative = Negative direction searching negative LimitSwitch
SwitchMode- Sensor condition to finalize this function block:
MC_On = When sensor is ON.
MC_EdgeOn = When Off to On transition in sensor
VelocityLREAL[u/s] Value of the maximum velocity (not necessarily reached). Range: >0
AccelerationLREAL[u/s°°2] Value of the acceleration (increasing energy of the motor). Range: >0. If value = 0, Acceleration will be equal to parameter paraMaxAccelerationAppl.If value > 0 and <= 1,Acceleration will be limited to 1.
DecelerationLREAL[u/s°°2] Value of the deceleration (decreasing energy of the motor). Range: >0. If value = 0, Deceleration will be equal to parameter paraMaxAccelerationAppl.If value > 0 and <= 1,Deceleration will be limited to 1.
TorqueLimitLREALNot supported
TimeLimitLREAL[s] If the function block condition is not met in the TimeLimit, an error is issued. <=0: No time limit.
DistanceLimitLREAL[u] If the function block condition is not met within a DistanceLimit travel, an error is issued. <0: No distance limit.
BufferModeNot supported, default mcABORTING used
Output
DoneBOOLShows the status of the function block. Done = TRUE if the execution is finished
BusyBOOLThe function block is not finished
ActiveBOOLIndicates that the function block has control on the axis
CommandAbortedBOOLCommand is aborted by another command from other PLCopen function block
ErrorBOOLSignals that error has occurred within function block
ErrorID- Error identification. For error details refer to Enumeration ERROR_ID
Specific Error numbers: + MC_TimeLimitExceeded + MC_DistanceLimitExceeded + MC_TorqueLimitExceeded
Inout
AxisReference to axis
Structure: