Homing seems simple enough - just move each joint to a known location, and set EMC's internal variables accordingly. However, different machines have different requirements, and homing is actually quite complicated.
Figure shows four possible homing sequences, along with the associated configuration parameters. For a more detailed description of what each configuration parameter does, see the following section.
There are six pieces of information that determine exactly how the home sequence behaves. They are defined in the ini, and can be tweaked to obtain the result you are after.
'HOME_SEARCH_VEL' is defined in each AXIS_* section. The default value is zero. A value of zero causes EMC to assume that there is no home switch. The search and latch stages of homing are skipped, EMC declares the current position to be ``HOME_OFFSET'', and does a rapid to ``HOME'' if ``HOME'' is not equal to ``HOME_OFFSET''.
If 'HOME_SEARCH_VEL' is non-zero, then EMC assumes that there is a home switch. It begins by checking whether the home switch is already tripped. If so, it backs off the switch at HOME_SEARCH_VEL (the direction of the back-off is opposite the sign of HOME_SEARCH_VEL). Then it searches for the home switch by moving in the direction specified by the sign of 'HOME_SEARCH_VEL', at a speed determined by its absolute value. When the home switch is detected, the joint will stop as fast as possible, but there will always be some overshoot. The amount of overshoot depends on the speed. If it is too high, the joint might overshoot enough to hit a limit switch or crash into the end of travel. On the other hand, if 'HOME_SEARCH_VEL' is too low, homing can take a long time.
'HOME_LATCH_VEL' is also defined in the ini file, for each AXIS. It specifies the speed and direction that EMC uses when it makes its final accurate determination of the home switch and index pulse location. It will usually be slower than the search velocity to maximise accuracy. If HOME_SEARCH_VEL and HOME_LATCH_VEL have the same sign, then the latch phase is done while moving in the same direction as the search phase. (In that case, EMC first backs off the switch, before moving towards it again at the latch velocity.) If HOME_SEARCH_VEL and HOME_LATCH_VEL have opposite signs, the latch phase is done while moving in the opposite direction from the search phase. That means EMC will latch the first pulse after it moves off the switch. If 'HOME_SEARCH_VEL' is zero, the latch phase is skipped and this parameter is ignored. If 'HOME_SEARCH_VEL' is non-zero and this parameter is zero, it is an error and the homing operation will fail. The default value is zero.
'HOME_IGNORE_LIMITS' is another settable option in the AXIS_* section. It's a boolean flag, and can hold the values YES / NO. This flag determines whether EMC will ignore the limit switch inputs. Some machine configurations do not use a separate home switch, instead they route one of the limit switch signals to the home switch input as well. In this case, EMC needs to ignore that limit during homing. The default value for this parameter is NO.
'HOME_USE_INDEX' is a single bit settable in the AXIS_* section. It specifies whether or not there is an index pulse. If the flag is true (HOME_USE_INDEX = YES), EMC will latch on the rising edge of the index pulse. If false, EMC will latch on either the rising or falling edge of the home switch (depending on the signs of search_vel and latch_vel). If 'HOME_SEARCH_VEL' is zero, the latch phase is skipped and this parameter is ignored. The default value is NO.
'HOME_OFFSET' is a value setable from the ini in the AXIS_* section. It contains the location of the home switch or index pulse, in joint coordinates. It can also be treated as the distance between the point where the switch or index pulse is latched and the zero point of the joint. After detecting the index pulse, EMC sets the joint coordinate of the current point to ``HOME_OFFSET''. The default value is zero.
'HOME' is a value setable from the ini in the AXIS_* section. It is the position that the joint will go to upon completion of the homing sequence. After detecting the index pulse, and setting the coordinate of that point to ``HOME_OFFSET'', EMC makes a move to "HOME" as the final step of the homing process. The default value is zero. Note that even if this parameter is the same as ``HOME_OFFSET'', the axis will slightly overshoot the latched position as it stops. Therefore there will always be a small move at this time (unless HOME_SEARCH_VEL is zero, and the entire search/latch stage was skipped). This final move will be made at the joint's maximum velocity. Since the axis is now homed, there should be no risk of crashing the machine, and a rapid move is the quickest way to finish the homing sequence. 0.1
'HOME_IS_SHARED' is a value setable from the ini in the AXIS_* section. If there is not a separate home switch input for this axis, but a number of momentary switches wired to the same pin, set this value to 1 to prevent homing from starting if one of the shared switches is already closed. Set this value to 0 to permit homing even if the switch is already closed.
'HOME_SEQUENCE' is a value setable from the ini in the AXIS_* section. This value is used to perform a multi-axis homing sequence (``HOME ALL'') and enforce homing order (e.g., Z may not be homed if X is not yet homed). An axis may be homed after all axes with a lower HOME_SEQUENCE have already been homed and are at the HOME_OFFSET. If two axes have the same HOME_SEQUENCE, they may be homed at the same time. If HOME_SEQUENCE is -1 or not specified then this joint will not be homed by the HOME ALL sequence. HOME_SEQUENCE numbers start with 0 and there may be no unused numbers.