G-code question

I am using the Xcarve unit for a test tool where I work. I reviewed the G-code commands but didn’t find what I’d hopped for. I have two RS232 devices, the Xcarve and a load cell. I am polling the load cell as fast as I can and also polling the Xcarve using the “?” which returns a string that says it busy or not. In doing so, I lose data from the load cell. Is there a command that will have the G-code side send a “in position” type output? That way I can use an Event trap on the the serial line and have it trigger so I know to stop collecting sensor data… I programming in VB6 and doesn’t have the ability to multi-thread.

And yes, I should move on to a more up-to-date language…

I hope there is some hidden features in the G-code instruction set…

Thanks!
Stephen

Can you give me a little more information about your process?

Is it something like: start collecting data, tell the X-carve to move to a location, once the X-carve is at that location stop collecting data.

Is this a one time event, or is it repetitive?

If you are not polling the X-carve can you collect the load cell data without loss?

Can you just create a custom M-code to trigger a “?” query when the C-carve executes the line of code after moving to the desired position?

Try sending a “G04 P.1” after each move, and poll for “ok” and a CR in a loop, and when you get it the X-Carve should be in position. May be faster then the “?” command.
John

2 Likes

Oh, does dwell report completion? That’s the way to go then.

GRBL will not send the “ok-CR” until after the current move in progress has completed.
More here: Command to return Grbl command queue state · Issue #932 · grbl/grbl · GitHub

Edit: Try with the Px value very small - not sure what is the lowest possible.

1 Like

Px value ? not sure what you mean by that…

Position x…?

The Px is the dwell time. The syntax for the dwell is “G4 Px” where G4 is the dwell g-code, P is the command input prefix and x is the variable for time in seconds to dwell. So, to dwell for 0.1 seconds you would send “G4 P0.1”

2 Likes