There are several pitfalls to watch for with this type of code.
First, if your M3 or M4 macro contains an M5 code (e.g. to stop the spindle prior to attempting a gear change), then the Search and Resume options may not recognize that the spindle should be on when they get to the search line (because the parser saw M3 or M4, then saw an M5, and so concludes that the most-recent spindle M function is M5. That can generally be avoided with the usual "skip the whole macro in search or graph" logic, as Muzzer's code has. It can also be avoided by replacing the M5 with "M95/1/2" or "M95/1/2/19".
Second, if the M3 or M4 macro proceeds with running the gear change code unconditionally (without checking to see whether the head is already in the desired gear), and if the gear change process has a dwell time or other lengthy operations, then that may cause an unexpected delay at the bottom of a G74 or G84 tapping cycle, when M3 or M4 is called to reverse the spindle. That can generally be avoided by making the code check the current range (based on inputs or memory bits), then only doing the gear shift if not already in the desired range.
Third, on a lathe control, it is possible that the target RPM is unknown. If the G code starts up the spindle in CSS mode (G96), then the given S code would be surface speed (meters/minute or feet/minute) instead of RPM. Testing #4119 would not give a meaningful answer. That issue can only be fixed in the G codes (e.g. in the postprocessor). A well-behaved lathe postprocessor should always start up the spindle in RPM mode (G97), with an RPM that is approximately correct for the start of the upcoming cut. If should only switch to G96 and call out the surface speed after the initial rapid move that brings the X axis into position for the first cut. Auto-gear-change code called from an M3 or M4 would have to either do nothing, or trigger an error, if the spindle speed mode is G96 and not G97.
How to use M41-M43 - SOLVED
Moderator: cnckeith
Re: How to use M41-M43 - SOLVED
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Community Expert
- Posts: 3610
- Joined: Thu Sep 23, 2021 3:49 pm
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: 6433DB0446C1-08115074
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: Germany
Re: How to use M41-M43 - SOLVED
I am also not a fan of rpm based auto shift.
In most cases low rpm in high gear is ok, I downshift only if the additional torque is required.
Uwe
In most cases low rpm in high gear is ok, I downshift only if the additional torque is required.
Uwe
(Note: Liking will "up vote" a post in the search results helping others find good information faster)
-
- Posts: 809
- Joined: Mon Feb 19, 2018 2:52 pm
- Acorn CNC Controller: Yes
- Allin1DC CNC Controller: No
- Oak CNC controller: No
- CNC Control System Serial Number: 38D269594F9C-0110180512
- DC3IOB: No
- CNC12: Yes
- CNC11: No
- CPU10 or CPU7: No
- Location: UK
- Contact:
Re: How to use M41-M43 - SOLVED
Yes - good, valid points. My mill spends the vast majority of its time in high gear, only using low gear for tapping where trying to tap a short, blind hole at high speed wouldn't end well and my vee belt drive from motor to spindle might slip in direct drive. Like this (around 7 mins):
Good point about constant surface speed in lathe mode - there are considerations that apply for lathe-specific situations and I've only considered and implemented this for my own 2 speed mill. Certainly, in my situation it works well for drilling and tapping hole patterns.
Good to have input from experienced users, particularly where I have no particular expertise!
Good point about constant surface speed in lathe mode - there are considerations that apply for lathe-specific situations and I've only considered and implemented this for my own 2 speed mill. Certainly, in my situation it works well for drilling and tapping hole patterns.
Good to have input from experienced users, particularly where I have no particular expertise!
(Note: Liking will "up vote" a post in the search results helping others find good information faster)