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相關(guān)文章:pwm是什么
51單片機(jī)相關(guān)文章:51單片機(jī)教程
pwm相關(guān)文章:pwm原理
評論