-
set position home
I'm sure that it's a stupid question.
I have the home sensor not at 0 but at most (es.5000)
so I want to run home, Zero (etc.), position set (5000).
how can I set the axis position so that the home position sensor give me as 5000
I forgot, kanalog, encoder dac.
#include "KMotionDef.h"
main()
{
Jog(0,-100); // start moving
while (!ReadBit(8)) ; // wait for switch (input #8) to change
Jog(0,0); // stop
....setaxisVal....5000
}
-
Re: set position home
Hi Fledge2b,
Try this:
Code:
#include "KMotionDef.h"
main()
{
double SwitchPosition;
Jog(0,-100); // start moving
while (!ReadBit(8)) ; // wait for switch (input #8) to change
SwitchPosition = ch0->Position; // record where switch changed
Jog(0,0); // stop
while (!CheckDone(0)) ; // wait to stop
Move(0,SwitchPosition); // move back to where switch transitioned
while (!CheckDone(0)) ; // wait for move to finish
Delay_sec(0.5); // wait for everything to settle out
DisableAxis(0); // disable axis while adjusting destination and encoder reading
ch0->Position = 5000; //....setaxisVal....5000
EnableAxisDest(0,5000); // now servo to destination of 5000
}
HTH
Regrad