Hi toolhoarder,
Strange as you should be able to use the same initialization C file for both Mach3 and KMotionCNC to configure the axes, enable the axis, and define the axis in use. Do you have the Initialization C file configured as a User Button in KMotionCNC and running it? Post it so we can see it. Run KMotion.exe and use the Axis Screen to see
which axes are enabled and disabled. Also check the Console Screen for any messages. What GCode are you running?
It is not necessary to use the third set of screw terminals for your two motors. Any KFLOP Axis can be configured via the OutputChan0 parameter to use any KSTEP Motor Driver (scew terminals). Also any GCode Axis can be associated with any KFLOP Axis via the DefineCoordSystem(). What you have shown should work.
Regards TK
| Group: DynoMotion |
Message: 10124 |
From: toolhoarder |
Date: 9/4/2014 |
| Subject: Re: Axis Disabled Message in KMotionCNC |
|
Thanks for the response. I have made a lot of progress since posting my message.
A kind soul gave me some tips. I was using mot files plus init,c, and he told me that was not necessary, so I ditched the mot files. He also told me I needed an init.c that was written for the Kstep, so I dug out InitKstep3Axis and modified it for two axes. Now the lathe functions in both Mach3 and KMotionCNC.
He suggested I choose higher jerk figures, but I don't know what the right figures would be. The software chose 4+e006 all by itself.
I am having problems with the lathe losing steps. It looks like the steps/inch on the x axis works best at 81540, and on z I'm getting 6475, but these don't match the calculations for a 25 TPI screw and 8 TPI screw. The guy who helped me suggested lower speeds and accelerations, but I'm not sure what's appropriate for a mini-lathe. It's not like I'm doing production, so I don't need much speed.
He also said I should change the code so the amps don't shut off. Something about losing the tool position.
Anyway, here is the code.
#include "KMotionDef.h"
// Defines axis 0, 1 as simple step dir TTL outputs for KSTEP // enables them // sets them as an xz coordinate system for GCode
int main() { double T0, LastX=0, LastZ=0, Tau; KStepPresent=TRUE; // enable KSTEP input multiplexing FPGA(KAN_TRIG_REG)=4; // Mux PWM0 to JP7 Pin5 IO 44 for KSTEP
FPGA(STEP_PULSE_LENGTH_ADD) = 63 + 0x80; // set polarity and pulse length to 4us ch0->InputMode=NO_INPUT_MODE; ch0->OutputMode=STEP_DIR_MODE; ch0->Vel=40000; ch0->Accel=200000; ch0->Jerk=4e+006; ch0->P=0; ch0->I=0.01; ch0->D=0; ch0->FFAccel=0; ch0->FFVel=0; ch0->MaxI=200; ch0->MaxErr=1e+006; ch0->MaxOutput=200; ch0->DeadBandGain=1; ch0->DeadBandRange=0; ch0->InputChan0=0; ch0->InputChan1=0; ch0->OutputChan0=8; ch0->OutputChan1=0; ch0->MasterAxis=-1; ch0->LimitSwitchOptions=0x0; ch0->SoftLimitPos=1e+030; ch0->SoftLimitNeg=-1e+030; ch0->InputGain0=1; ch0->InputGain1=1; ch0->InputOffset0=0; ch0->InputOffset1=0; ch0->OutputGain=1; ch0->OutputOffset=0; ch0->SlaveGain=1; ch0->BacklashMode=BACKLASH_OFF; ch0->BacklashAmount=0; ch0->BacklashRate=0; ch0->invDistPerCycle=1; ch0->Lead=0; ch0->MaxFollowingError=1000000000; ch0->StepperAmplitude=20;
ch0->iir[0].B0=1; ch0->iir[0].B1=0; ch0->iir[0].B2=0; ch0->iir[0].A1=0; ch0->iir[0].A2=0;
ch0->iir[1].B0=1; ch0->iir[1].B1=0; ch0->iir[1].B2=0; ch0->iir[1].A1=0; ch0->iir[1].A2=0;
ch0->iir[2].B0=0.000769; ch0->iir[2].B1=0.001538; ch0->iir[2].B2=0.000769; ch0->iir[2].A1=1.92076; ch0->iir[2].A2=-0.923833; EnableAxisDest(0,0);
ch1->InputMode=NO_INPUT_MODE; ch1->OutputMode=STEP_DIR_MODE; ch1->Vel=40000; ch1->Accel=200000; ch1->Jerk=4e+006; ch1->P=0; ch1->I=0.01; ch1->D=0; ch1->FFAccel=0; ch1->FFVel=0; ch1->MaxI=200; ch1->MaxErr=1e+006; ch1->MaxOutput=200; ch1->DeadBandGain=1; ch1->DeadBandRange=0; ch1->InputChan0=0; ch1->InputChan1=0; ch1->OutputChan0=9; ch1->OutputChan1=0; ch1->MasterAxis=-1; ch1->LimitSwitchOptions=0x0; ch1->SoftLimitPos=1e+030; ch1->SoftLimitNeg=-1e+030; ch1->InputGain0=1; ch1->InputGain1=1; ch1->InputOffset0=0; ch1->InputOffset1=0; ch1->OutputGain=1; ch1->OutputOffset=0; ch1->SlaveGain=1; ch1->BacklashMode=BACKLASH_OFF; ch1->BacklashAmount=0; ch1->BacklashRate=0; ch1->invDistPerCycle=1; ch1->Lead=0; ch1->MaxFollowingError=1000000000; ch1->StepperAmplitude=20;
ch1->iir[0].B0=1; ch1->iir[0].B1=0; ch1->iir[0].B2=0; ch1->iir[0].A1=0; ch1->iir[0].A2=0;
ch1->iir[1].B0=1; ch1->iir[1].B1=0; ch1->iir[1].B2=0; ch1->iir[1].A1=0; ch1->iir[1].A2=0;
ch1->iir[2].B0=0.000769; ch1->iir[2].B1=0.001538; ch1->iir[2].B2=0.000769; ch1->iir[2].A1=1.92076; ch1->iir[2].A2=-0.923833; EnableAxisDest(1,0);
DefineCoordSystem(0,-1,1,-1); SetBitDirection(45,1); // set Enable Signal as Output SetBit(45); // Enable the amplifiers // Add a small amount of Coordinated Motion Path smoothing if desired // Tau = 0.001; // seconds for Low Pass Filter Time Constant // KLP = exp(-TIMEBASE/Tau); KLP=0; // force to 0 to disable // printf("Tau=%f KLP=%f\n",Tau,KLP); for (;;) // loop forever { WaitNextTimeSlice(); // Service Amplifier disable after no activity for a while if (ch0->Dest != LastX || ch1->Dest != LastZ) { // we moved - enable KStep Amplifers SetBit(45); T0 = Time_sec(); // record the time and position of last motion LastX=ch0->Dest; LastZ=ch1->Dest; } else { if (Time_sec() > T0 + 10.0) ClearBit(45); } }
return 0; }
|
|
| Group: DynoMotion |
Message: 10125 |
From: toolhoarder |
Date: 9/4/2014 |
| Subject: Re: Axis Disabled Message in KMotionCNC |
|
I should also add that now the axes are running backward again. Mach3 won't fix it, but I made it work by switching the output gain values in KMotion. The "State" boxes on lines 2 and 3 on the Digital Output screen are blinking.
|
|
| Group: DynoMotion |
Message: 10130 |
From: Tom Kerekes |
Date: 9/4/2014 |
| Subject: Re: Axis Disabled Message in KMotionCNC |
Hi toolhoarder,
I'm not sure if you asking a question? Yes real-time motion is controlled by KFLOP not the Mach3 Parallel Port Driver so Homing, Limits, and Step Pulse generation is configured and performed in KFLOP.
Regards TK
| Group: DynoMotion |
Message: 10131 |
From: toolhoarder |
Date: 9/4/2014 |
| Subject: Re: Axis Disabled Message in KMotionCNC |
|
There are three things I would like to know.
1. Why are the "state" boxes on outputs 2 and 3 blinking? That's completely new.
2. Can you suggest jerk figures that make sense for a mini-lathe, or at least get me in the ballpark?
3. Do you have any ideas what could be causing me to lose steps?
|
|
| Group: DynoMotion |
Message: 10132 |
From: Tom Kerekes |
Date: 9/4/2014 |
| Subject: Re: Axis Disabled Message in KMotionCNC |
Hi toolhoarder,
Regarding:
#1 - The 16 KSTEP opto inputs are multiplexed into KFLOP 4 inputs at a time. KFLOP Outputs 2 and 3 are used to control this continuous multiplexing and should occur whenever you tell KFLOP that a KSTEP is present with KStepPresent=TRUE;
#2 - you might set the numeric Jerk value 50X higher than your Acceleration numeric value. This will result in Acceleration being applied in 1/50th of a second. A smaller number will make the motion smoother. A larger number will result in faster speed changes. Jerk is analogous to how fast or gradually you apply the brakes in your car. Wen plotting Velocity on the Step Response Screen the curved regions of the blue plot are where the Jerk is ramping the acceleration.
#3 - There can be many reasons. You would
need to supply some information. Under what situations are you loosing steps? What are the amounts? Is it multiples of 1/50th of a motor revolution (one motor pole)? Are you moving too fast? Accelerating too hard? Do you have enough motor torque?
Regards TK
From: "toolhoarder@... [DynoMotion]" <DynoMotion@yahoogroups.com> To: DynoMotion@yahoogroups.com Sent: Thursday, September 4, 2014 4:24 PM Subject: [DynoMotion] Re: Axis Disabled Message in KMotionCNC
There are three things I would like to know.
1. Why are the "state" boxes on outputs 2 and 3 blinking? That's completely new.
2. Can you suggest jerk figures that make sense for a mini-lathe, or at least get me in the ballpark?
3. Do you have any ideas what could be causing me to lose steps?
|
|
| Group: DynoMotion |
Message: 10146 |
From: Moray Cuthill |
Date: 9/8/2014 |
| Subject: Re: Axis Disabled Message in KMotionCNC |
I'm the 'kind soul' who's been offering suggestions. There is something not right with the steps per unit setting, and I have suggested to go back to basics and check the mechanics. To save you reading the entire thread, the condensed version is toolhoarder has a 8TPI Z-axis and a 25TPI X-axis. Going by my calcs steps/inch should be 25600 and 80000, however the actual settings are in the region of 6475 and 75000 respectively. Now being high could be explained by lost steps, however being under I'm suspecting something has been overlooked, and have suggested going back to basics and checking the mechanics. Moray | | | | | |