Going by your code it seems that you have a unipolar motor (6 wires) and 4 switches (transistors or whatever). If so, using pulsout is not the best way since there will be a short delay between each pulsout statement where no current is flowing in any of the coils. When no current is flowing the torque drops and the rotor can "jump" to the closest natural step (magnetic pole).
Now, there are other ways to "produce" the step sequence than this rather crude one but try this and see if it helps.Code:Delay VAR BYTE i VAR WORD TRISB = 0 ' All outputs. Delay = 10 ' ~100steps / second For i = 1 to 1000 '1000 steps forward. PORTB = %00000001 Pause Delay PORTB = %00000010 Pause Delay PORTB = %00000100 Pause Delay PORTB = %00001000 Pause Delay NEXT Pause 2500 For i = 1 to 1000 '1000 steps reverse. PORTB = %00001000 Pause Delay PORTB = %00000100 Pause Delay PORTB = %00000010 Pause Delay PORTB = %00000001 Pause Delay NEXT
Bookmarks