Handling G30 in KMotionCNC and Probe signal?
Moderators: TomKerekes, dynomotion
-
- Posts: 25
- Joined: Mon Dec 23, 2019 9:18 pm
Handling G30 in KMotionCNC and Probe signal?
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?
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: Handling G30 in KMotionCNC and Probe signal?
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.
Jeremy Brown posted a nice Probe routine and Video. I've attached a version of his code.
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.
Code: Select all
#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.
- Attachments
-
- jerbroZCircles_Rev2.c
- (6.97 KiB) Downloaded 181 times
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
-
- Posts: 25
- Joined: Mon Dec 23, 2019 9:18 pm
Re: Handling G30 in KMotionCNC and Probe signal?
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
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
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: Handling G30 in KMotionCNC and Probe signal?
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.
The related GCode Vars are listed below:
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.
The related GCode Vars are listed below:
Code: Select all
static const int _required_parameters[] = {
5161, 5162, 5163, /* G28 home */
5164, 5165, 5166,
5181, 5182, 5183, /* G30 home */
5184, 5185, 5186,
5211, 5212, 5213, /* G92 offsets */
5214, 5215, 5216,
5220, /* selected coordinate */
5221, 5222, 5223, /* coordinate system 1 */
5224, 5225, 5226,
5241, 5242, 5243, /* coordinate system 2 */
5244, 5245, 5246,
5261, 5262, 5263, /* coordinate system 3 */
5264, 5265, 5266,
5281, 5282, 5283, /* coordinate system 4 */
5284, 5285, 5286,
5301, 5302, 5303, /* coordinate system 5 */
5304, 5305, 5306,
5321, 5322, 5323, /* coordinate system 6 */
5324, 5325, 5326,
5341, 5342, 5343, /* coordinate system 7 */
5344, 5345, 5346,
5361, 5362, 5363, /* coordinate system 8 */
5364, 5365, 5366,
5381, 5382, 5383, /* coordinate system 9 */
5384, 5385, 5386,
RS274NGC_MAX_PARAMETERS
};
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Handling G30 in KMotionCNC and Probe signal?
Hi Tom
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
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
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: Handling G30 in KMotionCNC and Probe signal?
Hi Gerad,
I think in Mach3 the G28 position is set in Config | Homing Limits
HTH
I don't understand what you mean by "MACH3 parameter list".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 think in Mach3 the G28 position is set in Config | Homing Limits
That only applies when using KMotionCNC not Mach3I have read this parameters for G28 could be set in ems.var if KMotion is used.
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,0Where or how can it be set in C-program on KFlop?
HTH
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Handling G30 in KMotionCNC and Probe signal?
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
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
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: Handling G30 in KMotionCNC and Probe signal?
Hi Gerad,
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.
Its simplest to have a quadrature encoder on the Spindle.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?
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.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Handling G30 in KMotionCNC and Probe signal?
Hi Tom
can you recommend an encoder?
BR
Gerad
can you recommend an encoder?
BR
Gerad
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: Handling G30 in KMotionCNC and Probe signal?
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.
HTH
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.
HTH
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.