simple 2 axis lathe initial lathe set up

Moderators: TomKerekes, dynomotion

turbothis
Posts: 316
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Tue Dec 12, 2023 11:39 pm

i thought it might be nice to run the newest version
deleted old and downloaded new

now i get
Attachments
Capture3.JPG
Capture2.JPG
Capture.JPG
Capture.JPG (13.82 KiB) Viewed 254 times

User avatar
TomKerekes
Posts: 2559
Joined: Mon Dec 04, 2017 1:49 am

Re: simple 2 axis lathe initial lathe set up

Post by TomKerekes » Wed Dec 13, 2023 12:06 am

That seems to be a problem that was introduced recently when going from an old Firmware Version to new. We are working to correct it.

You should be able to use Flash Recovery as a workaround.
Regards,

Tom Kerekes
Dynomotion, Inc.

turbothis
Posts: 316
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Wed Dec 13, 2023 12:13 am

it almost works but then locks up windows and closes

User avatar
TomKerekes
Posts: 2559
Joined: Mon Dec 04, 2017 1:49 am

Re: simple 2 axis lathe initial lathe set up

Post by TomKerekes » Wed Dec 13, 2023 12:32 am

Another option is to use the old Version to Flash the new Version:

1 - turn off KFLOP
2 - Exit any KMotion.exe
3 - run C:\KMotion435h\KMotion\Release\KMotion.exe
4 - turn on KFLOP
5 - Flash New Version and select C:\KMotion5.3.1\DSP_KFLOP\DSPKFLOP.out
6 - turn off KFLOP
7 - Exit KMotion.exe
8 - Run C:\KMotion5.3.1\KMotion\Release\KMotion.exe
9 - Turn on KFLOP
Regards,

Tom Kerekes
Dynomotion, Inc.

turbothis
Posts: 316
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Wed Dec 13, 2023 1:09 am

ok, looks to back up with the newest
thanks!

turbothis
Posts: 316
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Wed Dec 13, 2023 1:44 am

so with a fresh newest copy
i got my main init servo code as thread 1 var 0 in both C codes and user buttons
X axis moves as it should
spindle is now functioning and is tuning nicely!

1 the "execute prog" thread number must match the C code thread number for that particular code yes?
2 i seem to remember my old mill would have a green light on the thread # ( init code )for that machine while running it?
3 i see VAR 113 for the rpm speed in several places but nothing for any other VAR. i dont understand anything about this
4 DAC outputs in the console run the servo fine
Attachments
threads.JPG
threads.JPG (9.33 KiB) Viewed 244 times
VAR of doom.JPG
Last edited by turbothis on Wed Dec 13, 2023 5:10 pm, edited 3 times in total.

turbothis
Posts: 316
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Wed Dec 13, 2023 2:00 am

got my defs accurate and saved.....
Attachments
defs.JPG

User avatar
TomKerekes
Posts: 2559
Joined: Mon Dec 04, 2017 1:49 am

Re: simple 2 axis lathe initial lathe set up

Post by TomKerekes » Wed Dec 13, 2023 6:16 pm

1 the "execute prog" thread number must match the C code thread number for that particular code yes?
No. The Button action can use whatever Thread in KFLOP you specify. It has nothing to do with what programs are in KMotion.exe screens.

2 i seem to remember my old mill would have a green light on the thread # ( init code )for that machine while running it?
If your Init program doesn't need to keep running to control/monitor anything then it can just terminate after configuring KFLOP. So if it terminates it will not be shown as still running.

3 i see VAR 113 for the rpm speed in several places but nothing for any other VAR. i dont understand anything about this
For G97 Constant Surface Speed to work KMotionCNC needs to pass info to KFLOP using a few variables. See below taken from PC-DSP.h

Code: Select all

// Persist Variable used with CSS Constant Surface speed for Spindle
// These parameters will be set when GCode switches to G97 CSS mode
// A User program in KFLOP must be running to monitor the mode an x position
// and alter the spindle RPM appropriately.
#define PC_COMM_CSS_MODE 110		// Mode 1=Normal RPM mode. 2=CSS
#define PC_COMM_CSS_X_OFFSET 111	// X axis counts for Radius zero
#define PC_COMM_CSS_X_FACTOR 112	// X axis factor to convert counts to inches 
#define PC_COMM_CSS_S 113			// S speed setting in inches/sec
#define PC_COMM_CSS_MAX_RPM 114		// Limit max RPM to this value as Radius approaches zero
Regards,

Tom Kerekes
Dynomotion, Inc.

turbothis
Posts: 316
Joined: Fri Mar 15, 2019 4:07 pm
Location: southern oregon

Re: simple 2 axis lathe initial lathe set up

Post by turbothis » Wed Dec 13, 2023 6:55 pm

do i need to enter any parameters now to use g97?

almost got everything hammered out and working

