I replaced the relay and added a resistor and the output problem hasn't reoccurred.
The spindle, however, seems like it might have the encoder glitch that had plagued my motion axes with earlier Kmotion versions. I still wonder if I managed to damage my Kogna somehow, because it seems like it happens more often when the shop gets hot.
I added a modified version of the glitch detection code from this thread to my for loop:
https://www.cnczone.com/forums/dynom...vo-tuning.html
Code:
--------------------------------------------------------------------------------
// Below is in main function in init program
double TGlitch=Time_sec(); //Glitch detect time variable
double curGlitchX, lastGlitchX=ch0->Position; //Glitch detect X axis variables
double curGlitchY, lastGlitchY=ch1->Position; //Glitch detect Y axis variables
double curGlitchZ, lastGlitchZ=ch2->Position; //Glitch detect Z axis variables
double curGlitchS, lastGlitchS=ch3->Position; //Glitch detect spindle axis variables
// Below is in for loop in init program
curGlitchX = ch0->Position;
if (curGlitchX > lastGlitchX + 200 || curGlitchX < lastGlitchX - 200)
{
printf("X axis glitch detected\n");
printf("cnt %f new %f last %f diff %f\n", Time_sec()-TGlitch, curGlitchX, lastGlitchX, curGlitchX-lastGlitchX);
}
lastGlitchX=curGlitchX;
//////////// Y axis
curGlitchY = ch1->Position;
if (curGlitchY > lastGlitchY + 200 || curGlitchY < lastGlitchY - 200)
{
printf("Y axis glitch detected\n");
printf("cnt %f new %f last %f diff %f\n", Time_sec()-TGlitch, curGlitchY, lastGlitchY, curGlitchY-lastGlitchY);
}
lastGlitchY=curGlitchY;
//////////// Z axis
curGlitchZ = ch2->Position;
if (curGlitchZ > lastGlitchZ + 200 || curGlitchZ < lastGlitchZ - 200)
{
printf("Z axis glitch detected\n");
printf("cnt %f new %f last %f diff %f\n", Time_sec()-TGlitch, curGlitchZ, lastGlitchZ, curGlitchZ-lastGlitchZ);
}
lastGlitchZ=curGlitchZ;
//////////// Spindle axis
curGlitchS = ch3->Position;
if (curGlitchS > lastGlitchS + 300 || curGlitchS < lastGlitchS - 300)
{
printf("Spindle axis glitch detected\n");
printf("cnt %f new %f last %f diff %f\n", Time_sec()-TGlitch, curGlitchS, lastGlitchS, curGlitchS-lastGlitchS);
}
lastGlitchS=curGlitchS;
If I look for changes of less than 300 counts it triggers more often (at 100 counts it's continually triggered), but at 300 counts I actually hear the spindle stutter. The spindle axis encoder is a simulated encoder from the servo drive, and I can set the PPR by parameter. For now I'm going to set it to the maximum PPR the drive can output (I think I can increase it from 1024 PPR to 16384PPR) in the hopes of the physical change in velocity that results from whatever is going on will be much smaller.
Stuff showing in the console above the spindle jogging and glitch stuff is from my attempt at creating a synchronous tapping program.