Page 1 of 2

How to use M41-M43 - SOLVED

Posted: Sun Jun 07, 2020 2:38 pm
by Muzzer
My machine has 2 spindle ratios and my modified M3 / M4 macros correctly select the correct gear range using solenoids. So if the S speed command is below a threshold (eg 1000rpm), the low ratio is engaged. That works fine.

Looking at the manual and the std plc code, issuing M41 from within my M3 macro should cause SpindleRange_W to be set to 1 (indicating low range). This in turn should set the SpinRangeAdjust_FW to equal SV_MACHINE_PARAMETER_65 ie the value of low gear ratio parameter #65 (which is set by the wizard). This should then scale the analog voltage sent to the DAC for the VFD. In this way, the motor speed should be increased by the inverse of the gear ratio.

So for example, with a low gear ratio of 0.2, if I ask for 100rpm in low gear, the VFD should be asked to spin the motor at 500rpm. This isn't happening.

Perhaps related is the fact that when I change to manual spindle control in the VCP and try to select "spin low" or "spin med", nothing happens and the LEDs stay dark. I would expect this action to have a similar effect ie to tell the plc that the user has selected low or med speed ratio.

I'm suspecting I have missed something here, hopefully fairly simple. Either way, I'd be very grateful if somebody could help me. I feel I'm very close to resolution - but no cigar yet!

Thanks for any suggestions. Latest report attached, including my M3 and M4 macros.
report_38D269594F9C-0110180512_2020-06-07_12-05-42.zip
(595.97 KiB) Downloaded 140 times

Re: How to use M41-M43

Posted: Mon Jun 08, 2020 1:18 pm
by Allin1Chris
I see you have Backgear and SpindleRangeHigh as inputs. These inputs are kind of the same thing and may be the reason why you cannot switch. (The PLC always takes the gear range inputs over mcodes and other commands).

When BackGear input is on (Green in Alt-I screen) it will put the spindle in highrange, and when Backgear Input is off (red) it will put the spindle in low range.

Like wise, SpindleRangeHigh when on (Green) will put the spindle in high range and when SpindleRangeHigh is off (red) will allow other inputs and commands to change the spindle range. (This is simply due to it being last in the plc logic so will "override" any other input or command)

I assume when you activate Solenoid Outputs 1 or 2 it is activating some sort of gear. You should set this up to Input 1 so when it is High (On) the spindle is in highrange and Low (off) when spindle is in low range. (Perhaps you have a switch of some type or detector that goes high or low when the gear is engaged or not?)

Alternativly, you can try using SpindleLowRange for input 1 as well, assuming input 2 turns off will put it into low range. These inputs set the SpindleRange_W so there should be no need for M41-M43 commands.

Re: How to use M41-M43

Posted: Mon Jun 08, 2020 2:49 pm
by Muzzer
Hi Chris - that sounds encouraging. Thanks very much for looking into this - I appreciate your support!

Yes, I have pneumatic solenoids controlled by Acorn to shift from high gear (direct) to low gear (reduction) and vice versa. And I have microswitches at each position so I can check that the gears have actually engaged fully. It works pretty well and the macro won't move on until the correct gear has been engaged successfully. It's like a Bridgeport except fully geared, so no change of direction, just ratio.

So I will figure out how to connect the inputs as you describe. It sounds reasonably straightforward but may take me a while to digest! In fact it sounds a little simpler to implement (no M41 etc) as I have the inputs already connected up.

I'll let you know how I get on....

How to use M41-M43 - SOLVED

Posted: Mon Jun 08, 2020 4:32 pm
by Muzzer
I'm pleased to report that simply changing Input 1 to SpindleLowRange (from Backgear) did the trick. You hit the nail on the head there!

Now when I ask for a low speed (my threshold is <1000rpm), it selects low ratio and then displays the correct spindle speed in the CNC12 screen. The VFD is running the motor at the spindle speed divided by the low gear ratio. Setting a speed at 1000rpm or higher changes it back to high ratio - but only when an M3 or M4 is given.

The rest of my macro prevents the spindle running until the gears are properly meshed. In some situations, the gears don't mesh on the first attempt, so I give the motor a tiny nudge and try again in a loop until the switch reports full engagement.

Although my machine has no spindle encoder due to the design of the head, I can do conventional tapping with a tension compression head. The limitation is that I can't peck tap, so I have to do the hole in one go. However, I can't do that in high ratio as the motor doesn't have enough torque in 1:1 ratio. This should do the trick!

