If i can get referencing of 4th axis to work by using the Z index from encoder i wont use a proximity sensor. Will just use a physical mark. That said, i have made a Referencing C Code to use the Z index but cant get it to repeat.It looks like it stops at random points. The Z index is connected to Kanalog terminal JP2 pins 6A+ and 6A-.
Here is code iam using. What am i missing. This is same code as i use on my lathe other than the bit.
Troy
Code:
#include "KMotionDef.h"
#include "SimpleHomeIndexFunction.c"
main()
{
int result;
// HOME A
result = SimpleHomeIndexFunction(4, // axis number to home
20000, // speed to move toward home
1, // direction to move toward home (+1 or -1)
40, // limit bit number to watch for
1, // limit polarity to wait for (1 or 0)
20000.0, // speed to move while searching for index
-1, // index bit number to watch for (use -1 for none)
-1, // index polarity to wait for (1 or 0)
0); // amount to move inside limits
if (result == 0)
{
printf("Home A succeded\n");
}
else
{
printf("Home A failed\n");
return;
}
}