Elmo HARmonica Network Hardware User Manual


 
HARSFEN0602
13.5.5.1 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. The reason may be:
Motor or gear repairs should not require the tuning of the index position or the Amplifier.
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 to cancel the error sources.
Suppose that in the middle of the home switch we should have PX=10000.
Then the homing formula is PX=PX+10000-0.5·(PX at right home edge + PX at left home edge)
The user program routine that does that is listed below. The routine uses the helper functions of the previous
example.
function [int status]=WaitArrive(int TimeOut)
/*
Wait until MS=0, or until too much time elapses
*/
int StartTime ;
status = -1;
StartTime = TM;
while (MS)
if ( tdif(handle) >= TimeOut) return ; end
end
status = 1 ;
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