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

正文內(nèi)容

基于51單片機(jī)的c語言程序設(shè)計(jì)-wenkub

2023-07-09 16:36:07 本頁面
 

【正文】 se 2: //東西向黃燈閃爍,綠燈關(guān)閉 DelayMS(300)。GREEN_B=1。YELLOW_A=1。 while(x) for(i=0。 //南北向燈sbit YELLOW_B=P0^4。*/includedefine uchar unsigned chardefine uint unsigned intsbit RED_A=P0^0。i++) { P0=Pattern_P0[i]。i++)。uchar code Pattern_P2[]={ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfc,0xf9,0xf3,0xe7,0xcf,0x9f,0x3f,0xff, 0xe7,0xdb,0xbd,0x7e,0xbd,0xdb,0xe7,0xff,0xe7,0xc3,0x81,0x00,0x81,0xc3,0xe7,0xff, 0xaa,0x55,0x18,0xff,0xf0,0x0f,0x00,0xff,0xf8,0xf1,0xe3,0xc7,0x8f,0x1f,0x3f,0x7f, 0x7f,0x3f,0x1f,0x8f,0xc7,0xe3,0xf1,0xf8,0xff,0x00,0x00,0xff,0xff,0x0f,0xf0,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f, 0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00, 0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff}。i7。i7。i++)。 //P0的值向左循環(huán)移動(dòng) DelayMS(150)。i120。 }}//主程序void main(){ while(1) { LED=~LED。//延時(shí)void DelayMS(uint x){ uchar i。 while(x) { for(i=0。 DelayMS(150)。i++)。 }}03 8只LED左右來回點(diǎn)亮/* 名稱:8只LED左右來回點(diǎn)亮 說明:程序利用循環(huán)移位函數(shù)_crol_和_cror_形成來回滾動(dòng)的效果*/includeincludedefine uchar unsigned chardefine uint unsigned int//延時(shí)void DelayMS(uint x){ uchar i。 }}//主程序void main(){ uchar i。i++) { P2=_crol_(P2,1)。i++) { P2=_cror_(P2,1)。//延時(shí)void DelayMS(uint x){ uchar i。 }}//主程序void main(){ uchar i。 P2=Pattern_P2[i]。 //東西向燈sbit YELLOW_A=P0^1。sbit GREEN_B=P0^5。i120。GREEN_A=0。 DelayMS(2000)。 YELLOW_A=~YELLOW_A。 Operation_Type=3。GREEN_A=1。 DelayMS(2000)。 YELLOW_B=~YELLOW_B。 Operation_Type=1。 while(x) for(t=0。 P0=0x00。 DelayMS(300)。 }}07 8只數(shù)碼管滾動(dòng)顯示單個(gè)數(shù)字/* 名稱:8只數(shù)碼管滾動(dòng)顯示單個(gè)數(shù)字 說明:數(shù)碼管從左到右依次滾動(dòng)顯示0~7,程序通過每次僅循環(huán)選通一只數(shù)碼管*/includeincludedefine uchar unsigned chardefine uint unsigned intuchar code DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}。t++)。i++) { P2=0xff。 //發(fā)送位碼 DelayMS(300)。 while(x) for(t=0。 while(1) { for(i=0。 //發(fā)送段碼 wei=_crol_(wei,1)。*/includedefine uchar unsigned chardefine uint unsigned int//段碼表uchar code DSY_CODE[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90}。t120。i30。 P0=DSY_CODE[j]。 //關(guān)閉所有數(shù)碼管并延時(shí) DelayMS(1000)。 while(x) for(t=0。 while(1) { //刷新若干次,保持一段時(shí)間的穩(wěn)定顯示 for(i=0。j++) { //發(fā)送段碼,采用環(huán)形取法,從第k個(gè)開始取第j個(gè) P0=0xff。 //發(fā)送位碼 DelayMS(2)。i120。 //K1 else if((P1amp。 //K3 else if((P1amp。 P2=0xfe。 //保存最近按鍵 Move_LED()。sbit LED3=P0^2。sbit K3=P1^2。i120。 while(1) { LED1=K1。 } if(K4==0) { while(K4==0)。 while(x) for(i=0。 P0=0xff。 if(t!=P1) continue。 Key_State=1。 break。break。//位碼uchar code DSY_Index[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01}。i120。i8。 DelayMS(2)。 P2=0x00。 //P1口按鍵狀態(tài)分別為K10xfe,K20xfd,K30xfb switch(Key_NO) { case 0xfe: Key_Counts++。 case 0xfd: if(Key_Counts0)Display_Buffer[Key_Counts]=10。i8。 }}15 K1K4 控制數(shù)碼管加減演示/* 名稱:K1K4 控制數(shù)碼管加減演示 說明:按下K1后加1計(jì)數(shù),按下K2后減1計(jì)數(shù),按下K3后清零。//延時(shí)void DelayMS(uint x){ uchar i。} //顯示函數(shù)void Show_Counts_ON_DSY(){ uchar i,j=0x01。 for(i=0。 P0=DSY_CODE[Num_Buffer[i]]。 P0=0xff。 while(1) { Show_Counts_ON_DSY()。i30。 case 0xfd: if(Key_Counts0) Key_Counts。 }}16 4X4矩陣鍵盤控制條形LED顯示/* 名稱:4X4矩陣鍵盤控制條形LED顯示 說明:運(yùn)行本例時(shí),按下的按鍵值越大點(diǎn)亮的LED越多。i120。 //若高4位出現(xiàn)0,則有鍵按下 if((P1amp。 //行掃描碼初值 for(k=0。0xf0)!=0xf0) { kCode=~P1。 } else sCode=_crol_(sCode,1)。 //按鍵序號(hào),1表示無按鍵 while(1) { KeyNo=Keys_Scan()。i=KeyNo。 //點(diǎn)亮條形LED P2=P2_LED。//上次按鍵和當(dāng)前按鍵的序號(hào),該矩陣中序號(hào)范圍0~15,16表示無按鍵uchar Pre_KeyNo=16,KeyNo=16。i++)。 Tmp=P1^0x0f。break。break。 Tmp=P14^0x0f。break。 }}//蜂鳴器void Beep(){ uchar i。 BEEP=~BEEP。 while(1) { P1=0xf0。 Pre_KeyNo=KeyNo。sbit S2=P1^1。 LED2=S2。 while(ms)for(t=0。 RELAY=1。 } }}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}。t120。 P2=0xff。 DSY_Buffer[1]=Num/10%10。i++) //刷新顯示在數(shù)碼管上 { m=_crol_(m,1)。 } }}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。i200。j++)。 } }}22 按鍵發(fā)音/* 名稱:按鍵發(fā)音 說明:按下不同的按鍵會(huì)是SOUNDER發(fā)出不同頻率的聲音。sbit K3=P1^6。t120。i100。}void main(){ P1=0xff。 if(K3==0) Play(3)。//生日快樂歌節(jié)拍表,節(jié)拍決定每個(gè)音符的演奏長短uchar code SONG_LONG[]={9,3,12,12,12,24,9,3,12,12,12,24,9,3,12,12,12,12,12,9,3,12,12,12,24,0}。t++)。j++) { BEEP=~BEEP。 } DelayMS(10)。 //播放生日快樂 DelayMS(500)。sbit Clear_Key=P3^6。 if(DSY_Buffer[2]==0) //高位為0時(shí)不顯示 { DSY_Buffer[2]=0x0a。 P2=DSY_CODE[DSY_Buffer[2]]。 IE=0x81。 }}//INT0中斷函數(shù)void EX_INT0() interrupt 0{ Count++。 EX0=1。 //控制LED亮滅}26 INT0及INT1中斷計(jì)數(shù)/* 名稱:INT0及INT1中斷計(jì)數(shù) 說明:每次按下第1個(gè)計(jì)數(shù)鍵時(shí),第1組計(jì)數(shù)值累加并顯示在右邊3只數(shù)碼管上, 每次按下第2個(gè)計(jì)數(shù)鍵時(shí),第2組計(jì)數(shù)值累加并顯示在左邊3只數(shù)碼管上,后兩個(gè)按鍵分別清零。uchar code DSY_Scan_Bits[]={0x20,0x10,0x08,0x04,0x02,0x01}。 while(x) for(t=0。 Buffer_Counts[2]=Count_A/100。 if( Buffer_Counts[1]==0) Buffer_Counts[1]=0x0a。 if( Buffer_Counts[5]==0) { Buffer_Counts[5]=0x0a。i++) { P2=DSY_Scan_Bits[i]。 PX0=1。 if(K4==0) Count_B=0。 }27 定時(shí)器控制單只LED/* 名稱:定時(shí)器控制單只LED 說明:LED在定時(shí)器的中斷例程控制下不斷閃爍。 //定時(shí)器0工作方式0 TH0=(81925000)/32。 while(1)。 T_Count=0。 P2=0xfe。 TR0=1。 if(++T_Count==5) { P0=_crol_(P0,1)。*/includedefine uchar unsigned chardefine uint unsigned intsbit B1=P0^0。uint i,j,k。 //定時(shí)器0工作方式2 TH0=256200。 //啟動(dòng)定時(shí)器 while(1)。break。break。 } if(++j300) return。 //切換到下一個(gè)LED
點(diǎn)擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1