- This topic has 3 replies, 4 voices, and was last updated 10 years, 3 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › Bipolar Stepper Motor 8051 C-program is needed!!! Please share if anybody have one.
Bipolar Stepper Motor 8051 C-program is needed!!! Please share if anybody have one.Thanks in advance. Also tell how to calculate time delays.
Hi,
I am very sure that there are some C-based bipolar stepper motor programs in the “contribution” section. Find them out!!!
#include<reg51.h>
sbit ir=P2^0;
sbit buzzer=P0^7;
stepper();
delay(unsigned int);
unsigned char i;
unsigned int z,s;
main()
{
buzzer=0;
while(1)
{
if(ir==0)
{
buzzer=1;
stepper();
buzzer=0;
}
else
{
buzzer=0;
}
}
}
stepper()
{
for(s=0;s<14;s++)
{
for(z=0x01;z<0x0a;z=z*2)
{
P3=z;
delay(5);
}
}
for(s=0;s<14;s++)
{
for(z=0x08;z>0x00;z=z/2)
{
P3=z;
delay(5);
}
}
}
delay(unsigned int time)
{
unsigned int i,j;
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
}