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

正文內(nèi)容

數(shù)字測溫儀的設(shè)計-資料下載頁

2025-06-07 14:28本頁面
  

【正文】 N=0x80。 18 a8255_PB=0xff。 a8255_PA=0xff。 delay(2)。 if(place==1) test=0xdf。 //個位數(shù)碼管 else if(place==2) test=0xef。 //十位數(shù)碼管 else if(place==3) test=0xf7。 //百位數(shù)碼管 else if(place==4) test=0xfb。 //千位數(shù)碼管 else if(place==5) test=0xfd。 //萬位數(shù)碼管 else if(place==6) test=0xfe。 //十萬位數(shù)碼管 a8255_PA=test。 if(num==0) display_num=dis_table[0]。 else if(num==1) display_num=dis_table[1]。 else if(num==2) display_num=dis_table[2]。 else if(num==3) display_num=dis_table[3]。 else if(num==4) display_num=dis_table[4]。 else if(num==5) display_num=dis_table[5]。 else if(num==6) 19 display_num=dis_table[6]。 else if(num==7) display_num=dis_table[7]。 else if(num==8) display_num=dis_table[8]。 else if(num==9) display_num=dis_table[9]。 else if(num==10) display_num=dis_table[10]。 //此數(shù)為 0xff,讓數(shù)碼管滅 a8255_PB=display_num。 delay(100)。 } /************************************ * 初始化 ds18b20 函數(shù) * ************************************/ void Init_DS18B20(void) { unsigned char x=0。 DQ=1。 //DQ 復位 delay(1)。 //稍做延時 DQ=0。 //單片 機將 DQ 拉低 delay(80)。 //精確延時 ,大于 480us DQ=1。 //拉高總線 delay(5)。 x=DQ。 while(x)。 //稍做延時后 ,如果‘ x=039。則初始化成功‘ x=139。則初始化失敗 delay(15)。 } 20 /************************************ * ds18b20 寫一個字節(jié)函數(shù) * ************************************/ void WriteOneChar(unsigned char dat) { unsigned char i=0。 for (i=8。i0。i) { DQ=0。 DQ=datamp。0x01。 delay(2)。 DQ=1。 dat=1。 } delay(2)。 } /************************************ * ds18b20 讀一個字節(jié)函數(shù) * ************************************/ unsigned char ReadOneChar(void) { unsigned char i=0。 unsigned char dat=0。 for (i=8。i0。i) { DQ = 0。 //給脈沖信號 dat=1。 DQ = 1。 //給脈沖信號 if(DQ) 21 dat|=0x80。 delay(2)。 } return(dat)。 } /************************************ * 顯示溫度 * ************************************/ void display(void) { unsigned char x0,x1。 x0=temp%10。 x1=temp/10。 display1(1,x0)。 //個位顯示 delay(3)。 display1(2,x1)。 //十位顯示 delay(3)。 display1(3,10)。 //百位置 0 display1(4,10)。 //千位置 0 display1(5,10)。 //萬位置 0 display1(6,10)。 //十萬位置 0 } /************************************ * 讀取溫度與處理 * ************************************/ unsigned char ReadTemp(void) { unsigned char a=0。 22 unsigned char b=0。 unsigned char t=0。 Init_DS18B20()。 //初始化 ds18b20 display()。 WriteOneChar(0xCC)。 //跳過 ROM WriteOneChar(0x44)。 //溫度轉(zhuǎn)換 Init_DS18B20()。 WriteOneChar(0xCC)。 //跳過 ROM WriteOneChar(0xBE)。 //讀暫存器 a=ReadOneChar()。 b=ReadOneChar()。 a=a4。 t=b4。 t=t|a。 return(t)。 } /************************************ * 報警函數(shù) * ************************************/ void alarm(void) { int k。 a8255_PB=0xff。 //熄滅數(shù)碼管 for(k=0。k600。k++) { Buzzer=0。 //打開蜂鳴器 delay(30)。 Buzzer=1。 //關(guān)閉蜂鳴器 delay(30)。 23 } } /************************************ * 主函數(shù) * ************************************/ void main() { while(1) { temp=ReadTemp()。 //采集溫度 if(temp=18||temp=25) //設(shè)定報警范圍為低于 18 或高于 25攝氏度 { alarm()。 //報警 display()。 //顯示溫度 delay(600)。 } else { display()。 //顯示溫度 delay(50)。 } } }
點擊復制文檔內(nèi)容
畢業(yè)設(shè)計相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1