Hello Guest it is October 14, 2019, 10:03:19 AM

Author Topic: 4th axis/spindle swapaxis confusion  (Read 9716 times)

0 Members and 1 Guest are viewing this topic.

4th axis/spindle swapaxis confusion
« on: October 09, 2012, 01:39:56 AM »
Hi everyone,
Trying to figure out how to do the whole "setup A axis as a spindle and use swapaxis back and forth" thing with a stepper. Been searching for days...

The first thing that confuses me is the wiring/setup, I have my 4th axis stepper wired up and can rotate it via g-code, hotkey, etc. But I cannot get it to act as a spindle. M3 S********* in the MDI code line does nothing.

In Mach, I have set up the A axis as pins 8 and 9. I changed the spindle pins to 8 and 9 as well. I used a simple g-code to confirm X,Y,Z,A movements. I then added the macros posted by another user here to call and reset the swapaxis functions of Mach 3.

I also added M3 S********* to the code and I see the spindle rpms (on screen) ramp up and then immediately back to 0, can't figure out how to keep it spinning for a longer duration. Also, at the end of the code, if I have an A movement command after the swapaxis has re-set, my Z axis moves. However, it moves according to the A axis commands and the 4th axis DRO numbers move with it. I checked in ports and pins and saw my spindle numbers were now 6 and 7, same as the Z axis...???

I have a Gecko G540, Mach 3 Version R3.042.033, X3 deluxe CNC setup.
My config based on my searches here.

Toolpath Configuration
Axis of rotation=X, A-Rotations Enabled box and Use Radius for Feedrate is checked

Spindle Setup
Use spindle motor output box is checked
step/dir motor box is checked

General Config
A is angular box is checked
Rotational section, no boxes checked



A question for the future once this is all figured out...how can I physically bring the spindle's step/dir signals out of the G540 so I can route it to a separate board? The G540 has the VFD outputs, but I'm not sure that's what I want to use?

Thanks!

Offline Hood

*
  •  25,855 25,855
  • Carnoustie, Scotland
    • View Profile
Re: 4th axis/spindle swapaxis confusion
« Reply #1 on: October 09, 2012, 03:11:24 AM »
Atach your xml and I will have a look. Worth noting however the RPM will only show if you have an index pulse, the DRO showing the numbers increasing then going to zero is just Machs Driver starting to look for the RPM but when it doesnt see it it drops to zero.
Hood

Offline RICH

*
  • *
  •  7,367 7,367
    • View Profile
Re: 4th axis/spindle swapaxis confusion
« Reply #2 on: October 09, 2012, 06:34:38 AM »
A stepper is not a good choice when used to drive  a spindle.
Just a comment.

RICH

Offline BR549

*
  •  6,902 6,902
    • View Profile
Re: 4th axis/spindle swapaxis confusion
« Reply #3 on: October 09, 2012, 12:21:41 PM »
IF I recall correctly you do not set the pins the same . That is the whole idea behind swapaxis it does it all for you.

Set each axis up separately and get them running correctly. Then use the swapaxis command to swap the functions.

Just a thought, (;-) TP
Re: 4th axis/spindle swapaxis confusion
« Reply #4 on: October 10, 2012, 01:27:15 AM »
Thanks all, for some reason I could not reply from my phone.

Hood,
Attached is my XML. This is before I enabled outputs 3 and 4 in the ports & pins->output. Still no dice though. I went back to the machine and my Spindle Step/Dir are back to 8 and 9. It must revert to the original settings when I shut down Mach.

Rich,
Yes, I know this. I will eventually upgrade the spindle motor and the 4th axis motor, but for now I just want to get it to work. Plus funds and time are short nowadays. I will not be doing any heavy turning on this axis.

BR549,
I thought I read somewhere that I had to... Found it, "the stepper has one connection to the driver like normal, just set it up as as the a axis as usual and use the same step/dir pins´╗┐ in mach 3 for the a axis and spindle" hossmachine. I think I got this from his forum.

