MCFB_StepAbsSwitch
Description
This function block performs a homing function by searching for an absolute positioned external physical switch. (An Absolute Switch has two "Off" (or "On") areas.
The following figure shows the function block I/O:
Figure 7-209: MCFB StepAbsSwitch
Arguments
Input
Execute |
Description |
Request the homing step procedure at rising edgeA rising edge is the transition of a digital signal from low to high. It is also called positive edge. Outputs are reset when execute input is false. |
||||||||||||||
Data type |
BOOL |
|||||||||||||||
Range |
[0 , 1] |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
Default |
— |
|||||||||||||||
AxisID |
Description |
Name of a declared instance of the AXIS_REF library function |
||||||||||||||
Data type |
||||||||||||||||
Range |
[1 , 256] |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
Default |
— |
|||||||||||||||
Direction |
Description |
Define the axis homing direction
|
||||||||||||||
Data type |
DINT |
|||||||||||||||
Range |
[0 , 3] |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
Default |
— |
|||||||||||||||
SwitchMode |
Description |
Switch state to complete homing
|
||||||||||||||
Data type |
DINT |
|||||||||||||||
Range |
[0 , 3] |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
Default |
— |
|||||||||||||||
Velocity |
Description |
Commanded velocity for the homing move |
||||||||||||||
Data type |
LREAL |
|||||||||||||||
Range |
— |
|||||||||||||||
Unit |
User unit/sec |
|||||||||||||||
Default |
— |
|||||||||||||||
Acceleration |
Description |
Commanded acceleration for the homing move |
||||||||||||||
Data type |
LREAL |
|||||||||||||||
Range |
— |
|||||||||||||||
Unit |
User unit/sec2 |
|||||||||||||||
Default |
— |
|||||||||||||||
Deceleration |
Description |
Commanded deceleration for the homing move |
||||||||||||||
Data type |
LREAL |
|||||||||||||||
Range |
— |
|||||||||||||||
Unit |
User unit/sec2 |
|||||||||||||||
Default |
— |
|||||||||||||||
Description |
Commanded jerkIn physics, jerk is the rate of change of acceleration; more precisely, the derivative of acceleration with respect to time for the homing move (if zero, then trapezoidal acc/dec is used) |
|||||||||||||||
Data type |
LREAL |
|||||||||||||||
Range |
— |
|||||||||||||||
Unit |
User unit/sec3 |
|||||||||||||||
Default |
— |
|||||||||||||||
TorqueLimit |
Description |
Maximum torqueTorque is the tendency of a force to rotate an object about an axis. Just as a force is a push or a pull, a torque can be thought of as a twist applied for the homing move entered in thousandths of maximum torque, e.g. "250" is 250/1000, or 25%. |
||||||||||||||
Data type |
LREAL |
|||||||||||||||
Range |
— |
|||||||||||||||
Unit |
User unit |
|||||||||||||||
Default |
— |
|||||||||||||||
TimeLimit |
Description |
Maximum time for homing move to complete. If exceeded the homing procedure will error out. 0= no time limit |
||||||||||||||
Data type |
TIME |
|||||||||||||||
Range |
— |
|||||||||||||||
Unit |
sec |
|||||||||||||||
Default |
— |
|||||||||||||||
DistanceLimit |
Description |
Maximum distance for homing move to complete. If exceeded the homing procedure will error out. 0= no distance limit |
||||||||||||||
Data type |
LREAL |
|||||||||||||||
Range |
— |
|||||||||||||||
Unit |
User unit |
|||||||||||||||
Default |
— |
|||||||||||||||
AbsoluteSwitch |
Description |
The absolute switch input I/O point |
||||||||||||||
Data type |
BOOL |
|||||||||||||||
Range |
[0 , 1] |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
Default |
— |
|||||||||||||||
PosLimitSwitch |
Description |
The positive direction limit switch input I/O point |
||||||||||||||
Data type |
BOOL |
|||||||||||||||
Range |
[0 , 1] |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
Default |
— |
|||||||||||||||
NegLimitSwitch |
Description |
The negative direction limit switch input I/O point |
||||||||||||||
Data type |
BOOL |
|||||||||||||||
Range |
[0 , 1] |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
Default |
— |
|||||||||||||||
SwitchMode |
Description |
Switch state to complete homing
|
||||||||||||||
Data type |
SINT |
|||||||||||||||
Range |
[0 , 5] |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
Default |
— |
Output
Done |
Description |
Indicates the move completed successfully. The Command Position has reached the endpoint |
||||||||||||||
Data type |
BOOL |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
Busy |
Description |
High from the moment the Execute input is one-shot to the time the move is ended |
||||||||||||||
Data type |
BOOL |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
Active |
Description |
Indicates this move is the active move |
||||||||||||||
Data type |
BOOL |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
CommandAborted |
Description |
Indicates the move was aborted |
||||||||||||||
Data type |
BOOL |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
Error |
Description |
Indicates an invalid input was specified or the move was terminated due to an error |
||||||||||||||
Data type |
BOOL |
|||||||||||||||
Unit |
n/a |
|||||||||||||||
ErrorID |
Description |
Indicates the error if Error output is set to TRUE
|
||||||||||||||
Data type |
INT |
|||||||||||||||
Unit |
n/a |
Usage
This physical layout has the risk that homing is started in the wrong direction (escaping the switch). To support such case, it implements a special behavior when Limit Switches are found (or the AbsSwitch itself is “On” at Execute):
- The homing is commanded in the most likely direction were the sensorA sensor is a type of transducer that converts one type of energy into another for various purposes including measurement or information transfer can be found. In this example (-).
- The velocity is defined by the input.
- The torque is limited.
- Both Time and Distance Limits can cause an error if exceeded
- If any LimitSwitch is found during HomingThe Homing procedure allows, based on a position measurement, to set a position offset to the motor in order to ensure it is physically at the home position (any of them), then a special process is started in the opposite direction, the AbsSwitch is searched to switch off (or On, depending on SwitchMode setting). The Edge (passed by), and homing process is restarted in the original direction and with the same conditions. This ensures that the end conditions are always same
- If the SwitchMode is either MC_SwitchNegative or MC_SwitchPositive, then the special process is also started in opposite direction depending from the switch state at ‘execute’.
- The direction changes only when the specified Velocity is reached (InVelocity).
- This Function BlockA function block groups an algorithm and a set of private data. It has inputs and outputs. doesn’t modify the actual position
An overlapping switch configuration is also possible. This has same the behavior as working on the limit switches:
If the input Direction is set to a fixed direction (MC_Positive or MC_Negative), then the initial switch state is ignored (used for example in rotary axis where only one sense of rotation is allowed):
Related Functions
Example
Structured Text
NegativeDirection :=1; RisingEdge :=2; Velocity :=10000.0; TorqueLimit :=50.0; TimeLimit :=T#10s; DistanceLimit :=10000.0;
Inst_MCFB_StepAbsSwitch( True, Axis1, NegativeDirection, RisingEdge, Velocity, 1000, 1000, 0, TorqueLimit, TimeLimit, DistanceLimit, AbsoluteSwitch, PosLimitSwitch, NegLimitSwitch, 0 );
HomeComplete :=Inst_MCFB_StepAbsSwitch.Done; HomeBusy :=Inst_MCFB_StepAbsSwitch.Busy; HomeActive :=Inst_MCFB_StepAbsSwitch.Active; HomeAborted :=Inst_MCFB_StepAbsSwitch.CommandAborted; HomeError :=Inst_MCFB_StepAbsSwitch.Error; HomeErrorID :=Inst_MCFB_StepAbsSwitch.ErrorID; (* AbsoluteSwitch, PosLimitSwitch, NegLimitSwitch are declared I/O points *) |
Ladder Diagram
Function Block Diagram