Hi gehigley,
Having the ability to code your own Home program in C allows infinite flexibility and control over the method used to home your system.
The standard methods that most controllers offer are already coded in C for you so you don't have to write any code. All you need to do is set all the parameters for your system like you would need to do with any system. In any case you must understand how your system should be homed: ie which order, what directions, what speeds, what home sensor inputs are used, what the polarity of the inputs are, etc... See the Example:
\C Programs\SimpleHomeIndexFunctionTest.c
HTH Regards TK
Group: DynoMotion |
Message: 11476 |
From: gehigley |
Date: 5/5/2015 |
Subject: Re: kmotion |
Thanks guys, I appreciate all the help, I think I confused you tom as how I used the term home so loosely, Im not that advanced, I am not trying to home the machine, I simply want to have a button that tells the machine to go to X zero Y zero is all. That's prob really simple but yet seems like a mountain for me, lol.
|
|
Group: DynoMotion |
Message: 11477 |
From: Tom Kerekes |
Date: 5/5/2015 |
Subject: Re: kmotion |
Hi gehigley,
To simply move an Axis using C Code there is a C Function called "Move" that accepts two parameters. The first is the axis to move and the second is the absolute machine position to move to in KFLOP units.
So to write a C Program to move Axes #0 and #1 (I assume those are your x and y axes) both to zero you could use the C Code below. The #include "KMotionDef.h" is needed to include the file that defines all the available KFLOP functions and variables including "Move" for the C Compiler. The main() function definition instructs the C compiler where the program should begin execution. The curly brackets show the compiler where the main function begins and ends.
Try pasting this code into Thread #2 in the KMotion.exe C Programs Screen and save it as a file called something like GoZero.c Then press the "Save, Compile, Download, Run" button and see if your xy axes move to machine coordinates 0,0.
#include "KMotionDef.h" main() { Move(0,0); Move(1,0); }
Let us know how much of this makes sense. Regards TK
Group: DynoMotion |
Message: 11479 |
From: gehigley |
Date: 5/5/2015 |
Subject: Re: kmotion |
Thanks Tom, I think im starting to figure this stuff out a little, I forget where I found it but because I have dual steppers moving in y and 1 stepper moving in x........I found a spot somewhere in kmotion setting that showed me that 0 and 1 had the same number and 2 was totally different, so I assumed that the two that were the same was the y axis leaving 2 for the x so I believe...... SO I altered what you showed me, I was afraid that one axis might move on the y axis causing the gantry to move at an angle.
#include "KMotionDef.h" main() { Move(0,0); Move(1,0); Move(2,0);
} So this is what I used instead as I crossed my fingers. I did exactly what you said to do and I ran it, what happened next was it moved to 0,0 only in machine coordinates, how would I get it to work if I zero all axis at a location on the table moved it say 4 inches up and across the table having it to move right back where I zeroed it at in stead of machine cords?
|
|
Group: DynoMotion |
Message: 11480 |
From: Tom Kerekes |
Date: 5/5/2015 |
Subject: Re: kmotion |
Hi gehigley,
Moving 3 axes to move xy doesn't seem right. If your Y axis has two motors properly slaved together then commanding the Master should cause both to move. Its important for you to know your own system and exactly how it is designed and configured. You should figure all that out and document it first before trying to add new features.
I had mentioned that the moves would be in absolute machine coordinates. To move to locations that involve Interpreter Offsets is somewhat more complex and there are several methods that could be used. But I think it would be simpler to be executed in GCode as:
G0X0Y0 M30
If you type those into a Gcode file that has a file extension of *.ngc you can simply assign that to a User Button of type "Exec Program". The file extension of *.ngc will cause KMotionCNC to execute it as GCode instead of C Code in KFLOP.
Regards TK
Group: DynoMotion |
Message: 11481 |
From: gehigley |
Date: 5/5/2015 |
Subject: Re: kmotion |
Thank you so much Tom, I am an idiot but coming along lol, so I tried
#include "KMotionDef.h" main() { Move(0,0); Move(1,0);
}
to make sure the table is configured right and it worked so that's good but thank you for the work around, gcode I understand a little better. I didn't know it would run Gcode like a program so I did this, it works for me, kind of cautious when it comes to telling the mill to come out of a part and return home, first I want it to come out of the part a safe z height, then pause a moment before running across the part so this is what I came up with, it works for me and it works, thank you so much for all your help.
G0Z0.1250 G4 P3 G0 X0 Y0 M30
Thanks again
|
|
| | | | | |