JanH..
i used this method as you wrote, and like you for control stepper motor.
but it did not work.
i posted a thread " problem with stepper " and attached my code for this.
here is my code, you can see and say.
JanH..
i used this method as you wrote, and like you for control stepper motor.
but it did not work.
i posted a thread " problem with stepper " and attached my code for this.
here is my code, you can see and say.
Last edited by ibra; - 10th August 2007 at 10:14.
janH,
The link I gave in post #3 http://www.picbasic.co.uk/forum/showthread.php?t=5649 is a discussion on how to force the PIC to save on a power down.
ibra,
I gave you some sample code for your stepper motors.("problem with stepper ") Did it work? If not, what happened?
Dave
Always wear safety glasses while programming.
mackrackit..
the sample code you wrote did not work, the stepper just moves to left for ever.
i changed my last code ..
i put a delay after read and write instructions, and i changed the place of write instruction.
after these changes the stepper just do its job in the first stage ( when p = 13 and return back) ...then it start to go left and right randomly.
after all this i read the eeprom postion of P, it gives me a big value than 13 !!.
i think that there some mistakes in logical operators i used..but i dont know where ?
this is my new code..
any idea plz??
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).
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.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
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.
Dave
Always wear safety glasses while programming.
Bookmarks