#include
unsignedcharcodef_rotation[4]={0x02,0x04,0x08,0x10};//正轉(zhuǎn)表格
unsignedcharcodeb_rotaTIon[4]={0x10,0x08,0x040,0x02};//反轉(zhuǎn)表格
voiddelay(unsignedinTI)//延時
{
while(--i);
}
main()
{
unsignedchari;
while(1)
{
for(i=0;i《4;i++)//4相
{
p1=f_rotaTIon[i];//輸出對應(yīng)的相可以自行換成反轉(zhuǎn)表格
delay(10000);//改變這個參數(shù)可以調(diào)整電機(jī)轉(zhuǎn)速
}
}
}