Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: mcardoso on April 04, 2019, 01:58:36 PM
-
Hi All,
I want to interlock the pushbutton for my pneumatic drawbar to not operate when the spindle is rotating.
My first thought was to use the measured RPM of the spindle index pulse and check if it is equal to zero using mc.mcSpindleGetTrueRPM(), however this is not reliable under 200 rpm since the value drops to zero shortly after the index has passed. Also whenever the drawbar extends or releases, a huge garbage number is momentarily thrown into this value (not sure if something to do with relay contact noise or software).
I then wanted to get the commanded motor speed and check if equal to zero. mc.mcSpindleGetCommandRPM() doesn't work because the value is set by the last "S" code and is non-zero when an M05 is issued. I then wanted to use mc.mcMotorGetVel() but I got syntax errors using the code
velocity, rc = mc.mcMotorGetVel(inst, 6)
Note: My Spindle is OB1 (motor 6 I'm pretty sure)
Any thoughts on the best way to detect if the commanded or actual spindle velocity is non-zero? Or why the above syntax was wrong?
-
There is an output handle for the Spindle, just check the SpindleOn state,
Get the handle, check the state, if it is on then disable the Drawbar button.
-
I think for my purposes, it is ok to run the drawbar if the spindle motor is enabled so long as it is not moving. Does the spindle ON reflect motor enable or non-zero speed?
-
mc.OSIG_SPINDLEON means the spindle is moving. And there are also mc.OSIG_SPINDLEFWD and mc.OSIG_SPINDLEREV.
The motor enable is separate. You don't need to even look at it because the above signals will do what you want.
Steve
-
Perfect! You guys are awesome. Thanks