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

正文內(nèi)容

基于51單片機(jī)的蓄冰系統(tǒng)控制電路設(shè)計(jì)-大學(xué)畢業(yè)論文畢業(yè)設(shè)計(jì)學(xué)位論文范文模板參考資料-資料下載頁

2025-05-07 20:18本頁面
  

【正文】 | (Value%10)))。 } void DS1302_GetTime(SYSTEMTIME *Time) //獲取時(shí)間, BCD 碼轉(zhuǎn)化為整形值 { unsigned char ReadValue。 ReadValue = Read1302(DS1302_SECOND)。 TimeSecond = ((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 ReadValue = Read1302(DS1302_MINUTE)。 TimeMinute = ((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 ReadValue = Read1302(DS1302_HOUR)。 TimeHour = ((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 ReadValue = Read1302(DS1302_DAY)。 TimeDay = ((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 ReadValue = Read1302(DS1302_WEEK)。 TimeWeek = ((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 ReadValue = Read1302(DS1302_MONTH)。 TimeMonth = ((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 ReadValue = Read1302(DS1302_YEAR)。 TimeYear = ((ReadValueamp。0x70)4)*10 + (ReadValueamp。0x0F)。 } void DateToStr(SYSTEMTIME *Time) //顯示日期,月、日 { play3(TimeMonth/10)。 play2(TimeMonth%10)。 25 play4()。 play1(TimeDay/10)。 play0(TimeDay%10)。 } void TimeToStr(SYSTEMTIME *Time) //顯示時(shí)間,時(shí)、分 { play3(TimeHour/10)。 play2(TimeHour%10)。 play4()。 play1(TimeMinute/10)。 play0(TimeMinute%10)。 } void Initial_DS1302(void) //初始化 DS1302 { unsigned char Second=Read1302(DS1302_SECOND)。 if(Secondamp。0x80) DS1302_SetTime(DS1302_SECOND,0)。 //啟動(dòng) DS1302 } endif 附錄 2 DS18B20 測(cè)溫程序 ifndef _DS18B20_ define _DS18B20_ define uint unsigned int define uchar unsigned char sbit DS=P3^4。 //define interface bit Tflag。 //溫度正負(fù)標(biāo)志 bit baojing。 void delay(uint x) { uint i。 uchar j。 for(i=x。i0。i) for(j=110。j0。j)。 } void DelayUs(uint num) // 延時(shí)函數(shù) { while( num )。 //大概 8 微秒 } 26 /******************************************* 復(fù)位脈沖,當(dāng)總線保持低電平大于 480us *******************************************/ void dsreset() //send reset and initialization mand { uint i。 DS = 0。 DelayUs(90)。 // 精確延時(shí) 大于 480us i=100。 while(i0) i。 DS = 1。 DelayUs(4)。 // 90, 4 可以小范圍變化 i=4。 while(i0) i。 } /**************************************** 檢測(cè)存在信號(hào) ****************************************/ void TmpreExist () { uint i。 while (DS)。 while (~DS)。 i=4。 while(i0) i。 } /****************************************** 讀取一位 BIT .整個(gè)讀時(shí)間間隙必須保持 60us ,采樣時(shí)間大于 1us。 *****************************************/ bit tmpreadbit(void) //read a bit { uint i。 bit dat。 DS= 0。 i++。 // i++。大概 1us DS = 1。 i++。 i++。 dat = DS。 DelayUs(8)。 return (dat)。 } /***************************************** 讀取一個(gè)字節(jié),讀出的數(shù)據(jù)低位在先 ******************************************/ 27 uchar tmpread(void) //read a byte date { uchar i,j,dat。 dat=0。 for(i=1。i=8。i++) { j=tmpreadbit()。 dat=(j7)|(dat1)。 //讀出的數(shù)據(jù)最低位在最前面,這樣剛好一個(gè)字節(jié)在 DAT 里 } return(dat)。 } /****************************************** 寫一個(gè)字節(jié)到 0 和寫 后延時(shí)在 45US 內(nèi)。 ******************************************/ void tmpwritebyte(uchar dat) //write a byte to ds18b20 { uint i。 uchar j。 bit testb。 for(j=1。j=8。j++) { testb=datamp。0x01。 dat=dat1。 if(testb) //write 1 { DS = 0。 // 先拉低 i++。 i++。 // 1us DS = 1。 DelayUs(4)。 } else { DS = 0。 DelayUs(4)。 // 大一點(diǎn) 沒影響,但不能太大,寫一個(gè)位在 30us 內(nèi) DS = 1。 i++。 i++。 // 再拉高 } } } /********寫入報(bào)警溫度 **********/ void baojin( uint shangwen , uint xiawen) { dsreset()。 28 TmpreExist ()。 DelayUs(1)。 tmpwritebyte(0xcc)。 tmpwritebyte(0x4e)。 tmpwritebyte(shangwen)。 tmpwritebyte(xiawen)。 } /**********把溫度上下限寫入 EEPRAM*************/ void xianwen() { dsreset()。 TmpreExist ()。 DelayUs(1)。 tmpwritebyte(0xcc)。 tmpwritebyte(0x48)。 } /****************************************** 啟動(dòng) DS18B20 轉(zhuǎn)換。因?yàn)榭偩€上只有一個(gè)器件,可以直接向 18B20 發(fā)溫度變換命令。既 0xcc, 然后啟動(dòng)轉(zhuǎn)換, 0X44。 ******************************************/ void tempchang() { uint i。 i++。 dsreset()。 TmpreExist ()。 i++。 tmpwritebyte(0xcc)。 tmpwritebyte(0x44)。 } /****************************************** 計(jì)算讀回的溫度值。由于讀回的數(shù)據(jù)是 16 位的 ,所以分讀高位和低位。 ******************************************/ uint tmp() //get the temperature { uchar a,b,y1,y2,y3。 dsreset()。 TmpreExist () 。 delay (1)。 tmpwritebyte(0xcc)。 tmpwritebyte(0xbe)。 // 讀暫存器 29 a = tmpread ()。 // LSB 低 8 位 b = tmpread()。 // MSB 高 8 位 if((b amp。 0x80)==0x80) //判斷溫度正負(fù) { b=~b。a=~a+1。 //負(fù)溫度處理( DS18B20 的負(fù)溫度是正的反碼,即將它取反 +1,就得到正的溫度) y1=a4。 //降低精度(去掉小數(shù)點(diǎn)) y2=b4。 //減 小測(cè)量范圍( 5599176。 C) y3=y1 | y2。 Tflag=0。 } else { y1=a4。 y2=b4。 y3=y1 | y2。 Tflag=1。 } if(y3=0x1B) //比較溫度是否大于 28 攝氏度 { baojing=1。 delay(10)。 } else { baojing=0。 delay(10)。 } return(y3)。 } void Write_Temprature(uint temp) //溫度顯示,十位,個(gè)位 { uint shi,ge,xiaoshu。 shi=temp/10+0x30。 ge=temp%10+0x30。 xiaoshu=temp*625/1000%10+0x30。 play1(shi)。 play0(ge)。 } endif
點(diǎn)擊復(fù)制文檔內(nèi)容
試題試卷相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1