I am interested in using G30 which appears to be supported since it is on the help screen but there is no information on how it is implemented and what default hardware bits are used to communicate with a probe. Is that only available in Mach plugins, or can it be used by anyone with Kflops/Kanalog hardware? Is there a way to change mapping of Probe bits if the defaults are already used for other functions?
Re: Handling G30 in KMotionCNC and Probe signal?
Posted: Fri Feb 07, 2020 4:57 pm
by TomKerekes
Hi Larry,
KMotionCNC implements G30 as Move to Reference Position #2 (ie Home position #2) not Probing.
You can implement Probing in KMotionCNC with an M Code that calls a C Program.
Here is the ProbeDirection.c example to simply probe in a specified direction, at a specified speed, and stop when the probe triggers.
#include "KMotionDef.h"
// For basic KMotionCNC Probing configure KMotionCNC to call this C Program
// with an MCode and 3 parameters P Q R passed in variables 50,51,52 to
// specify the X Y Z Probe directions speeds
//
// Modify this program for the input bit you are using for your probe. As
// written the program keeps moving until the bit goes high. If the polarity
// of your probe is opposite this then remove the NOT Symbol '!' applied to the
// ReadBit result.
//
// For Example:
//
// M100 = Exec/Wat/Sync Thread 2 Var 50 <>\C programs\ProbeDirection.c
//
// Then to probe in the X direction at 100 counts/sec use GCode as:
//
// M100 P100 Q0 R0
//
// Then to probe in the Y direction at 50 counts/sec use GCode as:
//
// M100 P0 Q50 R0
//
//
main()
{
Jog(0,*(float *)&persist.UserData[50]); // move in the velocites specified
Jog(1,*(float *)&persist.UserData[51]);
Jog(2,*(float *)&persist.UserData[52]);
// printf("X Y Z Speeds = %f %f %f\n",
// *(float *)&persist.UserData[50],
// *(float *)&persist.UserData[51],
// *(float *)&persist.UserData[52]);
while (!ReadBit(46)) ; // wait for switch to go high
Jog(0,0); //Stop
Jog(1,0);
Jog(2,0);
}
Jeremy Brown posted a nice Probe routine and Video. I've attached a version of his code.
Re: Handling G30 in KMotionCNC and Probe signal?
Posted: Fri Feb 07, 2020 6:27 pm
by larryjamessmith
Tom,
Thank you for this info. I will use your method.
So, out of curiosity, what is "Reference Position 2"? I know Reference Position 1 is machine 0,0,0.
Larry
Re: Handling G30 in KMotionCNC and Probe signal?
Posted: Fri Feb 07, 2020 7:26 pm
by TomKerekes
Hi Larry,
Actually setting GCode Variables with the Vars file specified in Tool Setup can be used to configure where G28 and G30 go. By default they will be zero.
I use Kflop with MACH3 and Schmidt Screen.
Now I tried to work with Fusion360.
The postprocessor from Fusion like to use G28
I have set home offsets in MACH3 parameter list, but if G28
occurs the machine likes to go to 0,0,0.
Normal homing process works well, I have defined my switch positions
in C-Code at startup.
I have read this parameters for G28 could be set in ems.var if KMotion is used.
Where or how can it be set in C-program on KFlop?
BR
Gerad
Re: Handling G30 in KMotionCNC and Probe signal?
Posted: Thu Feb 27, 2020 7:37 pm
by TomKerekes
Hi Gerad,
I use Kflop with MACH3 and Schmidt Screen.
Now I tried to work with Fusion360.
The postprocessor from Fusion like to use G28
I have set home offsets in MACH3 parameter list, but if G28
occurs the machine likes to go to 0,0,0.
I don't understand what you mean by "MACH3 parameter list".
I think in Mach3 the G28 position is set in Config | Homing Limits
I have read this parameters for G28 could be set in ems.var if KMotion is used.
That only applies when using KMotionCNC not Mach3
Where or how can it be set in C-program on KFlop?
I don't think there is a way to change G28 from KFLOP. Depending on how you home you can set 0,0,0 to be anywhere you wish if that helps. To do this set some position at your home location other than 0,0,0
HTH
Re: Handling G30 in KMotionCNC and Probe signal?
Posted: Fri Feb 28, 2020 6:29 pm
by Gerad
Hi Tom
thanks for fast response.
Another question: I would like to measure spindle revolutions with magnetic sensor
and display it in MACH3 screen.
Is it possible to count the tics/sec an send to MACH3?
BR
Gerad
Re: Handling G30 in KMotionCNC and Probe signal?
Posted: Fri Feb 28, 2020 6:59 pm
by TomKerekes
Hi Gerad,
I would like to measure spindle revolutions with magnetic sensor
and display it in MACH3 screen.
Is it possible to count the tics/sec an send to MACH3?
Its simplest to have a quadrature encoder on the Spindle.
Otherwise you should be able to either:
1 - monitor the pulses with a C Program (which executes at least every 270us) and update an Axis Position with a pulse count.
2 - use a circuit (RC delay) to form a quadrature type of A B signal and have an KFLOP encoder input count pulses.
Then configure Mach3 Threading as described in Step 5 here.
Update rate may likely be low with only 1 pulse per revolution.
Re: Handling G30 in KMotionCNC and Probe signal?
Posted: Sat Feb 29, 2020 12:24 pm
by Gerad
Hi Tom
can you recommend an encoder?
BR
Gerad
Re: Handling G30 in KMotionCNC and Probe signal?
Posted: Sat Feb 29, 2020 4:27 pm
by TomKerekes
Hi Gerad,
USDigital is a good source. Choose a differential output as those can be connected to differential inputs or single ended inputs. Choose a resolution that will keep the cycles/second less than 250,000 cycles/second (1,000,000 quadrature counts/second) at your highest speed.