7202
« 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