View Full Version : Help with Mach3 inputs and VB script ?

26-11-2013, 01:41 PM
In my other thread about the cnc control panel I added a relay contact for the charge pump into my emergency stop circuit. To cut a long story short I had a chicken and egg situation whereby the emergency stop relay would not reset because Mach3 was not running, but Mach3 would not run because the emergency stop was not reset.
Anyway I found a solution by adding some extra contact blocks onto my physical reset button, these temporarily short out the charge pump relay in the E/stop circuit thus allowing the emergency stop relay to energise, another contact is the E/Stop input to Mach3 and another contact is an input to Mach3 via the BOB that is linked to OEM trigger 1021 (Reset).
Now I thought that would have done it but there's a timing issue and the only solution that works is to have the input for OEM 1021 cycle from ON to OFF before the physical reset push button is released.
My initial idea was a one-shot circuit from a 555 timer or maybe a cheap off delay plug in timer but first I'd like to know if this can be achieved in software using VBscript etc. within Mach3. Obviously I've looked at creating macros etc. with the doOEMButton function but I can't see how to make an input from a physical push button act like a one-shot so any ideas ?

26-11-2013, 05:43 PM
Look at using brains has they can watch an input and respond to it much quicker than a Macro.

But what your doing is wrong any way I think.? Why have you got Mach involved in the E-stop at all.? All you should be doing is informing Mach an e-stop has occurred. The only involvement Mach should have is to halt the running G-code and then Refuse to RESET SOFTWARE if it doesn't receive a signal saying the E-stop circuit is safe.
It shouldn't be involved in the E-stop Circuit at all and if the Circuit is safe MACH should be safe to RESET SOFTWARE.

If you include the Charge Pump Signal in the E-stop circuit then If E-stop circuit is safe MACH will See the Charge pump signal and allow SOFTWARE RESET then you can continue with CYCLE start and running the Program..

Now I'm highlighting SOFTWARE RESET because this is different to the Momentary Reset you'll want to bring the Control back to life if all is safe.

26-11-2013, 07:32 PM
I've got Mach in the E/stop circuit because I'm thinking that if it stops running I'd like to stop the machine. Now obviously the machine should stop if Mach stops so you could say, as you have, that it's not required.
In document Mach3Mill_1.84.pfd on section 12.1 it shows the charge pump circuit being used in the E/stop. From my tests I found that when Mach is running and the big RESET button is flashing there is no output from the charge pump, when the big RESET button is pressed and it stops flashing the charge pump output is present, so I have a small N/O relay from that signal in the E/stop circuit to trip the E/stop relay should Mach stop or crash. To restart the physical RESET button would be pressed on the control panel door and this would reset both the emergency stop relay and Mach. (if the issue above was sorted out).
It may seem like belt and braces and maybe it is, I know how to fix it with extra hardware but I'd like a software fix if possible.

I will look at using brains too, thanks.

26-11-2013, 07:49 PM
In document Mach3Mill_1.84.pfd on section 12.1 it shows the charge pump circuit being used in the E/stop.

Yes but that is mainly referring to systems that use BOB's that don't have charge pump feature.!! . . . Doesn't your BOB have one.?
IF not I still wouldn't involve Software in any safety system and stick with your Hardware Fix.

26-11-2013, 11:59 PM
EStop should be seperate, with Mach only being notified that an estop has happened.
The charge pump should be used to either control drive enables, or via the BOB to deactivate outputs. Interlinking the two anymore is just a recipe for headaches later on.

(I will admit on my current retrofit project using a KFlop, things are a bit interlinked, but ultimately the physical e-stop circuit is not controlled in anyway by Mach. It's just that the KFlop monitors several other inputs for validity, and can trigger an e-stop within Mach if needed)

27-11-2013, 09:59 AM
Thanks for replies.
My BOB impliments the charge pump feature and should stop the stepper drivers, spindle run relay, spindle 0-10v reference.
So this morning I'm going to test it to see if it actaully does, it's all just lashed up on the bench right now.
If it does as expected then I will remove the charge pump relay from the E/stop circuit as suggested.

27-11-2013, 05:35 PM
Good shed day today !
Right, the BOB does indeed stop the stepper drivers and VFD, plus with the timing problem gone my RESET button on the panel resets both the electronics and Mach which I think is great.
Also got my Elte spindle fired up today using a diycnc.co.uk spindle board. An on board relay selects RUN and the 0-10v output sends reference to the VFD. By entering say S12000 M3 the spindle fires up at half speed, then entering M5 it stops and the relay drops out the RUN signal. Had it up to full 24000 RPM just lying on bench, no vibration, fairly quite.
So a good day, RESET works great, spindle works great, not putting charge pump relay in E/stop circuit, Guinness in't fridge.