Re: How to use M41-M43 - SOLVED

Posted: Thu Jan 02, 2025 2:21 pm
by jedmill67
Muzzer wrote: Mon Jun 08, 2020 4:32 pm I'm pleased to report that simply changing Input 1 to SpindleLowRange (from Backgear) did the trick. You hit the nail on the head there!

Now when I ask for a low speed (my threshold is <1000rpm), it selects low ratio and then displays the correct spindle speed in the CNC12 screen. The VFD is running the motor at the spindle speed divided by the low gear ratio. Setting a speed at 1000rpm or higher changes it back to high ratio - but only when an M3 or M4 is given.

The rest of my macro prevents the spindle running until the gears are properly meshed. In some situations, the gears don't mesh on the first attempt, so I give the motor a tiny nudge and try again in a loop until the switch reports full engagement.

Although my machine has no spindle encoder due to the design of the head, I can do conventional tapping with a tension compression head. The limitation is that I can't peck tap, so I have to do the hole in one go. However, I can't do that in high ratio as the motor doesn't have enough torque in 1:1 ratio. This should do the trick!
Muzzer,

Well done getting that working. I realize this was awhile back for you now, but I just had a similar macro victory and understand the feeling. 8-)
I was wondering if you would be willing to post your M3/M4 macros, I'm now looking to accomplish a similar thing as you did and though your macros would be very helpful to look at. Only difference for me is mine will be a 2 speed belt arrangement and so no gear meshing issues to contend with so I will have no need for feedback inputs to acorn. Thanks for considering.

Re: How to use M41-M43 - SOLVED

Posted: Thu Jan 02, 2025 7:04 pm
by Muzzer
Yes, will do. I will go out to the workshop tomorrow and copy it for you.

Murray

Re: How to use M41-M43 - SOLVED

Posted: Fri Jan 03, 2025 1:54 am
by jedmill67
Oh man, thank you so much for doing that!

Re: How to use M41-M43 - SOLVED

Posted: Fri Jan 03, 2025 10:42 am
by Muzzer
In fact, i see the changes were made in my M3 (spindle forward) and M4 (spindle reverse) macros, not M41/M43. I have attached them here.

I forget how / why I developed them but I guess you need to decide somewhere which range to use (high or low) before instigating that action. In my case, I have a simple test to see if the requested speed is above my chosen threshold, which is 1000rpm for my machine:

IF #4119 >= 1000 THEN GOTO 1000 ; HIGH range required above 1000rpm...

Depending on that test, I've then activated the appropriate range. Beyond that, I've used the feedback microswitches to check if the gears have fully meshed / engaged. If not, I've given them a quick nudge by enabling the VFD briefly (I found that time by trial and error) and then retrying. It will not apply full wompo until the gears are safely meshed.

Once the correct gears are engaged, the pneumatic solenoids don't need to be kept pressurised, so I turn them off.

Obviously, if you subsequently change the spindle speed by sending a new S command without stopping (M5) and restarting the spindle (M3 or M4), it won't change range. I've not had any need to get any more sophisticated on that front. Most speed changes using a given tool are fairly minimal.

Obvs you need to set the gear ratios in the parameters so that the VFD gets the correct set voltage for the requested speed in the chosen range.

This works well for me. Obvs each time you update CNC12 you need to copy over the macros into the new folder.
mfunc3.mac
(2.78 KiB) Downloaded 15 times
mfunc4.mac
(2.78 KiB) Downloaded 13 times
Here are the M41 and M43 macros for the record. They are the original, unchanged macros that came with CNC12.
mfunc41.mac
(324 Bytes) Downloaded 13 times
mfunc43.mac
(327 Bytes) Downloaded 12 times

Re: How to use M41-M43 - SOLVED

Posted: Sat Jan 04, 2025 1:44 am
by jedmill67
Murry,

Thank you for the macros and the explanation as well. It's the folks like you that make this community so nice. I've downloaded them and they will serve as nice guides to create my own for my mill build. Thanks again!

Re: How to use M41-M43 - SOLVED

Posted: Sun Jan 05, 2025 8:37 am
by Muzzer
I wouldn't have got as far as I have without the active support and encouragement of this rather excellent company and its community. Keith and the Centroid team have created not only a very versatile, innovative and growing product line, they have set up the infrastructure around it in a way that many companies would never contemplate. It's wonderful to watch it evolve and also wonderful to be a small part of it.