Author Topic: M code for e-stop  (Read 3127 times)

0 Members and 1 Guest are viewing this topic.

Offline Dirty Steve

  • Active Member
  • Posts: 6
    • View Profile
M code for e-stop
« on: January 17, 2013, 04:25:30 PM »
Is there a valid M code for E-stop? Wiki shows M112, but that doesn't seem to work in Mach3.

Offline HimyKabibble

  • V4 Screen Contributor
  • Posts: 1,687
    • View Profile
Re: M code for e-stop
« Reply #1 on: January 17, 2013, 04:37:34 PM »
There is no M-code for E-stop, but you could create one in VB.  Not sure why you'd want to though....

Regards,
Ray L.
Regards,
Ray L.

Offline Hood

  • Mach4 Alpha
  • Posts: 25,775
  • Carnoustie, Scotland
    • View Profile
Re: M code for e-stop
« Reply #2 on: January 17, 2013, 04:39:53 PM »
I am having a hard time understanding how you could have such a thing as a M Code for E-Stop.
E-Stop is for emergency situations so you could not possibly insert that into code as you never know when an emergency will happen ;)
If you are meaning Stop or Reset then you can do either with a custom macro and have a m number for it, still not sure why you wwould want even something like that but.......
Hood

Offline Dirty Steve

  • Active Member
  • Posts: 6
    • View Profile
Re: M code for e-stop
« Reply #3 on: January 17, 2013, 05:25:00 PM »
Ok, let me elaborate a little.

I'm running a Reprap style 3d printer with Mach3. I have disabled E-stop on program end so that my setup does not E-stop when I load a new file. I have my heated elements running off of the spindle relay, and when an E-stop is triggered, my PID temperature controllers turn off and I have to wait for the PID to cycle before it comes back to temperature and settles.

But I do want the system to E-stop when a print is completed so that the heaters and controller turn off.

Offline Hood

  • Mach4 Alpha
  • Posts: 25,775
  • Carnoustie, Scotland
    • View Profile
Re: M code for e-stop
« Reply #4 on: January 17, 2013, 05:31:27 PM »
Ok so really you want Mach to go into reset rather than it being an E-Stop.
Simple enough to do via a macro.
Open notepad and type the following

DoOemButton(1021)

Then save it as a M number (101 up which is not already used by you if you have any custom macros) with a file extension of m1s and save it to your macro folder of the profile you are using. For example save as m101.m1s and when you call that from MDI or Code Mach will go into reset.
Hood

Offline Dirty Steve

  • Active Member
  • Posts: 6
    • View Profile
Re: M code for e-stop
« Reply #5 on: January 17, 2013, 05:46:05 PM »
Thanks Hood, exactly what I was looking for!

Offline Tarak

  • Active Member
  • Posts: 227
    • View Profile
Re: M code for e-stop
« Reply #6 on: October 12, 2014, 05:32:14 PM »
Hi guys, I've just done the same with a virtual E-Stop, when I press the button, it works correctly by resetting all the outputs and puts the machine into an E-Stop condition, but when I press the same button, it won't clear the E-Stop, do I need to use a different OEM code for clearing it?

DoOemButton(1021)
SetUserLED(1001,0)
SetUserLED(1002,0)

BTW I'm only using a custom macro so I can reset some custom LEDs I have on the screen.
Darc

Offline Hood

  • Mach4 Alpha
  • Posts: 25,775
  • Carnoustie, Scotland
    • View Profile
Re: M code for e-stop
« Reply #7 on: October 12, 2014, 06:03:01 PM »
I presume when you say  "a virtual E-Stop, when I press the button" you are meaning a screen button?
If so it should work fine, I have just tested by placing a VB button on screen with that code and it is working.
Hood

Offline Tarak

  • Active Member
  • Posts: 227
    • View Profile
Re: M code for e-stop
« Reply #8 on: October 12, 2014, 06:48:06 PM »
Hi Hood, thanks, I just tried in a VB button and it works perfectly.
I was trying in a M code which was run from within a VB button, I just couldn't get this way to work.
Thanks and sorry to trouble you.
Darc