步進(jìn)電機(jī)的驅(qū)動(dòng)程序
如A相通電,B,C相不通電時(shí),由于磁場(chǎng)作用,齒1與A對(duì)齊,(轉(zhuǎn)子不受任何力以下均同)。如B相通電,A,C相不通電時(shí),齒2應(yīng)與B對(duì)齊,此時(shí)轉(zhuǎn)子向右移過1/3て,此時(shí)齒3與C偏移為1/3て,齒4與A偏移(て-1/3て)=2/3て。如C相通電,A,B相不通電,齒3應(yīng)與C對(duì)齊,此時(shí)轉(zhuǎn)子又向右移過1/3て,此時(shí)齒4與A偏移為1/3て對(duì)齊。如A相通電,B,C相不通電,齒4與A對(duì)齊,轉(zhuǎn)子又向右移過1/3て這樣經(jīng)過A、B、C、A分別通電狀態(tài),齒4(即齒1前一齒)移到A相,電機(jī)轉(zhuǎn)子向右轉(zhuǎn)過一個(gè)齒距,如果不斷地按A,B,C,A……通電,電機(jī)就每步(每脈沖)1/3て,向右旋轉(zhuǎn)。如按A,C,B,A……通電,電機(jī)就反轉(zhuǎn)。
sbit F1 = P1^0;
sbit F2 = P1^1;
sbit F3 = P1^2;
sbit F4 = P1^3;
unsigned char code FFW[8]={0xfe,0xfc,0xfd,0xf9,0xfb,0xf3,0xf7,0xf6}; //反轉(zhuǎn)
unsigned char code FFZ[8]={0xf6,0xf7,0xf3,0xfb,0xf9,0xfd,0xfc,0xfe}; //正轉(zhuǎn)
unsigned int
void
{
}
main()
}
評(píng)論