Hello Guest it is March 29, 2024, 04:57:53 AM

Author Topic: What API Call to use for spindle running?  (Read 1236 times)

0 Members and 1 Guest are viewing this topic.

What API Call to use for spindle running?
« 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

Code: [Select]
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?
Re: What API Call to use for spindle running?
« Reply #1 on: April 04, 2019, 02:42:48 PM »
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.
Chad Byrd
Re: What API Call to use for spindle running?
« Reply #2 on: April 04, 2019, 03:21:46 PM »
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?

Offline smurph

*
  • *
  •  1,544 1,544
  • "That there... that's an RV."
    • View Profile
Re: What API Call to use for spindle running?
« Reply #3 on: April 04, 2019, 04:21:54 PM »
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
Re: What API Call to use for spindle running?
« Reply #4 on: April 04, 2019, 05:08:28 PM »
Perfect! You guys are awesome. Thanks