Page 1 of 1

Exit C program on Halt or Feed Hold

Posted: Mon Apr 25, 2022 11:41 pm
by axeman
I am using a C program to handle auto tool changes.
If the toolchange program is running and I hit the Halt or FeedHold buttons in KmotionCNC, the axes halt but the C program continues, resulting in the ejection of the tool from the spindle wherever it has halted on the table. Not ideal.
What code can I add to the toolchange program to test for Halt or FeedHold and exit out of the toolchange C program to prevent this from occurring?
Or is there a better way to prevent this situation from occurring?

Regards,
Laurence

Re: Exit C program on Halt or Feed Hold

Posted: Tue Apr 26, 2022 4:51 pm
by TomKerekes
Hi Laurence,

You can check if a Feed Hold has been commanded (Halt should also issue a feedhold) with:

if (CS0_StoppingState != 0) ...

Re: Exit C program on Halt or Feed Hold

Posted: Wed Apr 27, 2022 9:04 pm
by axeman
Thank you Tom,
That is just what I needed, I now have one more safety in place for my peace of mind.

Regards,
Laurence