Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: Cbyrdtopper on April 03, 2017, 12:52:15 PM
-
We have had 2 instances of the spindle coming on while the orient was still engaged. Our tool change macro doesn't finish until it gets the Orient Release signal, I'm using the SignalWait command, so I don't know why it continues the macro with the Orient still in engaged. That is my issue, any ideas why it finishes the macro?
Now, to prevent this from happening again, I was wondering if there was a way to inhibit the spindle unless the orient release signal was active. I looked in the Screen Load script and found the SpinCW and SpinCCW functions, I was going to put an "if" statement in there looking for the Orient Release Signal. Is this where I need to put such code, or is there something else that needs to be done?
-Chad
-
Have you tried increasing the timeout value
DazTheGas
-
DTG,
What timeout are you referring to? The plugin?
-
The signalwait command has a timeout setting mc.mcSignalWait(number mInst, number sigId, number waitMode, number timeoutSecs)
I think the way I would go is to lengthen the timeout and then put the rest of the macro in an if statement, if sig ==1 then continue...................
DazTheGas
-
I have that waiting infinitely. The tool change is being run by a PLC. I send an output to the PLC and the last move by the PLC is releasing the orient. The m6 macro waits until the Orient release before setting the tool numbers and pocket information and finally ending the macro.
-
Okay,
I've got something that works great!
I put this code in the PLC Script. All it does is check for the Orient Signal, if its true it turns off the spindle, CW and CCW. And for the operator, it has a message saying the spindle is disabled.
--Inhibit spindle if Orient signal is true.
local hSig = mc.mcSignalGetHandle (inst, mc.ISIG_INPUT17) --Orient Signal
local OrientInhibit = mc.mcSignalGetState (hSig)
if (OrientInhibit == 1) then
local SpinCW = mc.mcSignalGetHandle (inst, mc.OSIG_SPINDLEFWD)
local SpinCCW = mc.mcSignalGetHandle (inst, mc.OSIG_SPINDLEREV)
mc.mcSignalSetState (SpinCW,0)
mc.mcSignalSetState (SpinCCW,0)
mc.mcCntlSetLastError (inst, "Spindle Disabled")
end