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