Hi MKSA,
I have done a huge range of speeds and protocols and think it unlikely to be the microswitch. At the moment I am trying to set up an encoder to compare exactly what is happening at the stepper compared to what I think I told it to do.
For the moment the problem is solved by not being too fussy, I have replaced the attempt to get a baseline by simply detecting the microswitches: I ramp up the stepper to full speed and run it until it meets the microswitch - then back off a bit and move slowly until the microswitch is contacted.
I have not given up trying to find out what is happening with the original method - I tend to get annoyed when something that is impossible happens anyway and I will worry at it until it yields. The diagrams below show what I am getting - the axes are speed against time. The jiggle at the beginning of each run is to get a precise first microswitch position in case it moved. The problem is that the distance from A to B in the first diagram is the same as the distance from B to A and is repeatable, about 1990 pulses . In the second diagram B to A is the same as the return A to B, both about 2012 pulses.
[attachment 108654 ToggleMotorSpeed.jpg]
The apparent impossibility is that the second half of the first diagram is exactly the same trip as the first half of the second diagram yet the count is different. My present theory is that MplabX has some bugs that I don't know about - or maybe my brain has been leaking away.
Maybe it is time to start believing in the supernatural.
Mike
I have done a huge range of speeds and protocols and think it unlikely to be the microswitch. At the moment I am trying to set up an encoder to compare exactly what is happening at the stepper compared to what I think I told it to do.
For the moment the problem is solved by not being too fussy, I have replaced the attempt to get a baseline by simply detecting the microswitches: I ramp up the stepper to full speed and run it until it meets the microswitch - then back off a bit and move slowly until the microswitch is contacted.
I have not given up trying to find out what is happening with the original method - I tend to get annoyed when something that is impossible happens anyway and I will worry at it until it yields. The diagrams below show what I am getting - the axes are speed against time. The jiggle at the beginning of each run is to get a precise first microswitch position in case it moved. The problem is that the distance from A to B in the first diagram is the same as the distance from B to A and is repeatable, about 1990 pulses . In the second diagram B to A is the same as the return A to B, both about 2012 pulses.
[attachment 108654 ToggleMotorSpeed.jpg]
The apparent impossibility is that the second half of the first diagram is exactly the same trip as the first half of the second diagram yet the count is different. My present theory is that MplabX has some bugs that I don't know about - or maybe my brain has been leaking away.
Maybe it is time to start believing in the supernatural.
Mike