freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于51單片機(jī)的c語言程序設(shè)計(jì)-文庫吧資料

2025-06-30 16:36本頁面
  

【正文】 while(1) { if(K1==0) Play(1)。}void main(){ P1=0xff。 DelayMS(t)。i100。}//按周期t發(fā)音void Play(uchar t){ uchar i。t120。//延時(shí)void DelayMS(uint x){ uchar t。sbit K3=P1^6。sbit K1=P1^4。 } }}22 按鍵發(fā)音/* 名稱:按鍵發(fā)音 說明:按下不同的按鍵會是SOUNDER發(fā)出不同頻率的聲音。 while(1) { if(K1==1) { Alarm(90)。j++)。 for(j=0。i200。//發(fā)聲函數(shù)void Alarm(uchar t){ uchar i,j。 } }}21 開關(guān)控制報(bào)警器/* 名稱:開關(guān)控制報(bào)警器 說明:用K1開關(guān)控制報(bào)警器,模擬很逼真的報(bào)警效果*/includedefine uchar unsigned chardefine uint unsigned intsbit SPK=P1^0。 P0=DSY_CODE[DSY_Buffer[i]]。i++) //刷新顯示在數(shù)碼管上 { m=_crol_(m,1)。 for(i=0。 DSY_Buffer[1]=Num/10%10。 Num=P1。 P2=0xff。}//主程序void main(){ uchar i,m,Num。t120。//延時(shí)void DelayMS(uint ms){ uchar t。 } }}20 數(shù)碼管顯示撥碼開關(guān)編碼/* 名稱:數(shù)碼管顯示撥碼開關(guān)編碼 說明:系統(tǒng)顯示撥碼開關(guān)所設(shè)置的編碼000~255*/includeincludedefine uchar unsigned chardefine uint unsigned int//各數(shù)字的數(shù)碼管段碼(共陰)uchar code DSY_CODE[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}。 RELAY=~RELAY。 RELAY=1。t++)。 while(ms)for(t=0。sbit RELAY=P2^4。 LED2=S2。sbit LED2=P0^1。sbit S2=P1^1。 }}18 開關(guān)控制LED/* 名稱:開關(guān)控制LED 說明:開關(guān)S1和S2分別控制LED1和LED2。 Pre_KeyNo=KeyNo。 //獲取鍵序號 if(Pre_KeyNo!=KeyNo) { P0=~DSY_CODE[KeyNo]。 while(1) { P1=0xf0。}//主程序void main(){ P0=0x00。 BEEP=~BEEP。i100。 }}//蜂鳴器void Beep(){ uchar i。break。break。break。 Tmp=P14^0x0f。 //無鍵按下 } P1=0xf0。break。break。break。break。 Tmp=P1^0x0f。 P1=0x0f。i++)。 while(x) for(i=0。//上次按鍵和當(dāng)前按鍵的序號,該矩陣中序號范圍0~15,16表示無按鍵uchar Pre_KeyNo=16,KeyNo=16。*/includedefine uchar unsigned chardefine uint unsigned int//段碼uchar code DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0x00}。 //點(diǎn)亮條形LED P2=P2_LED。 else P2_LED=1。i=KeyNo。 P3_LED=0xff。 //按鍵序號,1表示無按鍵 while(1) { KeyNo=Keys_Scan()。}//主程序void main(){ uchar i,P2_LED,P3_LED。 } else sCode=_crol_(sCode,1)。i16。0xf0)!=0xf0) { kCode=~P1。k++) //對4行分別進(jìn)行掃描 { P1=sCode。 //行掃描碼初值 for(k=0。 if((P1amp。 //若高4位出現(xiàn)0,則有鍵按下 if((P1amp。} //鍵盤掃描uchar Keys_Scan(){ uchar sCode,kCode,i,k。i120。//延時(shí)void DelayMS(uint x){ uchar i。 }}16 4X4矩陣鍵盤控制條形LED顯示/* 名稱:4X4矩陣鍵盤控制條形LED顯示 說明:運(yùn)行本例時(shí),按下的按鍵值越大點(diǎn)亮的LED越多。 case 0xfb: Key_Counts=0。 case 0xfd: if(Key_Counts0) Key_Counts。 switch(Key_Code) { case 0xfe: if(Key_Counts255) Key_Counts++。i30。 Key_Code=P1。 while(1) { Show_Counts_ON_DSY()。 P2=0x00。 P0=0xff。 DelayMS(1)。 P0=DSY_CODE[Num_Buffer[i]]。i++) { j=_cror_(j,1)。 for(i=0。 Num_Buffer[1]=Key_Counts/10%10。} //顯示函數(shù)void Show_Counts_ON_DSY(){ uchar i,j=0x01。i120。//延時(shí)void DelayMS(uint x){ uchar i。//待顯示的3位緩沖uchar Num_Buffer[]={0,0,0}。 }}15 K1K4 控制數(shù)碼管加減演示/* 名稱:K1K4 控制數(shù)碼管加減演示 說明:按下K1后加1計(jì)數(shù),按下K2后減1計(jì)數(shù),按下K3后清零。 Key_Counts=0。i8。 case 0xfb: Display_Buffer[0]=0。 case 0xfd: if(Key_Counts0)Display_Buffer[Key_Counts]=10。 Display_Buffer[Key_Counts1]=Key_Counts。 //P1口按鍵狀態(tài)分別為K10xfe,K20xfd,K30xfb switch(Key_NO) { case 0xfe: Key_Counts++。 P1=0xff。 P2=0x00。 P0=0xff。 DelayMS(2)。 P0=DSY_CODE[Display_Buffer[i]]。i8。} void Show_Count_ON_DSY(){ uchar i。i120。//延時(shí)void DelayMS(uint x){ uchar i。//位碼uchar code DSY_Index[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01}。 } } }}14 K1K4 控制數(shù)碼管移位顯示/* 名稱:K1K4 控制數(shù)碼管移位顯示 說明:按下K1時(shí)加1計(jì)數(shù)并增加顯示位, 按下K2時(shí)減1計(jì)數(shù)并減少顯示位, 按下K3時(shí)清零。break。break。 break。 P0=1。 Key_State=1。 k=0。 if(t!=P1) continue。 while(1) { t=P1。 P0=0xff。i++)。 while(x) for(i=0。 } DelayMS(10)。 } if(K4==0) { while(K4==0)。 if(K3==0) { while(K3==0)。 while(1) { LED1=K1。} //主程序void main(){ P0=0xff。i120。//延時(shí)void DelayMS(uint x){ uchar i。sbit K3=P1^2。sbit K1=P1^0。sbit LED3=P0^2。 } }}12 K1K4 按鍵狀態(tài)顯示/* 名稱:K1K4 按鍵狀態(tài)顯示 說明:KK2按下時(shí)LED點(diǎn)亮,松開時(shí)熄滅, KK4按下并釋放時(shí)LED點(diǎn)亮,再次按下并釋放時(shí)熄滅;*/includedefine uchar unsigned chardefine uint unsigned intsbit LED1=P0^0。 //保存最近按鍵 Move_LED()。 Recent_Key=0xff。 P2=0xfe。 //K4}//主程序void main(){ uchar Recent_Key。 //K3 else if((P1amp。 //K2 else if((P1amp。 //K1 else if((P1amp。} //根據(jù)P1口的按鍵移動LEDvoid Move_LED(){ if ((P1amp。i120。 //環(huán)形隊(duì)列首支針k遞增,Num下標(biāo)范圍0~10,故對11取余 }}11 K1K4 控制LED移位/* 名稱:K1K4 控制LED移位 說明:按下K1時(shí),P0口LED上移一位; 按下K2時(shí),P0口LED下移一位; 按下K3時(shí),P2口LED上移一位; 按下K4時(shí),P2口LED下移一位;*/includeincludedefine uchar unsigned chardefine uint unsigned int//延時(shí)void DelayMS(uint x){ uchar i。 //發(fā)送位碼 DelayMS(2)。 m=_crol_(m,1)。j++) { //發(fā)送段碼,采用環(huán)形取法,從第k個(gè)開始取第j個(gè) P0=0xff。i++) { for(j=0。 while(1) { //刷新若干次,保持一段時(shí)間的穩(wěn)定顯示 for(i=0。t++)。 while(x) for(t=0。//下面數(shù)組看作環(huán)形隊(duì)列,顯示從某個(gè)數(shù)開始的8個(gè)數(shù)(10表示黑屏)uchar Num[]={10,10,10,10,10,10,10,10,2,9,8}。 //關(guān)閉所有數(shù)碼管并延時(shí) DelayMS(1000)。 //發(fā)送位碼 DelayMS(2)。 P0=DSY_CODE[j]。j8。i30。}//主程序void main(){ uchar i,j。t120。//延時(shí)void DelayMS(uint x){ uchar t。*/includedefine uchar unsigned chardefine uint unsigned int//段碼表uchar code DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}。 //發(fā)送位碼 DelayMS(2)。 //發(fā)送段碼 wei=_crol_(wei,1)。i++) { P2=0xff。 while(1) { for(i=0。t++)。 while(x) for(t=0。*/includeincludedefine uchar unsigned chardefine uint unsigned intuchar code DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}。 //發(fā)送位碼 DelayMS(300)。 P0=DSY_CODE[i]。i++) { P2=0xff。 while(1) { for(i=0。t++)。 while(x) for(t=0。 }}07 8只數(shù)碼管滾動顯示單個(gè)數(shù)字/* 名稱:8只數(shù)碼管滾動顯示單個(gè)數(shù)字 說明:數(shù)碼管從左到右依次滾動顯示0~7,程序通過每次僅循環(huán)選通一只數(shù)碼管*/includeincludedefine uchar unsigned chardefine uint unsigned intuchar code DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,
點(diǎn)擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1