I need a Brain to fire my dynamic spindle brake for a second or two when an M5 is issued through mach. Can anyone help me with the code?
Thanks
I need a Brain to fire my dynamic spindle brake for a second or two when an M5 is issued through mach. Can anyone help me with the code?
Thanks
Can't help you with a brian - never had need of one - how about a simple mod to the m5 macro? don't know your system but assuming your brake is applied simply by a mach output pin then something along the lines of:
Code:'M5 macro doSpinStop() 'stop spindle activateSignal(OUTPUT?) 'apply brake on output number ? (you choose) while isMoving() sleep 10 wend sleep 2000 'apply brake for 2 seconds deactiveSignal(OUTPUT?) 'release brake
Stirling,
That's a good idea. I might have tried that if my VB skills were better. I will use it.
Thanks
I had to change the signal wording for my output, but it works. The only problem is that it fires when mach estops. So it's kind of going off a lot when I'm messing around. Maybe there is a specific signal that can be used instead of the m5?
can you post your modified code?
The code you had was ok. I had to replace the activate/ deactivate signal with....
SetMasterOutput(12, 1)
SetMasterOutput(12, 0)
If I undertsnad you correctly the problem is that the brake is being applied even when the spindle wasn't actually on at certain times. The code below (untested) might give you an idea. It only fires the brake if the spindle was actually on. There may be better ways of doing this.
(It should go without saying that E-stop should not rely on this or any other software. i.e. as well as everything else, the spindle brake should be applied by hardware following an e-stop too.)Code:'M5 macro Const SpindleOnLED = 11 '(CW Or CCW) Dim spindleOn As Boolean spindleOn = getOEMLED(SpindleOnLED) doSpinStop() 'stop spindle 'if spindle on then apply brake If spindleOn Then SetMasterOutput(12, 1) 'brake on While isMoving() sleep 10 Wend sleep 2000 'apply brake for 2 seconds SetMasterOutput(12, 0) 'brake off End If
Looks great. I will give it a try. Thank you.