Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: DonnyM on September 19, 2019, 03:57:26 PM

Title: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: DonnyM on September 19, 2019, 03:57:26 PM
I have a servo motor running as a spindle motor using step and direction outputs from Mach 3. This works well.  I also need the spindle motor to turn a tool changer when not cutting. I have used all my other outputs and I can only use the step and direction outputs for the spindle for the A xis. Same motor same drive. If I use the same pin numbers in Mach it complains that the spindle and the A use the same pins.
Is there a way to set up Mach 3 to use the same outputs drive and motor as a spindle and a rotary at the same time?

thanks,
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: MN300 on September 19, 2019, 05:21:37 PM
I assume you are saying that you want to run two different drives and motors from one set of outputs. A relay could switch the outputs from one drive to the other or switch enable signals. The problem is how to drive that relay if all outputs are in use.
One way would be to use micro-switches or proximity sensors to determine if the spindle is at the tool change location. When the spindle is at the tool change location the relay would redirect the drive signals. You would have to check enough axes to make sure you are actually at the location and not just passing through while machining.
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: DonnyM on September 19, 2019, 05:26:13 PM
1 motor 1 drive. The motor needs to act like a spindle motor when cutting and act like a rotary during tool changes.
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: Hood on September 20, 2019, 07:13:37 AM
Assign different pins for the A axis and the use SwapAxis() feature to change when required.
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: DonnyM on September 20, 2019, 09:57:25 AM
Hood,
I have ran out of outputs on both my breakout boards. I am saving the last two for a trunnion table. Any way to do this without using another axis output? All my other outputs and inputs are taken up by machine functions.

thanks,
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: BR549 on September 20, 2019, 10:11:21 AM
iF you assign teh same pin/port numbers for spindle and axis control what exactly does Mach3 do today. Many years back We used that same process to run a S/D spindle as Spindle and Caxis without a problem. BUT that was with a LPT port version of mach3.

What controller are you running ??

You say Mach3 complains about that. HOW does it complain ? will it still run teh Axis both ways ??

(;-) TP
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: DonnyM on September 20, 2019, 10:16:54 AM
It keeps popping up a complaint saying the ports and pins are used multiple times. After a while of clicking ok it goes away. It seems it will use one axis randomly and not the other. . example. If I tell it to spin the spindle it works. Then stop the spindle and move the A. The A does not work. Next time the A might work but the spindle does not work. I am NOT trying to use them both at the same time.
Mach does seem a bit unhappy and confused.

thanks,

Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: BR549 on September 20, 2019, 10:20:19 AM
What controller are you using ??

(;-) TP
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: DonnyM on September 20, 2019, 10:22:13 AM
I have a USB Smooth Stepper in there with two old Bob Campbell breakouts. Mach 3 on a Windows 7 PC.
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: BR549 on September 20, 2019, 10:24:04 AM
I beleive you will find that teh ESS is causing that problem not Mach3 (;-)

(;-) TP
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: DonnyM on September 20, 2019, 10:31:10 AM
If that's the case what would you suggest as a controller that I may use with those two old breakouts. I ran out of space in there and do not want to have to rewire this hole thing again.

thanks,
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: Hood on September 20, 2019, 02:06:37 PM
Just set up some imaginary port and pin numbers, you won't be using them anyway as you will be swapping the Axes and thus using the pins that are actually connected.
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: DonnyM on September 20, 2019, 02:42:38 PM
Thanks Hood. I'll give that a try tonight. I did not know it was an option to use fake pin numbers.
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: Hood on September 20, 2019, 03:14:54 PM
It has been a while, probably 10 years since I used it but if I recall the command in the macro would be SwapAxis(3,6) then in another macro it would be ReSetSwapAxis()
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: Hood on September 20, 2019, 03:15:35 PM
Actually it may be ResetAxisSwap()
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: DonnyM on September 20, 2019, 03:54:24 PM
I found the Mach3 Macro Programmers Reference which has the SwapAxis() and ResetAxisSwap() in it with example. I'll change my Macro and give it a go.
I'll post the results over the weekend.

thanks again
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: DonnyM on September 22, 2019, 07:45:51 PM
The swap axis worked to a point. You can't just pick any port or pin number. It has to be a valid pin and port that Mach likes.

Thanks for the help.
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: Hood on September 23, 2019, 03:11:55 AM
I will have to fire up the Beaver Mill today and see but I was sure I just put something like port 5 and pins 1, 2 etc. I have a recollection that the SS maybe said they were not valid but had a box you could check to say to ignore in future, maybe that has been removed from recent versions, my plugin is probably 8 or more years old, or maybe I am just not remembering correctly, haven't used the Beaver Mill for about 5 or so years.
Title: Re: Step and Dir Spindle and A axis with 1 motor 1 drive how?
Post by: Hood on September 23, 2019, 08:43:10 AM
Just looked, I have the A axis set to port 7 and pins 1 and 2. There is no such port but as I said earlier that does not matter as it is just there so I can use SwapAxis.
Works fine, can swap between A and Spindle just by the two macros I have m101 and m102.

Also as I mentioned earlier my plugin has the option so that the SS does not throw warning messages to me, see pic.

I also did a video, not very clear  but shows it working.

https://www.youtube.com/watch?v=DnicjyARUek&t=41s