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

../../../../../../_images/plcopen.png

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

../../../../../../_images/MC_StepLimitSwitch_Ex1.png

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

../../../../../../_images/MC_StepLimitSwitch_Ex2.png
InOut:

Scope

Name

Type

Initial

Comment

Input

Execute

BOOL

Starts the function block at rising edge

Direction

MC_Homing_Direction

MC_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

MC_Homing_Edge

Sensor condition to finalize this function block:
  • MC_On = When sensor is ON.

  • MC_EdgeOn = When Off to On transition in sensor

Velocity

LREAL

[u/s] Value of the maximum velocity (not necessarily reached). Range: >0

Acceleration

LREAL

[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.

Deceleration

LREAL

[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.

TorqueLimit

LREAL

Not supported

TimeLimit

LREAL

[s] If the function block condition is not met in the TimeLimit, an error is issued. <=0: No time limit.

DistanceLimit

LREAL

[u] If the function block condition is not met within a DistanceLimit travel, an error is issued. <0: No distance limit.

BufferMode

MC_BufferMode

Not supported, default mcABORTING used

Output

Done

BOOL

Shows the status of the function block. Done = TRUE if the execution is finished

Busy

BOOL

The function block is not finished

Active

BOOL

Indicates that the function block has control on the axis

CommandAborted

BOOL

Command is aborted by another command from other PLCopen function block

Error

BOOL

Signals that error has occurred within function block

ErrorID

ERROR_ID

Error identification. For error details refer to Enumeration ERROR_ID

Specific Error numbers: + MC_TimeLimitExceeded + MC_DistanceLimitExceeded + MC_TorqueLimitExceeded

Inout

Axis

Axis_Ref

Reference to axis

Structure: