Page 1 of 4
idk why lathe changes
Posted: Sat Feb 17, 2024 12:36 am
by turbothis
man, my old lathe did the same thing where it just behaves super different after a while of nothing changing
my spindle is sluggish and non responsive to parameter changes in the C program
a week ago the X axis was running off at times
now the Z axis is running off......
both my mills where/are dead bang bet my life stable!
both lathes work great at times and then just change terrible
i dont even know where to start looking
i have super OCD and skeptical of things like old versions of dynomotion cnc on then computer. like it is using an old one or blending or who knows
Re: idk why lathe changes
Posted: Sat Feb 17, 2024 12:42 am
by Moray
Nothing should change without a reason, but to eliminate the possibility of something pointing to an old install, rename the directories.
I usually put an 'x' at the end, so that way if anything does happen to still be using an old install, it will break the link and generate an error, and renaming avoids deleting anything that you might still need.
Re: idk why lathe changes
Posted: Sat Feb 17, 2024 12:54 am
by TomKerekes
The approach I usually use when things are misbehaving is to try to identify one, hopefully simple, single thing, that is not working correctly. Then do a deep dive to try to determine why.
Re: idk why lathe changes
Posted: Sat Feb 17, 2024 5:14 pm
by turbothis
i guess start with the spindle
the spindle shows the DAC at full power and yet the motor is winding up 100x slower than it should
it completely over shoots both ways even with full DAC command
i am about to put voltage gauges on DAC outputs and servo power supplies
so only CCW jog, spindle jog, off jog, settings and spindle def controls the actual spindle right????
right now CW jog does not even move
where does the myspindledefs file supposed to live?
Code: Select all
#include "KMotionDef.h"
#include "MySpindleDefs.h"
int *css_mode = &persist.UserData[PC_COMM_CSS_MODE]; // Mode 1=Normal RPM mode. 2=CSS
// desired speed is passed from KMotionCNC in variable KMVAR
// save in user variable STATEVAR whether it was off, CW, or CCW (0,1,-1)
// save in user variable SPEEDVAR the last desired speed
main()
{
float speed = *(float *)&persist.UserData[SPEEDVAR]; // value stored is actually a float
int LastState = persist.UserData[STATEVAR]; // get last state
if (CS0_axis_a == -1 && !ch2->Enable) // is A axis not defined in the Coordinate System and not enabled?
EnableAxis(2); // yes, enable the axis
if (LastState==1)
{
// if spindle was CW now we want CCW
// spin down
ClearBit(SPINDLECW_BIT);
ClearBit(SPINDLECCW_BIT);
Jog(SPINDLEAXIS,0);
while (!CheckDone(SPINDLEAXIS)) ;
}
// turn spindle on CCW and ramp to new speed
SetBit(SPINDLECCW_BIT);
LastState = -1;
if (*css_mode != 2)
{
// spindle is already on, so ramp to new speed
if (USE_POS_NEG_VOLTAGE)
Jog(SPINDLEAXIS,speed * FACTOR * LastState);
else
Jog(SPINDLEAXIS,speed * FACTOR);
printf("Jogging Spindle %f counts/sec\n",speed * FACTOR);
}
persist.UserData[STATEVAR] = -1; // remember we are CCW
}
Code: Select all
#include "KMotionDef.h"
#include "MySpindleDefs.h"
int *css_mode = &persist.UserData[PC_COMM_CSS_MODE]; // Mode 1=Normal RPM mode. 2=CSS
// desired speed is passed from KMotionCNC in variable KMVAR
// save in user variable STATEVAR whether it was off, CW, or CCW (0,1,-1)
// save in user variable SPEEDVAR the last desired speed
main()
{
float speed = *(float *)&persist.UserData[KMVAR]; // value stored is actually a float
int LastState = persist.UserData[STATEVAR]; // get last state
persist.UserData[SPEEDVAR] = persist.UserData[KMVAR]; // Always save the last desired speed
if (LastState==0 || *css_mode == 2)
{
// if spindle is off (or CSS mode) and User Changes the speed
// just save the desired speed
return 0;
}
// spindle is already on, so ramp to new speed
if (USE_POS_NEG_VOLTAGE)
Jog(SPINDLEAXIS,speed * FACTOR * LastState);
else
Jog(SPINDLEAXIS,speed * FACTOR);
printf("Jogging Spindle %f counts/sec\n",speed * FACTOR);
}
Code: Select all
#include "KMotionDef.h"
#include "MySpindleDefs.h"
// desired speed is passed from KMotionCNC in variable KMVAR
// save in user variable STATEVAR whether it was off, CW, or CCW (0,1,-1)
// save in user variable SPEEDVAR the last desired speed
main()
{
// spin down
ClearBit(SPINDLECW_BIT);
ClearBit(SPINDLECCW_BIT);
Jog(SPINDLEAXIS, 0);
printf("Jogging Spindle Stop\n");
persist.UserData[STATEVAR] = 0; // remember we are Off
while (!CheckDone(SPINDLEAXIS));
if (CS0_axis_a == -1) // is A axis not defined in the Coordinate System?
DisableAxis(2); // yes, disable the axis, otherwise leave it enabled
}
Re: idk why lathe changes
Posted: Sat Feb 17, 2024 7:50 pm
by turbothis
stuff like the c code changing
Code: Select all
ch0->InputMode=ENCODER_MODE;
ch0->OutputMode=DAC_SERVO_MODE;
ch0->Vel=10000;
ch0->Accel=50000000;
ch0->Jerk=50000000;
ch0->P=10;
ch0->I=0;
ch0->D=20;
to
Code: Select all
ch0->InputMode=ENCODER_MODE;
ch0->OutputMode=DAC_SERVO_MODE;
ch0->Vel=10000;
ch0->Accel=5e+07;
ch0->Jerk=5e+07;
ch0->P=10;
ch0->I=0;
ch0->D=20;
really makes me think it is doing more stuff
is there any way to turn off this scientific notation auto thing?
Re: idk why lathe changes
Posted: Sat Feb 17, 2024 7:56 pm
by turbothis
maybe the computer is bad?
i mean i am just slowly checking things in dyno cnc and it locks up the program.....
Re: idk why lathe changes
Posted: Sat Feb 17, 2024 9:39 pm
by TomKerekes
Actually 50000000 and 5e7 are the same. The e7 means to shift the decimal 7 places to the right. If you have 50000000 in the C program and import it to KMotion and export it back to C it will change to 5e7. But it won't change by itself.
Again rather than jumping all around I'd focus on one thing at a time.
the spindle shows the DAC at full power
It isn't clear what you mean by this. How can the Spindle show anything? Maybe you mean the DAC is at 2047? If so the DAC voltage should be -10V. Measure with a Voltmeter. What is it?
Also check the CW and CCW bits to the Spindle. Are they set properly? How is the Spindle supposed to be controlled? Your MySpindleDefs.h has UsePosNegVoltage set so I'm guessing it uses +/-10 to control the direction. What type of control bits does it have?
the motor is winding up 100x slower than it should
It isn't clear what you mean by this. Is its velocity low? Or high but gradually accelerating?
so only CCW jog, spindle jog, off jog, settings and spindle def controls the actual spindle right????
right now CW jog does not even move
Normally yes. But some of your code seems to indicate you are also using the Spindle as an A Axis. Are you?
where does the myspindledefs file supposed to live?
In the same folder as the Spindle Programs.
Re: idk why lathe changes
Posted: Sat Feb 17, 2024 10:35 pm
by turbothis
thanks for the reply
im already over 6 hours into it today and fried.
maybe tonight i can try and put together some questions and info together
on a side note, while trying to get this going the windows desktop background just goes black for a while...... then comes back and on and on. lol
Re: idk why lathe changes
Posted: Sat Feb 17, 2024 11:04 pm
by turbothis
if i use the
SpindleUsingJogs\SpindleOnCWJogV2.c
SpindleUsingJogs\SpindleOnCCWJogV2.c
SpindleUsingJogs\SpindleOffJogV2.c
for spindle control, what do i use for the speed?
Re: idk why lathe changes
Posted: Sun Feb 18, 2024 12:18 am
by TomKerekes
It would be SpindleMillJogV2.c but those are obsolete. Please use the ones in \SpindleUsingJogs\CSS\