If it steps 2 degree and you want 80 degree then 2 * 40 = 80. Use a counter and count from 1 to 40 and stop the execution of motor code if count is > 40. i.e., put you motor code inside if(cnt <= 40) and before that initialize cnt to 1.
thank u for your valuable reply.....
bt m having problem for increasing the speed of rotation, I am using following code for delay :
void delay(int a)
{
for(i=0;i<1275;i++)
for(j=0;j<a:j++);
}
But when i am putting minimum value of a i.e. a=1, then i m getting the speed of 5.5 rpm.....
So please tell me how can i increase the speed of rotation more than 20 rpm
What are the controls are there in stepper driver?
if u wanr to do any other work while running stepper u can follow this one.
if it have clock/pulse then use timer to genrate pulse and use one count and check for 80 and toggle pin which is connected to driver pulse/clock.after it reach to 80 stop timer to stop pulse or use any condition to to stop pulses.
80 count is taken beacuase it will give 50% duty cycle.
IF I AM USING SEPARATE FUNCTION FOR ROTATING AND IF I WANT TO COUNT THE STEP,THEN WHERE SHALL I USE COUNTER?IN THE FUNCTION OR IN THE ACCESSED PART?
//HERE
CLOCK();
OR
//CLOCK()
P0=0xCC;
AND I WANT TO DENOTE THE POSITION OF STEPER MOTOR ACCORDING TO THE COUNTER LIKE AS BELOW
WHILE(1<=COUNT<=30
POSITION=1;
WHILE(31<=COUNT<=50)
POSITION=2;
HOW TO DO IN AT89C51 IN C