Continue GCode w/ Axes Disabled

Moderators: TomKerekes, dynomotion

Post Reply
a_j_p
Posts: 18
Joined: Sun Aug 26, 2018 10:13 pm

Continue GCode w/ Axes Disabled

Post by a_j_p » Fri Jun 25, 2021 3:37 pm

So I built a pick-and-place robot with Kflop + Kstep to test some sensors I am using - my problem right now is the electronics that I am using to read these sensors is built on development boards and is pretty much impossible (at this point) to shield from motor noise.

If I kill the motor power however (i.e. disable()) then the noise lowers to an acceptable level... Is there any way to run GCode that will intermittently disable/re-enable the motors?

I have tried using M codes to run programs (i.e. M100 disables all axes motors and M101 re-enables them) via something simple like the below GCode example - but when the GCode gets to the first M100 (disable) it aborts the program due to the Axes being Disabled... Is there a workaround for this somehow?

G21 G54
G0Z20
G4P0.5
G0X0Y0
G4P0.5

G1Z0F500
G4P.1
M100
G4P5
G1Z20F500
G4P.1
M100
G4P5

G1Z20F500
G0X0Y0
M30

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

Re: Continue GCode w/ Axes Disabled

Post by TomKerekes » Fri Jun 25, 2021 4:16 pm

Hi a_j_p,

I don't really understand how you would expect the axis to be moved after the axis is disabled.

If you un-define the axis from the coordinate system you should then be able to disabled the un-defined axes.

Do you have M100 and M101 configured to wait?

Its not clear what you mean by disable(). You might have posted the code. I wouldn't expect disabling the KFLOP Motor Axes to change the level of noise. You would need to disable the Drives (KStep via bit 45).

What are the sensors connected to? Maybe you could add a digital noise filter in KFLOP.
Regards,

Tom Kerekes
Dynomotion, Inc.

a_j_p
Posts: 18
Joined: Sun Aug 26, 2018 10:13 pm

Re: Continue GCode w/ Axes Disabled

Post by a_j_p » Fri Jun 25, 2021 6:39 pm

The sensors are unrelated to the kflop system, so they are connected through the dev board into a separate computer. I am just using a Kflop system to pick and place weights in repeatable locations on the sensors and record data from those sensors.

I wasn't hoping for any axis to move when disabled (though now I see the GCode I posted originally had no M101 to re-enable which was a mistake), but rather hoping I could disable/kill power and pause for a set time interval, re-enable the system and move as needed, kill power and pause, etc. for a certain number of pick/place in set locations.

Your mention of ClearBit(45); actually got me digging deeper. The program that I was running for M100 was as follows:

int main()
{
ClearBit(45);
DisableAxis(1);
DisableAxis(2);
DisableAxis(3);
return 0;
}

After removing the three DisableAxis() lines KMotionCNC no longer aborts the GCode and the result is what I need. Add in the M101 after the pause to re-enable everything and it does what I need.

So now it seems that this is solved with some GCode like below:

G1 Z0 F500
G4 P0.1
M100
G4 P5
M101
G4 P0.1
G1 Z20 F500

Thanks Tom,
-Andrew

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

Re: Continue GCode w/ Axes Disabled

Post by TomKerekes » Fri Jun 25, 2021 7:15 pm

Hi a_j_p,

ok great thanks for the time to post back.

I suppose another solution would be to use only one MCode which disables, delays, and re-enables.
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply