ibra,
The code I gave was trying to show where, when, and how to write to eeprom. It should not have changed the operation? At some point 13 should have shown up.
I do not have a stepper on the bench at the moment so this is untested on my part.
The idea is to have positive data written after every CW step (P=P+1)and negative data after every CCW step(P=P-P).
Code:
IF PORTB.6 = 0 AND P<=13 THEN ;go RIGHT
GOSUB RIGHT
ELSE
IF PORTB.7 = 0 AND P>=1 THEN ;go LEFT
GOSUB LEFT
This looks like the random problem. P<=13 -- P>=1 Stuck between these values. It would have to be greater than 13 or less than 1 to stop.
Or, make PORTB 6 or 7 high in hardware and tell the PIC what to do when they are high. (STOP)
I will try to test with a stepper in a day or so.
Bookmarks