Halt and resume GCodes
Moderators: TomKerekes, dynomotion
-
- Posts: 30
- Joined: Fri Jun 17, 2022 11:21 am
Halt and resume GCodes
When a custom G code like MoveAtVel(AXIS_Y,(coordinate)*10000,speed*10000/60 ); is executed in KMotionCNC ; . When you press the F5 button, the interpreter window sometimes pops up with the loss of the trajectory. How to pause code execution correctly?
- TomKerekes
- Posts: 2679
- Joined: Mon Dec 04, 2017 1:49 am
Re: Halt and resume GCodes
Hi Ivan,
Did you mean a Custom MCode that executes a C Program to make a Move?
If after the Move the Code waits until the motion is completed then executes a Halt next line such as this:
And the MCode is configured to Exec/wait/sync then the Interpreter should be synchronized with the new position and be able to resume cleanly.
Did you mean a Custom MCode that executes a C Program to make a Move?
If after the Move the Code waits until the motion is completed then executes a Halt next line such as this:
Code: Select all
#include "KMotionDef.h"
#define TMP 10
#include "C:\PerforNext\CNC\User\C Programs\KflopToKMotionCNCFunctions.c"
void main()
{
MoveRel(0,10000);
while (!CheckDone(0));
DoPC(PC_COMM_HALT_NEXT_LINE);
}
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
-
- Posts: 30
- Joined: Fri Jun 17, 2022 11:21 am
Re: Halt and resume GCodes
My code will execute on command M 104, I want the operator to be able to stop the code and continue without popup.
- TomKerekes
- Posts: 2679
- Joined: Mon Dec 04, 2017 1:49 am
Re: Halt and resume GCodes
I'm not sure what you mean by "I want the operator to be able to stop the code".
But the example I gave should stop and allow a resume without the popup.
But the example I gave should stop and allow a resume without the popup.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
-
- Posts: 30
- Joined: Fri Jun 17, 2022 11:21 am
Re: Halt and resume GCodes
M104 exec/wait/sync
Code: Select all
#include "KMotionDef.h"
#include "Mikromat InputOutput.h"
void main()
{
MoveAtVel(2, -1000, 1000 * 1000 / 60);
while (!CheckDone(2));
}
Code: Select all
#include "KMotionDef.h"
#include "Mikromat InputOutput.h"
void main()
{
MoveAtVel(2, 0, 1000 * 1000 / 60);
while (!CheckDone(2));
}
- TomKerekes
- Posts: 2679
- Joined: Mon Dec 04, 2017 1:49 am
Re: Halt and resume GCodes
Hi Ivan,
Ah, I didn't realize you were randomly hitting Halt.
I'm not sure how you expect that to work, if you have a C Program that is supposed to do something and you Halt it part way through then KMotionCNC doesn't have a way to resume the C Program part way through. So it asks is if it ok to re-execute the C Program from the beginning after doing these things.
Maybe you could explain your application in detail and what are you trying to do.
You could probably create a new "Halt" button that would wait until the C Program finishes and then Halt.
Ah, I didn't realize you were randomly hitting Halt.
I'm not sure how you expect that to work, if you have a C Program that is supposed to do something and you Halt it part way through then KMotionCNC doesn't have a way to resume the C Program part way through. So it asks is if it ok to re-execute the C Program from the beginning after doing these things.
Maybe you could explain your application in detail and what are you trying to do.
You could probably create a new "Halt" button that would wait until the C Program finishes and then Halt.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.