User's Manual
HARSFEN0602
Program Example 1 - Double Sided Homing.
13.5.6 Capturing
Capturing is a special case of homing, in which we program that the event will only register the counters
value, but not affect motion and not update the position counters.
Capturing is efficient in synchronizing the motion origin to objects in the working space.
The Amplifier can capture two event defined by the HX and the HY commands, and register up to 4
consecutive occurrences of PX and PY of each event.
The capture function captures both the main and the auxiliary position counters simultaneously. This is
useful for synchronizing the main and the auxiliary positions.
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 */
OldMi=MI;MI=MI|0x16; /* Prevent operational AUTO_RLS routine while in homing process*/
/* Arm homing for
RLS, stop after homing, don't initialize counter*/
HM[3]=7;HM[4]=0;HM[5]=2;HM[1]=1;
/* Go to the reverse */
JV=-10000;BG;WaitArrive(2000);if(status<=0)goto LastLine; end
/* Go until falling home switch, stop, and capture position*/
HM[3]=2;HM[4]=0;HM[5]=2;HM[1]=1;
JV=-JV;BG;WaitHome(2000);if(status<=0)goto LastLine; end
Pos1=HM(7)
/* Sample home switch from other side */
HM[1]=1; JV=-JV;BG;WaitHome(2000);if(status<=0)goto LastLine; end
/* Final calculation – set immediate difference correction to PX*/
HM[2]=10000-(HM[7]+Pos1)/2;HM[3]=0;HM[4]=2;HM[5]=1;HM[1]=1;
status=1;/*Success return */
##LastLine
MI=OldMI; ** Restore AUTO_RLS routine status
return