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

正文內(nèi)容

基于單片機(jī)的智能溫度計(jì)-資料下載頁(yè)

2025-06-19 12:55本頁(yè)面
  

【正文】 電平有效define FUNCTION_KEY (!(P2_4))define UP_KEY (!(P2_3))define DOWN_KEY (!(P2_2))extern unsigned char DisplayTimeFlag。void scan_key(void)。unsigned char DisplayTimeFlag = 1。void delay_key(unsigned int ms){ unsigned char j。 while(ms) {for(j=0。 j=125。 j++)。}void scan_key(void) //鍵盤掃描{ static char ct=0。 P1=ct。 if(FUNCTION_KEY) { delay_key(10)。 if(FUNCTION_KEY) { ct++。 if(ct5) ct=0。 if(ct==4 || ct==5) DisplayTimeFlag=0。//溫度范圍設(shè)置模式 else DisplayTimeFlag=1。 //時(shí)間顯示模式 delay_key(100)。}} else if(ENTER) { delay_key(10)。 if(ENTER) { if(ct==0) speak_temp(temp)。 else {ct=0。 DisplayTimeFlag=1。} delay_key(100)。}} else if(UP_KEY) { delay_key(10)。 if(UP_KEY) { if(ct==1) { if(seconde=60) {seconde=0。 minite++。}else {seconde=0。}}else if(ct==2) { minite++。if(minite=60) minite=0。} else if(ct==3) { hour++。 if(hour=24) hour=0。} else if(ct==4) { top_temp++。if(top_temp=100) top_temp=30。} else if(ct==5) { bottom_temp++。 if(bottom_temp=top_temp) bottom_temp=1。} delay_key(100)。} } else if(DOWN_KEY) { delay_key(10)。 if(DOWN_KEY) { if(ct==1) {seconde=0。} else if(ct==2) { if(minite=0) minite=59。 else minite。} else if(ct==3) { if(hour=0) hour=23。 else hour。} else if(ct==4) { top_temp。 if(top_temp=bottom_temp) { if(bottom_temp=30) top_temp=bottom_temp+10。 else {top_temp=30。} } } else if(ct==5) { bottom_temp。 if(bottom_temp=30) bottom_temp=1。} delay_key(100)。 } }}endif/*********** 部分**********/ifndef __DS18B20_H__define __DS18B20_H__include sbit DQ=P2^0。 //DS18b20通道void delay_18B20(unsigned int i)。void Init_DS18B20(void) 。unsigned char ReadOneChar(void)。void WriteOneChar(unsigned char dat)。void delay_18B20(unsigned int i) //ds18b20延遲子函數(shù)(晶振12MHz ) { while(i)。 }void Init_DS18B20(void) //ds18b20初始化函數(shù){ unsigned char x=0。 DQ = 1。 //DQ復(fù)位 delay_18B20(8)。 //稍做延時(shí) DQ = 0。 //單片機(jī)將DQ拉低delay_18B20(80)。 //精確延時(shí) 大于 480us DQ = 1。 //拉高總線 delay_18B20(14)。 x = DQ。 //稍做延時(shí)后 如果x=0則初始化成功 x=1則初始化失敗 delay_18B20(20)。}unsigned char ReadOneChar(void) // ds18b20讀一個(gè)字節(jié){ unsigned char i=0。 unsigned char dat = 0。 for (i=8。i0。i) { DQ = 0。 // 給脈沖信號(hào) dat=1。 DQ = 1。 // 給脈沖信號(hào) if(DQ) dat|=0x80。 delay_18B20(4)。 } return(dat)。}void WriteOneChar(unsigned char dat) //ds18b20寫一個(gè)字節(jié) { unsigned char i=0。 for (i=8。 i0。 i) { DQ = 0。 DQ = datamp。0x01。 delay_18B20(5)。 DQ = 1。 dat=1。}}endif/*********** **********/ifndef __TEMP_H__define __TEMP_H__include include include extern unsigned char temp1,temp2。extern unsigned char temp,top_temp,bottom_temp。extern unsigned char code str1[]。extern unsigned char code str2[]。void ReadTemperature(void)。void initTemp(void)。void displayTemp(void)。void displayTempLim(void)。unsigned char temp1,temp2。unsigned char temp,top_temp,bottom_temp。unsigned char code str1[]={temp: . oC}。unsigned char code str2[]={lim: }。void delay_Temp(unsigned int ms) //延時(shí)K*1ms,{ unsigned char j。 while(ms) {for(j=0。 j=125。 j++)。}}void ReadTemperature(void) //讀取ds18b20當(dāng)前溫度{ unsigned char a=0。 unsigned char b=0。 Init_DS18B20()。 WriteOneChar(0xCC)。 // 跳過讀序號(hào)列號(hào)的操作 WriteOneChar(0x44)。 // 啟動(dòng)溫度轉(zhuǎn)換 delay_Temp(100)。 // this message is very important Init_DS18B20()。 WriteOneChar(0xCC)。 //跳過讀序號(hào)列號(hào)的操作 WriteOneChar(0xBE)。 //讀取溫度寄存器等前兩個(gè)就是溫度 delay_Temp(100)。 a=ReadOneChar()。 //讀取溫度值低8位 b=ReadOneChar()。 //讀取溫度值高8位 temp1=b4。 temp1+=(aamp。0xf0)4。 //小數(shù)點(diǎn)前的數(shù)據(jù) temp2=aamp。0x0f。 //小數(shù)點(diǎn)后的數(shù)據(jù) temp=temp1。 } void initTemp(void) //定時(shí)器t0初始化{ top_temp=30。 bottom_temp=1。 initLCM()。 Init_DS18B20()。 }void displayTemp(void) //液晶顯示子函數(shù)1正常顯示{ WriteCommandLCM(0x0c,1)。 //顯示屏打開,光標(biāo)不顯示,不閃爍,檢測(cè)忙信號(hào) DisplayListChar(0,1,str1)。 if(((char)temp1)0) DisplayOneChar(5,1,39。39。)。 else if(temp1/100) DisplayOneChar(5,1,39。139。)。 else DisplayOneChar(5,1,39。 39。)。 DisplayOneChar(6,1,(temp1%100)/10+0x30)。 DisplayOneChar(7,1,temp1%10+0x30)。 DisplayOneChar(9,1,temp2/10+0x30)。}void displayTempLim(void) //液晶顯示溫度范圍子函數(shù)1正常顯示{ char bt=0。 WriteCommandLCM(0x0c,1)。 //顯示屏打開,光標(biāo)不顯示,不閃爍,檢測(cè)忙信號(hào) DisplayListChar(0,0,str2)。 if(bottom_temp=128) { DisplayOneChar(6,0,39。39。)。 bt = 256bottom_temp。 } else { DisplayOneChar(6,0,39。 39。)。 bt = bottom_temp。 } DisplayOneChar(7,0, (bt%100)/10+0x30)。 DisplayOneChar(8,0, (bt%10)+0x30)。 DisplayOneChar(11,0,(top_temp%100)/10+0x30)。 DisplayOneChar(12,0,top_temp%10+0x30)。}endif/************以下源代碼是報(bào)警子程序部分 ****************/ifndef __BEEP_H__define __BEEP_H__include sbit BEEP = P2^6。void beep()。void delay_BEEP(unsigned int ms){ int j。 while(ms) {for(j=0。 j125。 j++)。 //一個(gè)for循環(huán)抵8條匯編}}void beep(){ unsigned char i 。 for (i=0 。i100 。i++) { delay_BEEP(5) 。 BEEP=!BEEP 。} BEEP=1 。}endif/***************以下源代碼是 ******************/ifndef __ISD1420_H__define __ISD1420_H__include define ISD1420IO P1 //播音地址端口sbit playe = P3^3。 //開始播音口extern const unsigned char speak_world[]。void speak_isd1420(unsigned char addr)。const unsigned char speak_world[]={0x00,0x00,0x08,0x10,0x18,0x20,0x28,0x30,0x38,0x40,0x48,0x50,0x58}。void delay_ISD1420(unsigned int ms) //延時(shí)K*1ms,{ int j。 while(ms) {for(j=0。 j125。 j++)。 } //一個(gè)for循環(huán)抵8條匯編} void speak_isd1420(unsigned char addr) //語(yǔ)音播報(bào)子程序 addr播音地址{ ISD1420IO = addr。 //寫地址 playe = 1。 playe = 0。 //開始播音 delay_ISD1420(800)。}endif/*******以下源代碼是語(yǔ)音播報(bào)子程序 部分 **********/ ifndef __SPEAKTEMP_H__define __SPEAKTEMP_H__include inclu
點(diǎn)擊復(fù)制文檔內(nèi)容
職業(yè)教育相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1