5 example: double homing corrects backlash offsets, Simpliq – ElmoMC SimplIQ Software Manual User Manual
Page 194
SimplIQ
Software Manual
Sensors, I/O and Events
MAN-SIMSW (Ver. 1.4)
12-9
return
function [int status]=WaitHome(int TimeOut)
/*
Wait until HM=0, or until too much time elapses
*/
int StartTime ;
status = -1;
StartTime = TM;
while (HM)
if ( tdif(handle) >= TimeOut) return ; end
end
status = 1 ;
return
##ErrorOut
/* Error handler – just exit*/
return
12.5.5 Example: Double Homing Corrects Backlash Offsets
This example demonstrates homing on the Home switch without using the Index. In
many gear systems, the Index signal cannot be used for homing because:
Motor or gear repairs may not require tuning of the index position or the drive.
Backlash and gear compliance prevent accurate mapping of the motor position to the
load.
In order to prevent compliance and timing errors, the position of the Home switch is
captured two times, with alternating movement directions. The two captured results are
averaged in order to cancel the error sources.
If PX=10,000 is in the middle of the Home switch, the homing formula is:
PX=PX+10,000 -0.5 * (PX at right home edge + PX at left home edge)
The following user program executes this routine, using the auxiliary functions of the
previous example:
function [int status] = homing1(int TimeOut)
/*
Homing routine.
Input:
TimeOut: Timeout for failure
Output:
status=1 if o.k., otherwise a negative error code
Assumptions:
RLS,FLS,HOME already programmed by IL[1],IL[2],IL[3] commands
*/
int OldMi,Pos1;
/* Go reverse until limit switch */