6 axis wire edm

Moderators: TomKerekes, dynomotion

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

Re: 6 axis wire edm

Post by TomKerekes » Fri Sep 25, 2020 3:44 pm

Hi Mariano,

#include includes files not threads. Yes you can #include as many files as you want in a C Program. It isn't clear what you are attempting to do. #include simply replaces the #include with the text of the file. Its simpler to just put the code in place yourself. You might read this about how Threads work (which is unrelated to including files).
Regards,

Tom Kerekes
Dynomotion, Inc.

Rasta
Posts: 31
Joined: Fri Mar 08, 2019 8:24 pm

Re: 6 axis wire edm

Post by Rasta » Fri Nov 06, 2020 12:08 am

HI Tom, I have all axis going on a bench with my spare kflop/kanalog , and i want to implement the home routine
at the moment Im concentrating in the Z axis , and using jp15 in the kanalog , by hooking up a N.C. switch via a +5v supply
to the + termional of the jp15 IO 138.
I can see the tick mark in Kmotion digital IO screen on IO 138 , when I depress the switch,
When I start the home program it goes towards the top of z axis , but it does not read the limit switch when I depress it
I believe that this program does not look at the Kanalog interrupts , but im a very far from being a novice , let alone an expert on C
this is the program
can you please help?


#include "KMotionDef.h"
#include "SimpleHomeIndexFunction.c"
#define TMP 10
#include "KflopToKMotionCNCFunctions.c"
// home subroutine
main()
{
int result;


ch0->LimitSwitchOptions = 0x0;
ch0->SoftLimitPos = 1e30;
ch0->SoftLimitNeg = -1e30;
ch4->LimitSwitchOptions = 0x0;
ch4->SoftLimitPos = 1e30;
ch4->SoftLimitNeg = -1e30;
ch5->LimitSwitchOptions = 0x0;
ch5->SoftLimitPos = 1e30;
ch5->SoftLimitNeg = -1e30;

// HOME Z

result = SimpleHomeIndexFunction(0, // axis number to home
10000.0, // speed to move toward home
+1, // direction to move toward home (+1 or -1)
138, // limit bit number to watch for
0, // limit polarity to wait for (1 or 0)
100.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)
750000); // amount to move inside limits

if (result == 0)
{
printf("Home Z succeded\n");
}
else
{
printf("Home Z failed\n");
return;
}

// HOME X

result = SimpleHomeIndexFunction(4, // axis number to home
5000.0, // speed to move toward home
+1, // direction to move toward home (+1 or -1)
0, // limit bit number to watch for
1, // limit polarity to wait for (1 or 0)
100.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)
45000); // amount to move inside limits

if (result == 0)
{
printf("Home X succeded\n");
}
else
{
printf("Home X failed\n");
return;
}

// HOME Y

result = SimpleHomeIndexFunction(5, // axis number to home
10000.0, // speed to move toward home
-1, // direction to move toward home (+1 or -1)
0, // limit bit number to watch for
1, // limit polarity to wait for (1 or 0)
100.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)
43000); // amount to move inside limits

ch0->LimitSwitchOptions = 0x0;
ch0->SoftLimitPos = 46000;
ch0->SoftLimitNeg = -46000;
ch4->LimitSwitchOptions = 0x0;
ch4->SoftLimitPos = 60000;
ch4->SoftLimitNeg = -10000;
ch5->LimitSwitchOptions = 0x0;
ch5->SoftLimitPos = 18000;
ch5->SoftLimitNeg = -30000;
DoPC(PC_COMM_HALT); // stop KMotionCNC
if (result == 0)
{
printf("Home Y succeded\n");
}
else
{
printf("Home Y failed\n");
return;
}

}


regards
Mariano

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

Re: 6 axis wire edm

Post by TomKerekes » Fri Nov 06, 2020 1:33 am

Hi Mariano,

I don't see anything obviously wrong.

When the limit switch switch is "hit" does the Digital IO Screen show checked or unchecked?

Which direction is positive Z? Up? You might use the Console Screen to Jog slowly and observe the Axis Screen.

What is the resolution of your Z axis? How far is 750000 counts? Seems like a big number to move just slightly away from limit.

You might observe the Axis Screen when you command home.

You might add diagnostic printf statements to SimpleHomeIndexFunction.c so you know what it is doing.

Please post code with the Code Tag </> so it is easy to read.
Regards,

Tom Kerekes
Dynomotion, Inc.

Rasta
Posts: 31
Joined: Fri Mar 08, 2019 8:24 pm

Re: 6 axis wire edm

Post by Rasta » Sun Nov 08, 2020 8:27 am

Hi Tom;
thank you for your help, got the program doing what it supposed to do.
This program , knows were the limits are , and will throw a feed hold and wont allow to pass any limit, that has been set
This bring me to the new feature that I want to implement.
I want the controller to look ahead in the gcode program before executing and give me a error if the limits are going to be reach
Can it be done? if so can you help please? Wire Edm machines are very slow process machines , and the look ahead feature is a must in my opinion
Of course after the program is finished and working ok I will post the code here for everyone benefit.
Mariano

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

Re: 6 axis wire edm

Post by TomKerekes » Sun Nov 08, 2020 4:57 pm

Hi Mariano,

Pushing the "Run" button will run a simulation and should flag any Soft Limit Errors.

HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

Rasta
Posts: 31
Joined: Fri Mar 08, 2019 8:24 pm

Re: 6 axis wire edm

Post by Rasta » Tue Nov 24, 2020 11:25 pm

Thank you Tom
Regards
Mariano

Rasta
Posts: 31
Joined: Fri Mar 08, 2019 8:24 pm

Re: 6 axis wire edm

Post by Rasta » Tue Nov 24, 2020 11:35 pm

Hi Tom;
one question on microstepping setting
Im having problems with my stepper motor not being as smooth as I would like with the 10 microstep setting in the driver
as I have no other available setting ..Can you please tell me if I can use the microstepping setting in kmotion, so I can combine both
,for example , 10 microsteps in the driver multiplied , by 10 microsteps in the Kmotion setting =100.
can it be done?
thank you
rasta
Untitled.png

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

Re: 6 axis wire edm

Post by TomKerekes » Wed Nov 25, 2020 3:00 pm

Hi Rasta,

No. If your Driver has a certain step size there is nothing the Controller can do to move less than 1 step.

"Microstepping" mode is for use with our SnapAmp Driver where it controls motor coil currents directly in a sinusoidal manner that achieves very high effective microstepping.
Regards,

Tom Kerekes
Dynomotion, Inc.

Rasta
Posts: 31
Joined: Fri Mar 08, 2019 8:24 pm

Re: 6 axis wire edm

Post by Rasta » Fri Nov 12, 2021 9:16 am

Hi Tom;
my machine is in the latter stages of development , and there is one thing that concern me , and its that with my very limited knowledge of
C, programming , when the emergency stop is pressed , (bit 16 in my system) only Kmotion CNC is reset , but all the other bits , don't turn off .
I have the pumps on bit 144,145,146,and 147, and I energise them with a Mcode command , in the cnc Gcode program .
I would like that these bits would turn off when I press the emergency stop, at the moment these bits can only be turned off if I invoque a m5, or m30 , but I want to do it in a hurry, if I need to do so.
is there any other way, apart from a reboot command or a hard reset??
thank you
Mariano

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

Re: 6 axis wire edm

Post by TomKerekes » Fri Nov 12, 2021 3:42 pm

Hi Mariano,

Add a forever loop to the end of your Initialization C Program to read the EStop input, and if active, do whatever you desire to do, such as clear those outputs. See also here.
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply