利用單相關(guān)波整提供控制電路電源解析方案
void main(void)
{uchar pulsecount ,pulseduration=0x00;
uint j;i=0;
SP=0x5f;EA=0;
TH0=-(28/256);
TL0=-(28%256);
TF0=0;EA=0;TR0=0;
ET0=1;CMP1=CMP2=0;
Initcomparator();
CMP1=CMP10xfc;
CMP2=CMP20xfc;s=0;
while(P1_1) {;}
while(!P1_1){;}
while(P10x80){};
while(!(P10x80)){};
while(P10x80){}
while(!(P10x80)){};
while(P10x80){};
P1=P10xfe; //啟動電機
while(1)
{if(P1_1= =0) {
x=0;
while (!x){;}
if(P1_1=0)
{P1=0xff;s=s+1;} //停止電機
if(s= =8){s=0;}
while(!P1_1){;} //等待釋放按鍵
while(P10x80){};
while(!(P10x80)){};
while(P10x80)();
whie(!(P10x80)){};
while(P10x80){};
P1=P10xfe;} //啟動電機
EA=1;TR0=1;
speed(s); }
} //結(jié)束
DIY機械鍵盤相關(guān)社區(qū):機械鍵盤DIY
評論