Sir, i am using stepper motor of 2 degree step angle. I m using following c program:
#include<reg51.h> void main() { while(1) { void delay (int); P1=0xCC; delay(1); P1=0x66; delay(1); P1=0x33; delay(1); P1=0x99; delay(1); } } void delay(int a) { unsigned int x,y; for(x=0;x<10;x++) for(y=0;y<a;a++); }
But i want to rotate it to 80 degree only. I want to stop motor at 80 degree. Please give me the c program for this....??
Think about it. What happens if you try to step too fast? You think the stepper motor is able to have infinite acceleration?
So if you want a stepper motor to run fast, you have to gradually increase the step frequency.
Same thing when it's time to stop the rotation - you can't just instantly stop generating pulses but have to slow down the frequency until you have reached a speed where the stepper motor is able to finally stop if no more pulses are generated.
The need for acceleration/retardation will obviously depend on used motor, how you drive the current through the windings and what load you have that the motor should drive. So time for you to spend some time experimenting. We can't do it for you.