Wow...Mach just crashed....I opened up a swapaxis macro and hit play, the green box around the "4" DRO lit up. Does that mean the macro is working? Hmmm, I can't get Mach or the script editor to close...
Re: 4th axis/spindle swapaxis confusion
« Reply #5 on: October 10, 2012, 01:34:49 AM »
OK, back up and running. I had to post here first and let the browser let go of the XML file.

I ran the resetaxiswap macro and that is causing the green box to light up.

Offline Hood

*
  •  25,855 25,855
  • Carnoustie, Scotland
    • View Profile
Re: 4th axis/spindle swapaxis confusion
« Reply #6 on: October 10, 2012, 03:12:06 AM »
As Terry said you dont set the axis pins the same for SwapAxis(). In this xml you have Z and Spindle set to the same pins so if you command a Z move or a Spindle rotation the Z or Spindle will likely move with each other.
What I would suggest is say you normally want a spindle as the default  and A is what you want to swap axis to, then set the spindle as pins 8 and 9 on port 1 and you could then  set the A to 8 and 9 But set it to port 2. I think that should work. That is of course assuming you do not have any spare outputs on Port 1.
The other alternative is like Hoss says, setting ports and pins for each axis the same. Doing that however would not require swapaxis() but would require caution as both axis would be live so to speak.
Hood
Re: 4th axis/spindle swapaxis confusion
« Reply #7 on: October 11, 2012, 02:18:18 AM »
Thanks. I didn't get any free time tonite so will try it tomorrow nite. I started with pins 8 and 9 for the spindle but for some reason, they would change to 6 and 7 and return to 8 and 9 when I shut down Mach.

I'm a little confused by your reply, do I change the A-axis Step Port and Dir Port to 2 or are you talking about the Output Signals tab? I think you can see from my XML I have two outputs and the charge pump as port 1.
One of the outputs isn't actually used right now, the other runs the coolant flood pump.

"That is of course assuming you do not have any spare outputs on Port 1"
Confused here as well. How many outputs are possible on Port 1? As many as are in the table?
I have outputs 3 and 4 enabled on the Spindle Setup tab

"The other alternative is like Hoss says, setting ports and pins for each axis the same. Doing that however would not require swapaxis() but would require caution as both axis would be live so to speak."
I'm not entirely sure but I don't think this is the case as both axes are actually the same motor, the swapaxis() just changes how the motor acts?

A somewhat related question, is there a way I can set up Mach to work on my desk computer (where I am right now) instead of having to go downstairs and see if my changes actually work on the motors? I'm in Offline mode due to the constantly blinking Reset button. I may have let the system fix things accidentally.

Thanks again

Offline Hood

*
  •  25,855 25,855
  • Carnoustie, Scotland
    • View Profile
Re: 4th axis/spindle swapaxis confusion
« Reply #8 on: October 11, 2012, 05:16:51 AM »
Dont have time to reply fully at the moment as I am moving machines around in my workshop.
Anyway heres the first part hopefully made a bit clearer, will try and answer the swapaxis() part later on in the day.

When you set up motors you define the port and pin numbers for the Step and Dir signals. If you use the same port and pin numbers for 2 axis then they will both get a signal when you command a move to one and that can be dangerous is they are physically different axis such as a spindle and a Z.
You can howevere set a spindle up with the same port and pin numbers as an A axis  IF that motor is physically the same motor. What would happen is if you commanded a spindle rotation it would work and if you commanded an A axis move it would work.
There are 2 problems I see with this method, first is that you have to be careful that you only command one when the other is inactive, ie you dont want to have a spindle command in force then also call an A command.
Second problem is the motor tuning would need to be the same for both spindle and A, that is an issue as A is usially set as steps per degree and a spindle per rev, so if you used that method you would have to set them both to the same units and command accordingly. eg if you kept the A as degrees then any spindle command would need to be as degrees also (because the steps per unit need to be set as that) so your commanded speed would be 360 times greater.

Hood
Re: 4th axis/spindle swapaxis confusion
« Reply #9 on: October 12, 2012, 01:51:44 PM »
Thanks Hood, I played around with the settings last nite but still couldn't get it to act like a spindle. I probably don't know the right commands for doing that. From what I read, M3 S500 would make the motor spin at 500 until M5 was called. So it still must be one of the settings, ports/pins, etc. that I'm missing.