Exit C program on Halt or Feed Hold

Moderators: TomKerekes, dynomotion

Post Reply
axeman
Posts: 15
Joined: Thu Jan 25, 2018 2:40 am

Exit C program on Halt or Feed Hold

Post by axeman » Mon Apr 25, 2022 11:41 pm

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

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

Re: Exit C program on Halt or Feed Hold

Post by TomKerekes » Tue Apr 26, 2022 4:51 pm

Hi Laurence,

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

if (CS0_StoppingState != 0) ...
Regards,

Tom Kerekes
Dynomotion, Inc.

axeman
Posts: 15
Joined: Thu Jan 25, 2018 2:40 am

Re: Exit C program on Halt or Feed Hold

Post by axeman » Wed Apr 27, 2022 9:04 pm

Thank you Tom,
That is just what I needed, I now have one more safety in place for my peace of mind.

Regards,
Laurence

Post Reply