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

正文內(nèi)容

單片機(jī)課程設(shè)計(jì)報(bào)告-基于單片機(jī)的數(shù)字溫度計(jì)設(shè)計(jì)(編輯修改稿)

2024-12-02 12:12 本頁(yè)面
 

【文章內(nèi)容簡(jiǎn)介】 DS18B20 讀 字節(jié) /* 讀取一位數(shù)據(jù) */ bit RdBit() { uchar i。 bit b。 DQ = 0。 //讀開始 1us i++。 DQ = 1。 //產(chǎn)生讀時(shí)間隙 15us i++。 i++。 b = DQ。 //讀位 i = 8。 while(i0) i。 //等待 60us DQ = 1。 //釋放總線 return b。 } /* 讀取 字節(jié)數(shù)據(jù) */ uchar RdByte() { uchar i,j,d。 d=0。 for(i=0。i8。i++) //各位由低向高讀出 DS18B20 { j=RdBit()。 d=(j7)|(d1)。 } return d。 } DS18B20 寫字節(jié) /* 寫入字節(jié)數(shù)據(jù) */ void WrByte(uchar d) { uint i。 uchar j。 bit btmp。 for(j=0。j8。j++) //各位由低向高寫入 DS18B20 { btmp=damp。0x01。 d=d1。 if(btmp) //寫 1 { DQ=0。 //延時(shí) 15us i++。 i++。 DQ=1。 //寫 1 時(shí)隙不低于 60u i=8。 while(i0) i。 } else //寫 0 { DQ=0。 i=8。 while(i0) i。 //保持低電平 60us 到 120us DQ=1。 //釋放總線 i++。 i++。 } } } 啟動(dòng)溫度測(cè)量 /* 啟動(dòng)溫度測(cè)量 */ void Convert() { uint i。 Delay(125)。 //延時(shí) 1ms TxReset()。 //初始化 DS18B20 RxWait()。 //等待 DS18B20 答應(yīng) Delay(125)。 //延時(shí) WrByte(0xcc)。 //跳過 ROM 命令 WrByte(0x44)。 //溫度轉(zhuǎn)換命令 for(i=0。ii++) //延時(shí) 1s Display()。 } 讀取測(cè)量結(jié)果 /* 讀取溫度值 */ void RdTemp(void) { short int temp。 uint x。 bit flag = 1。 TxReset()。 //初始化 DS18B20 RxWait()。 //等待 DS18B20 應(yīng)答 Delay(125)。 //延時(shí) WrByte(0xcc)。 //跳過 ROM 命令 WrByte(0xbe)。 //讀暫存存儲(chǔ)器命令 templow = RdByte()。 //溫度值低字節(jié),低 4 位為小數(shù) temphigh = RdByte()。 //溫度值高字節(jié) temp = (temphigh 8) | templow。 //溫度為 16 位補(bǔ)碼 if(temp0) //負(fù)溫度 { flag = 0。 temp = ~temp + 1。 } tempzheng = temp 4。 //溫度值整數(shù) x = temp amp。 0x000f。 tempxiao = (x*10)/16。 //溫度值小數(shù) if(flag) //正溫度 disp[0] = tempzheng/100。 //百位 else //負(fù)溫度 disp[0] = 16。 //負(fù)號(hào) disp[1] = (tempzheng%100)/10。 //十位 disp[2] = tempzheng%10。 //個(gè)位 disp[3] = tempxiao。 //小數(shù) } 各算法流程圖 圖 圖 發(fā) DS18B20 復(fù)位命令 發(fā)跳過 ROM 命令 發(fā)溫度轉(zhuǎn)換開始命令 結(jié)束 圖 溫度轉(zhuǎn)換流程圖 圖 計(jì)算溫度流程圖 圖 顯示數(shù)據(jù)刷新流程 圖 開始 溫度零下 ? 溫度值取補(bǔ)碼置“ — ”標(biāo)志 計(jì)算小數(shù)位溫度 BCD 值
點(diǎn)擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖片鄂ICP備17016276號(hào)-1