right now i can use my "init" and all axis function correctly but once i use the "turning" or "indexing" user buttons my X and Z axis swap arrow keys on the keyboard! :?
where is this happening?

"init"

Code: Select all

#include "KMotionDef.h"

int main() {

        // X axis
    
	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;
	ch0->FFAccel=0;
	ch0->FFVel=0;
	ch0->MaxI=200;
	ch0->MaxErr=200;
	ch0->MaxOutput=1000;
	ch0->DeadBandGain=1;
	ch0->DeadBandRange=0;
	ch0->InputChan0=0;
	ch0->InputChan1=0;
	ch0->OutputChan0=0;
	ch0->OutputChan1=0;
	ch0->MasterAxis=-1;
	ch0->LimitSwitchOptions=0x100;
	ch0->LimitSwitchNegBit=0;
	ch0->LimitSwitchPosBit=0;
	ch0->SoftLimitPos=1e+09;
	ch0->SoftLimitNeg=-1e+09;
	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=250;

	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=1;
	ch0->iir[2].B1=0;
	ch0->iir[2].B2=0;
	ch0->iir[2].A1=0;
	ch0->iir[2].A2=0;
    
        // Z axis
    
	ch1->InputMode=ENCODER_MODE;
	ch1->OutputMode=DAC_SERVO_MODE;
	ch1->Vel=130000;
	ch1->Accel=5e+07;
	ch1->Jerk=5e+07;
	ch1->P=10;
	ch1->I=0;
	ch1->D=20;
	ch1->FFAccel=0;
	ch1->FFVel=0;
	ch1->MaxI=200;
	ch1->MaxErr=200;
	ch1->MaxOutput=2000;
	ch1->DeadBandGain=1;
	ch1->DeadBandRange=0;
	ch1->InputChan0=1;
	ch1->InputChan1=0;
	ch1->OutputChan0=1;
	ch1->OutputChan1=0;
	ch1->MasterAxis=-1;
	ch1->LimitSwitchOptions=0x114;
	ch1->LimitSwitchNegBit=11;
	ch1->LimitSwitchPosBit=0;
	ch1->SoftLimitPos=1e+09;
	ch1->SoftLimitNeg=-1e+09;
	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=5000;
	ch1->StepperAmplitude=250;

	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=1;
	ch1->iir[2].B1=0;
	ch1->iir[2].B2=0;
	ch1->iir[2].A1=0;
	ch1->iir[2].A2=0;
	
	
	    //  spindle

	ch2->InputMode=ENCODER_MODE;
	ch2->OutputMode=DAC_SERVO_MODE;
	ch2->Vel=  10000;
	ch2->Accel=500000;
	ch2->Jerk= 500000;
	ch2->P=5;
	ch2->I=0;
	ch2->D=20;
	ch2->FFAccel=0;
	ch2->FFVel=0;
	ch2->MaxI=200;
	ch2->MaxErr=1e+06;
	ch2->MaxOutput=2000;
	ch2->DeadBandGain=1;
	ch2->DeadBandRange=0;
	ch2->InputChan0=2;
	ch2->InputChan1=0;
	ch2->OutputChan0=2;
	ch2->OutputChan1=0;
	ch2->MasterAxis=-1;
	ch2->LimitSwitchOptions=0x100;
	ch2->LimitSwitchNegBit=0;
	ch2->LimitSwitchPosBit=0;
	ch2->SoftLimitPos=1e+30;
	ch2->SoftLimitNeg=-1e+30;
	ch2->InputGain0=-1;
	ch2->InputGain1=1;
	ch2->InputOffset0=0;
	ch2->InputOffset1=0;
	ch2->OutputGain=1;
	ch2->OutputOffset=0;
	ch2->SlaveGain=1;
	ch2->BacklashMode=BACKLASH_OFF;
	ch2->BacklashAmount=0;
	ch2->BacklashRate=0;
	ch2->invDistPerCycle=1;
	ch2->Lead=0;
	ch2->MaxFollowingError=1000000;
	ch2->StepperAmplitude=20;
	
	ch2->iir[0].B0=1;
	ch2->iir[0].B1=0;
	ch2->iir[0].B2=0;
	ch2->iir[0].A1=0;
	ch2->iir[0].A2=0;

	ch2->iir[1].B0=1;
	ch2->iir[1].B1=0;
	ch2->iir[1].B2=0;
	ch2->iir[1].A1=0;
	ch2->iir[1].A2=0;

	ch2->iir[2].B0=1;
	ch2->iir[2].B1=0;
	ch2->iir[2].B2=0;
	ch2->iir[2].A1=0;
	ch2->iir[2].A2=0;
	
	
	EnableAxis(0);
    EnableAxis(1);
    EnableAxis(2);
    
	DefineCoordSystem(0,-1,1,-1);
    }

and my turning , indexing....

Code: Select all

#include "KMotionDef.h"

