//2相步进电机驱动程序
#include
sbit s1=P1^0;
sbit s2=P1^1;
sbit speedadd=P1^6;//加快
sbit speeddel=P1^7; //减速
void delay(int k)
{
while(k–);
}
void main()
{
int k=20000;
while(1)
{
if(!speedadd){k=k-2000;}
s1=0;
delay(k);
s2=0;
delay(k);
s1=1;
delay(k);
s2=1;
delay(k);
if(!speeddel){k=k+2000;}
}
}
一共4个线,2个adclass=0&app_id=0&c=news&cf=1001&ch=0&di=128&fv=17&is_app=0&jk=2a7c1d14e164388e&k=%CF%DF%C8%A6&k0=%CF%DF%C8%A6&kdi0=0&luki=2&n=10&p=baidu&q=98059059_cpr&rb=0&rs=1&seller_id=1&sid=8e3864e1141d7c2a&ssp2=1&stid=0&t=tpclicked3_hc&tu=u1831118&u=http%3A%2F%2Fwww%2E51hei%2Ecom%2Fmcu%2F2181%2Ehtml&urlid=0″ id=”2_nwl” mpid=”2″ target=”_blank”>线圈的一头公共接5 v,别的2根为单片机驱动口,驱动芯片用ULN2003a
这个是步进电机的图片.