51單片機PWM細分控制步進電機的研究 作者: 時間:2012-08-02 來源:網(wǎng)絡 加入技術交流群 掃碼加入和技術大咖面對面交流海量資料庫查詢 收藏 void Time0_Init(){TMOD=0x01;IE=0x82;TH0=0xff;TL0=0xbd; TR0=1;}void Time0_Int() interrupt 1{switch(bs){case 0:if(count_x==0){TL0=187;TH0=251;P1=pout[djsx[0][count_b*6]];count++;break;}if(count_x!=3){TL0=ys[0][count_x-1][0]; TH0=ys[0][count_x-1][1];P1=pout[djsx[0][count_b*6+count_x]];bs=1;break;}P1=pout[djsx[0][count_b*6+3]];case 1:TL0=ys[1][count_x-1][0];TH0=ys[1][count_x-1][1];P1=P1+pout[djsx[1][count_b*6+count_x]];bs=0;count++;}if(bs==0){if(count==xzsd){count=0;count_x=count_x+xzbs;}if(count_x==6){count_x=0;count_b++;}if(count_x==-1){count_x=5;count_b--;}if(count_b==4)count_b=0;if(count_b==-1)count_b=3;}}void main(){P1=0;Time0_Init();while(1);}完畢! pwm相關文章:pwm是什么 51單片機相關文章:51單片機教程 pwm相關文章:pwm原理 上一頁 1 2 下一頁
評論