void main()
{
	    // turning / spindle

	ch2->InputMode=ENCODER_MODE;
	ch2->OutputMode=DAC_SERVO_MODE;
	ch2->Vel=  10000;
	ch2->Accel=500000;
	ch2->Jerk= 500000;
	ch2->P=5;
	ch2->I=0;
	ch2->D=20;
	ch2->FFAccel=0;
	ch2->FFVel=0;
	ch2->MaxI=200;
	ch2->MaxErr=1e+06;
	ch2->MaxOutput=2000;
	ch2->DeadBandGain=1;
	ch2->DeadBandRange=0;
	ch2->InputChan0=2;
	ch2->InputChan1=0;
	ch2->OutputChan0=2;
	ch2->OutputChan1=0;
	ch2->MasterAxis=-1;
	ch2->LimitSwitchOptions=0x100;
	ch2->LimitSwitchNegBit=0;
	ch2->LimitSwitchPosBit=0;
	ch2->SoftLimitPos=1e+30;
	ch2->SoftLimitNeg=-1e+30;
	ch2->InputGain0=-1;
	ch2->InputGain1=1;
	ch2->InputOffset0=0;
	ch2->InputOffset1=0;
	ch2->OutputGain=1;
	ch2->OutputOffset=0;
	ch2->SlaveGain=1;
	ch2->BacklashMode=BACKLASH_OFF;
	ch2->BacklashAmount=0;
	ch2->BacklashRate=0;
	ch2->invDistPerCycle=1;
	ch2->Lead=0;
	ch2->MaxFollowingError=1000000;
	ch2->StepperAmplitude=20;

	ch2->iir[0].B0=1;
	ch2->iir[0].B1=0;
	ch2->iir[0].B2=0;
	ch2->iir[0].A1=0;
	ch2->iir[0].A2=0;

	ch2->iir[1].B0=1;
	ch2->iir[1].B1=0;
	ch2->iir[1].B2=0;
	ch2->iir[1].A1=0;
	ch2->iir[1].A2=0;

	ch2->iir[2].B0=1;
	ch2->iir[2].B1=0;
	ch2->iir[2].B2=0;
	ch2->iir[2].A1=0;
	ch2->iir[2].A2=0;

	DefineCoordSystem(1,-1,0,-1);  // define the coordinate system
}

Code: Select all

#include "KMotionDef.h"

void main()
{
	     // A  axis / indexing
	   
	ch2->InputMode=ENCODER_MODE;
	ch2->OutputMode=DAC_SERVO_MODE;
	ch2->Vel=500000;
	ch2->Accel=5000000;
	ch2->Jerk= 5000000;
	ch2->P=10;
	ch2->I=0;
	ch2->D=10;
	ch2->FFAccel=0;
	ch2->FFVel=0;
	ch2->MaxI=200;
	ch2->MaxErr=1e+06;
	ch2->MaxOutput=2000;
	ch2->DeadBandGain=1;
	ch2->DeadBandRange=0;
	ch2->InputChan0=2;
	ch2->InputChan1=0;
	ch2->OutputChan0=2;
	ch2->OutputChan1=0;
	ch2->MasterAxis=-1;
	ch2->LimitSwitchOptions=0x100;
	ch2->LimitSwitchNegBit=0;
	ch2->LimitSwitchPosBit=0;
	ch2->SoftLimitPos=1e+30;
	ch2->SoftLimitNeg=-1e+30;
	ch2->InputGain0=-1;
	ch2->InputGain1=1;
	ch2->InputOffset0=0;
	ch2->InputOffset1=0;
	ch2->OutputGain=1;
	ch2->OutputOffset=0;
	ch2->SlaveGain=1;
	ch2->BacklashMode=BACKLASH_OFF;
	ch2->BacklashAmount=0;
	ch2->BacklashRate=0;
	ch2->invDistPerCycle=1;
	ch2->Lead=0;
	ch2->MaxFollowingError=1000000;
	ch2->StepperAmplitude=20;


	ch2->iir[0].B0=1;
	ch2->iir[0].B1=0;
	ch2->iir[0].B2=0;
	ch2->iir[0].A1=0;
	ch2->iir[0].A2=0;

	ch2->iir[1].B0=1;
	ch2->iir[1].B1=0;
	ch2->iir[1].B2=0;
	ch2->iir[1].A1=0;
	ch2->iir[1].A2=0;

	ch2->iir[2].B0=1;
	ch2->iir[2].B1=0;
	ch2->iir[2].B2=0;
	ch2->iir[2].A1=0;
	ch2->iir[2].A2=0;
	
	    EnableAxis(2);
	 	DefineCoordSystem(1,-1,0,2);  // define the coordinate system
        
}

User avatar
TomKerekes
Posts: 2559
Joined: Mon Dec 04, 2017 1:49 am

Re: simple 2 axis lathe initial lathe set up

Post by TomKerekes » Wed Dec 13, 2023 7:13 pm

In DefineCoordSystem()
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply