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

正文內(nèi)容

基于單片機(jī)溫度控制系統(tǒng)的設(shè)計畢業(yè)論文(編輯修改稿)

2025-04-03 11:55 本頁面
 

【文章內(nèi)容簡介】 華大學(xué)出版社 . [7] 康華光 . 《電子技術(shù)基礎(chǔ) 模擬部分》 高等教育出版社 1998(08). [8] 余錫存 . 《單片機(jī)原理與接口技術(shù)》 西安電子科技大學(xué)出版社, 2021. 第 20 頁 共 48 頁 附件 1:系統(tǒng)原理圖 第 21 頁 共 48 頁 附件 2:系統(tǒng)相關(guān)程序 一 、 DS18B20 底層驅(qū)動程序 //延時 N ms //DS1820 引腳定義 sbit TMDAT =P1^0。 void DS1820_DelayCount (unsigned char Coun) { data unsigned char Count。 Count=Coun。 while(Count0) Count。 Count=Coun。 while(Count0) Count。 } //復(fù)位 DS18B20 void DS1820_Reset(void) { TMDAT=0。 DS1820_DelayCount(412)。 TMDAT=1。 DS1820_DelayCount(16)。 } //等待 DS18B20 應(yīng)答 unsigned char DS1820_Answer(void) 第 22 頁 共 48 頁 { data unsigned int i。 data unsigned char j。 i=0xc000。 while(TMDAT) { i。 if (i==0) return(aban_return)。 } i=0xffff。 j=3。 while(~TMDAT) { i。 if (i==0) if(j==0) return(aban_return)。 else { j。 i=0xffff。 } } DS1820_DelayCount(16)。 return(done_return)。 } //等待 DS18B20 應(yīng)答 //讀取位 bit DS1820_Readbit(void) 第 23 頁 共 48 頁 { data int i=0。 bit dat。 TMDAT=0。i++。i++。i++。i++。 TMDAT=1。i++。i++。i++。i++。i++。i++。i++。i++。 dat = TMDAT。 // DS1820_DelayCount(8)。 DS1820_DelayCount(32)。 return dat。 } //讀取字節(jié) unsigned char DS1820_Readbyte(void) { data unsigned char i,j,dat=0。 for(i=1。i=8。i++) { j=DS1820_Readbit()。 dat=(j7)|(dat1)。 } return dat。 } //寫一個字節(jié) void DS1820_Writebyte(unsigned char dat) { data signed char i=0。 data unsigned char j。 bit testb。 for(j=1。j=8。j++) { 第 24 頁 共 48 頁 testb=dat amp。 0x01。 dat = dat1。 if(testb) { TMDAT=0。 i++。i++。i++。i++。i++。i++。i++。i++。 TMDAT=1。 //DS1820_DelayCount(8)。 DS1820_DelayCount(32)。 } else { TMDAT=0。 //DS1820_DelayCount(8)。 DS1820_DelayCount(32)。 TMDAT=1。 i++。i++。i++。i++。i++。i++。i++。i++。 } } } //讀操作開始 unsigned char DS1820_StartTem(void) { EA=0。 DS1820_Reset()。 if(DS1820_Answer()==aban_return) { EA=Ea。 return(aban_return)。 } 第 25 頁 共 48 頁 // DS1820_Delayms(1)。 DS1820_Delayms(4)。 DS1820_Writebyte(0xcc)。 // DS1820_Writebyte(0x55)。 // for(i=0。i8。i++) //DS1820_Writebyte(DS1820_temp[i])。 DS1820_Writebyte(0x44)。 EA=Ea。 return(done_return)。 } //讀所有傳感器 int DS1820_ReadTem(void) { data unsigned char a,b。 data int y3。 data float y4。 data unsigned char i。 EA=0。 DS1820_Reset()。 if(DS1820_Answer()==aban_return) { EA=Ea。 return(0xffff)。 } DS1820_Delayms(4)。 DS1820_Writebyte(0xcc)。 //跳過匹配傳感器 //DS1820_Writebyte(0x55)。 //匹配 傳感器 // for(i=0。i8。i++) 第 26 頁 共 48 頁 //DS1820_Writebyte([i])。 DS1820_Writebyte(0xbe)。 //讀取溫度 for(i=0。i9。i++) { [i]=DS1820_Readbyte()。 } if(CRC(9)!=0) { EA=1。 return(0xffff)。 } //計算 CRC a = [0]。 b = [1]。 DS1820_Reset()。 y3 = (b 8)|a。 y4=y3。 y4=(y4*25)/4。 EA=1。 return((int)(y4))。 } 二 、 DS1302 時鐘底層驅(qū)動程序 //DS1302 引腳定義 sbit rtc_sc=P3^4。 第 27 頁 共 48 頁 sbit rtc_io=P3^5。 sbit rst_1302=P3^6。 bdata unsigned char temp。 sbit temp_0 = temp^0。 sbit temp_7 = temp^7。 /************************************************************** DS1302 驅(qū)動程序開始 **************************************************************/ //功能 : 往 DS1302 寫入 1Byte 數(shù)據(jù) void v_RTInputByte(unsigned char ucDa) { unsigned char i。 temp = ucDa。 for(i=8。 i0。 i) { rtc_io = temp_0。 /*相當(dāng)于匯編中的 RRC */ rtc_sc = 1。 rtc_sc = 0。 temp = temp 1。 } } //功能 : 從 DS1302 讀取 1Byte 數(shù)據(jù) unsigned char uc_RTOutputByte(void) { unsigned char i。 rtc_io=1。 for(i=8。 i0。 i) { temp = temp 1。 /*相當(dāng)于匯編中的 RRC */ temp_7 = rtc_io。 第 28 頁 共 48 頁 rtc_sc = 1。 rtc_sc = 0。 } return(temp)。 } //功能 : 往 DS1302 寫入 數(shù)據(jù) void write1302(unsigned char ucAddr,unsigned char ucDa) { bit ea。 ea=EA。 EA=0。 rtc_rs_portamp。=(~rtc_rs_bit)。 rtc_sc = 0。 rtc_rs_port|=rtc_rs_bit。 v_RTInputByte(ucAddr)。 /* 地址 ,命令 */ v_RTInputByte(ucDa)。 /* 寫 1Byte 數(shù)據(jù) */ rtc_sc = 1。 rtc_rs_portamp。=(~rtc_rs_bit)。 EA = ea。 } //功能 : 讀取 DS1302 某地址的數(shù)據(jù) unsigned char read1302(unsigned char ucAddr) { unsigned char ucDa。 bit ea。 ea=EA。 EA=0。 rtc_rs_portamp。=(~rtc_rs_bit)。 rtc_sc = 0。 第 29 頁 共 48 頁 rtc_rs_port|=rtc_rs_bit。 v_RTInputByte(ucAddr)。 /* 地址 ,命令 */ ucDa = uc_RTOutputByte()。 /* 讀 1Byte 數(shù)據(jù) */ rtc_sc = 1。 rtc_rs_portamp。=(~rtc_rs_bit)。 EA = ea。 return(ucDa)。 } //功能 : 設(shè)置初始時間 void Set1302(pTime_S time_temp) { unsigned char i= 0x80。 write1302(0x8e,0x00)。 /* 控制命令 ,WP=0,寫操作 */ write1302(i,time_tempsec)。 i +=2。 write1302(i,time_tempmin)。 i +=2。 write1302(i,time_temphou)。 i +=2。 write1302(i,time_tempday)。 i +=2。 write1302(i,time_tempmon)。 i +=2。 write1302(i,0x02)。 i +=2。 write1302(i,time_tempyea)。 i +=2。 write1302(0x8e,0x80)。 /* 控制命令 ,WP=1,寫保護(hù) */ } 第 30 頁 共 48 頁 //功能 : 讀取 DS1302 當(dāng)前時間 void get1302(void) { unsigned char i,time_bcd_temp[6]。 unsigned char ucAddr = 0x81。 for (i=0。i7。i++) { time_bcd_t
點擊復(fù)制文檔內(nèi)容
環(huán)評公示相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1