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

正文內(nèi)容

基于單片機(jī)的智能溫控風(fēng)扇設(shè)計(jì)-資料下載頁(yè)

2025-05-07 20:27本頁(yè)面
  

【正文】 風(fēng)扇設(shè)計(jì) 22 附錄 主程序 代碼 include include sbit PWMOUT = P1^3。 //sbit keng1 = P1^3。 //sbit led1 = P1^5。 sbit led2 = P1^4。 sbit keng2 = P1^6。 bit flag1s = 0。 //1s 定時(shí)標(biāo)志 unsigned int intT, decT。 //溫度值的整數(shù)和小數(shù)部分 unsigned char T1RH = 0。 //T0 重載值的高字節(jié) unsigned char T1RL = 0。 //T0 重載值的低字節(jié) unsigned char DIG_PLACE1[8] = { 0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f} 。 unsigned char DIG_PLACE[8] = { 0 }。 unsigned char DIG_CODE[20] = { 0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71,0x76,0x38,0x40,0x00}。 //0、 A、 b、 C、 d、 E、 F 的顯示碼 void ConfigTimer1(unsigned int ms)。 unsigned char IntToString(unsigned char *str, int dat)。 extern bit Start18B20()。 extern bit Get18B20Temp(int *temp)。 基于單片機(jī)的智能溫控風(fēng)扇設(shè)計(jì) 23 void GengXin(unsigned char intT,unsigned char decT,unsigned char in )。 void main() { bit res。 bit jian = 0。 bit jia = 0。 int temp。 //讀取到的當(dāng)前溫 度值 //int intT, decT。 //溫度值的整數(shù)和小數(shù)部分 EA = 1。 //開(kāi)總中斷 ConfigTimer1(1)。 //T1 定時(shí) 10ms Start18B20()。 //啟動(dòng) DS18B20 PWMOUT = 0。 while (1) { //******************************************************** if (flag1s) //每秒更新一次溫度 { flag1s = 0。 res = Get18B20Temp(amp。temp)。 //讀取當(dāng)前溫度 if (res) //讀取成功時(shí),刷新當(dāng)前溫度顯示 { intT = temp 4。 //分離出溫度值整數(shù)部分 decT = temp amp。 0xF。 //分離出溫度值小數(shù)部分 基于單片機(jī)的智能溫控風(fēng)扇設(shè)計(jì) 24 decT = (decT*10) / 16。 //二進(jìn)制的小數(shù)部分轉(zhuǎn)換為 1位十進(jìn)制位 GengXin( intT,decT,19 )。 } else //讀取失敗時(shí),提示錯(cuò) 誤信息 { DIG_PLACE[0] = DIG_CODE[18]。 DIG_PLACE[1] = DIG_CODE[18]。 DIG_PLACE[2] = DIG_CODE[18]。 DIG_PLACE[3] = DIG_CODE[18]。 } Start18B20()。 //重新啟動(dòng)下一次轉(zhuǎn)換 } } } /* 配置并啟動(dòng) T0, msT0 定時(shí)時(shí)間 */ void ConfigTimer1(unsigned int ms) { unsigned long tmp。 //臨時(shí)變量 tmp = 11059200 / 12。 //定時(shí)器計(jì)數(shù)頻率 tmp = (tmp *ms) / 10000。 //計(jì)算所需的計(jì)數(shù)值 tmp = 65536 tmp。 //計(jì)算定時(shí)器重載值 基于單片機(jī)的智能溫控風(fēng)扇設(shè)計(jì) 25 tmp = tmp + 12。 //補(bǔ)償中斷響應(yīng)延時(shí)造成的誤差 T1RH = (unsigned char)(tmp8)。 //定時(shí)器重載值拆分為高低字節(jié) T1RL = (unsigned char)tmp。 TMOD amp。= 0x0F。 //清零 T0 的控制位 TMOD |= 0x10。 //配置 T0 為模式 1 TH1 = T1RH。 //加載 T0 重載值 TL1 = T1RL。 ET1 = 1。 //使能 T0 中斷 TR1= 1。 //啟動(dòng) T0 } void GengXin(unsigned char intT,unsigned char decT,unsigned char in ) { DIG_PLACE[2] = DIG_CODE[intT/10%10]。 DIG_PLACE[1] = DIG_CODE[intT%10]。 DIG_PLACE[1]|=0x80。 DIG_PLACE[0] = DIG_CODE[decT]。 if((intT/100%10) == 0) DIG_PLACE[3] = DIG_CODE[in]。 else DIG_PLACE[3] = DIG_CODE[intT/100%10]。 } void shuaxin() { static unsigned char j = 0。 基于單片機(jī)的智能溫控風(fēng)扇設(shè)計(jì) 26 P2 = 0xff。 j++。 P2=DIG_PLACE1[j1]。 P0=DIG_PLACE[j1]。 if(j = 8) { j = 0。 } } /* T0 中斷服務(wù)函數(shù),完成 1 秒定時(shí) */ void InterruptTimer1() interrupt 3 { static unsigned int tmr1s = 0。 static unsigned char timer = 0。 static unsigned char timer20ms = 0。 TH1 = T1RH。 //重新 加載重載值 TL1 = T1RL。 timer20ms++。 if(timer20ms20) { shuaxin()。 timer20ms = 0。 } tmr1s++。 if (tmr1s = 5000) //定時(shí) 1s 基于單片機(jī)的智能溫控風(fēng)扇設(shè)計(jì) 27 { tmr1s = 0。 flag1s = 1。 } if(timer(intT/2)) { PWMOUT = 0。 } else { PWMOUT = 1。 } timer++。 if(timer 50) { timer = 0。 } }
點(diǎn)擊復(fù)制文檔內(nèi)容
法律信息相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1