0
10kviews
Write C language program to rotate stepper motor by 90 degree clockwise. Assume step angle is 1.8 degree and 4 step sequence.
1 Answer
written 5.9 years ago by | • modified 5.9 years ago |
Step angle=1.8 degree
Total steps required=90/1.8=50
Four step sequence so
Count=50/4=12.5=approximately 13
#include< regx51.h>
void delay();
void main()
{
int x;
for (x=0;x,13;x++)
{
P0=0x33;
delay(10);
P0=0x66;
delay(10);
P0=0xcc
delay(10);
P0=0x99;
delay(10);
}
}
void delay(unsigned int t)
{
unsigned int x,y;
for(x=0;x<=t;x++)
for(y=0;y<=1275;y++);
}