Reset Custom M-codes on Machine Disable?

  • Todd Zuercher
  • Todd Zuercher's Avatar Topic Author
  • Away
  • Platinum Member
  • Platinum Member
More
28 May 2026 17:18 #346706 by Todd Zuercher
Reset Custom M-codes on Machine Disable? was created by Todd Zuercher
A machine I'm working with uses a couple of M1xx custom M-codes to put the machine in a peculiar state for some machining processes.  This causes some significant problems if they are not properly canceled in the appropriate way.  To help with this, I would like to be able to "reset" the hal pins that the custom M-codes manipulate if the machine is disabled (put in the F2 "machine off" state.)  Is there a way to do this that won't interfear with the way the custom M-codes setp the hal pins they need to manipulate?  Basically I need the machine to setp certain hal pins when it goes to the "Machine Off" state.

Please Log in or Create an account to join the conversation.

  • spumco
  • Away
  • Platinum Member
  • Platinum Member
More
28 May 2026 18:36 #346707 by spumco
Replied by spumco on topic Reset Custom M-codes on Machine Disable?
Are you looking for an 'abort' sequence, or a machine-is-off/tripped sequence?

The abort - i.e. an aborted g-code program - you can do with an on-abort.ngc that calls various M-codes to set the machine in a state you want.

If you need to force hal pins or write specific values to pins, you can create a bash program M-code and directly manipulate the hal pins.

I'm sympathetic to your question because I really, really need to go through all my custom stuff/logic and figure out the same thing you're thinking about now.  What are the various machine states, and what do I want to happen when it turns back on?

Example - I have a pneumatic door cover for my ATC.  If I stop the machine in the middle of a tool change the door stays open.  But when I retract the ATC (manual ATC M-codes) and restart LCNC, the door slams shut the moment the machine is 'on.'  Scares the you-know-what out of me every time.

It's not a graceful error-handling situation.

I'm rambling here, but I suspect all of the machine-state error handling and permissions might be better handled in Ladder.

Please Log in or Create an account to join the conversation.

Time to create page: 0.153 seconds
Powered by Kunena Forum