I mentioned remapping m-codes my HNC lathe on IRC. So far it looks like I got M41/M42 working (Thank you Michael H.).
M41 Spindle Low, releases the high speed clutch and engages the low M42 Spindle High, releases the low speed clutch and engages the high http://www.wallacecompany.com/cnc_lathe/HNC/00051-1a.jpg http://www.wallacecompany.com/cnc_lathe/HNC/ It takes a while for the flux in a clutch to collapse after turning the signal off. The newly energized clutch engages almost instantly, so the two clutches bind up the works and stop the motor and spindle -- not good. A G4 like delay was added to allow the current clutch to disengage before engaging the new clutch. I suppose I could improve the clutch driver to short the coil to ground or drive it low, but some sort of delay will be needed anyway. I'm thinking a smarter driver could also soft start the engagement, ... or I could just remember to stop the spindle before changing speed range ... which would also solve the clutch binding problem -- too many options. Maybe I will need to add logic to check that the motor is stopped. There may be a chance that an M40 neutral code might be handy, but I'm not sure why at the moment. M41/M42 was chosen because it seems to be popular: http://www.helmancnc.com/cnc-m41-m42-m-codes-for-gear-selectio/ Edits to my existing configuration: > hnc.ini > ~~~~~~~~~~~ > ... > [RS274NGC] > ... > REMAP=M41 modalgroup=10 py=m41 > REMAP=M42 modalgroup=10 py=m42 > ... > [PYTHON] > TOPLEVEL = /home/kwallace/linuxcnc/configs/python/toplevel.py > PATH_APPEND = /home/kwallace/linuxcnc/configs/python > ... > ~~~~~~~~~~~ > toplevel.py (new file) > ~~~~~~~~~~~ > #!/usr/bin/python > > import remap > ~~~~~~~~~~~ > remap.py (new file) > ~~~~~~~~~~~ > #!/usr/bin/python > > import emccanon > > def m41(self, **words): > emccanon.CLEAR_AUX_OUTPUT_BIT(1) # spindle high clutch > emccanon.DWELL(1) # allow time for the clutch to release > emccanon.SET_AUX_OUTPUT_BIT(0) # spindle low clutch > return > > def m42(self, **words): > emccanon.CLEAR_AUX_OUTPUT_BIT(0) # spindle low clutch > emccanon.DWELL(1) # allow time for the clutch to release > emccanon.SET_AUX_OUTPUT_BIT(1) # spindle high clutch > return > ~~~~~~~~~~~ -- Kirk Wallace http://www.wallacecompany.com/machine_shop/ http://www.wallacecompany.com/E45/ ------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/ _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users