When you set Delay = 1 it tries to delay 1us between each pulse. As Alain wrote the shortest dealy you'll get with the PauseUs command (which is used by the code) is 24uS. So, the step pulse will be 24uS when using a 4MHz clock. Then there will be another 24us delay before the next pulse, add to that perhaps another 50us for the actual code executed between steps for a total of 100us. That equals a step frequency of 10kHz and there's no way the motor will be able to follow that without accelerating it up to speed.
Leave the StepIt routine alone for now and change the Delay value to 2000 as I had in the original code I posted. That should step the motor at ~500Hz which it should be able to follow without accelerating.
/Henrik.




Bookmarks