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

正文內(nèi)容

基于單片機智能溫度檢測系統(tǒng)設(shè)計報告書-資料下載頁

2025-08-19 18:04本頁面

【導(dǎo)讀】域,已經(jīng)成為了一種非常重要的事情,因此設(shè)計一個溫度測試的系統(tǒng)勢在必行。本文主要介紹了一個基于液晶1602單片機智能溫度檢測系統(tǒng)。詳細描述了利用數(shù)字。他主系統(tǒng)的輔助擴展。DS18B20與AT89S51結(jié)合實現(xiàn)最簡溫度報警系統(tǒng),該系統(tǒng)結(jié)構(gòu)簡。單,抗干擾能力強,適合于惡劣環(huán)境下進行現(xiàn)場溫度測量,有廣泛的應(yīng)用前景。關(guān)鍵詞:單片機;溫度檢測;AT89C52;DS18B20;

  

【正文】 //外部中斷 0 開關(guān) void UART_Send_Byte(uint8 dat)。 void UART_Send_Dat(uint8 dat)。 void main() { //單片機中斷初始化 EA=1。 EX0=1。 IT0=1。 /** * UART 初始化 * 波特率: 9600 */ TMOD = 0x21。 // 定時器 1 工作在方式 2(自動重裝) SCON = 0x50。 // 10 位 uart,允許串行接受 TH1 = 0xFD。 TL1 = 0xFD。 TR1 = 1。 while(1)。 } void init_51_()interrupt 1//寫外部中斷 0 服務(wù)函數(shù) { if(SW==0){ init()。 busy()。 if(SW==0){ while(1){ ifpan()。 temp_display()。 UART_Send_Dat(temp)。 //將溫度的數(shù)值發(fā)送給終端顯示。 UART_Send_Byte(39。\r39。)。 UART_Send_Byte(39。\n39。)。 } } } 26 } /** * UART 發(fā)送一字節(jié) */ void UART_Send_Byte(uint8 dat) { SBUF = dat。 while (TI == 0)。 TI = 0。 } /** * 將數(shù)據(jù)轉(zhuǎn)換成 ASC 碼并通過 UART 發(fā)送出去 */ void UART_Send_Dat(uint8 dat) { UART_Send_Byte(dat/10%10 + 39。039。)。 UART_Send_Byte(dat%10 + 39。039。)。 } 文件程序: include extern uchar temp。 uchar code table[]={0,1,2,3,4,5,6,7,8,9}。 uchar code table1[]=The temp is 。 uchar code table2[]=Gwarn!。 uchar code table3[]=normal。 uchar code table4[]=warn!!。 //寫指令 void writecmd(uchar ) //寫指令 { E=0。 RS=0。 RW=0。 P0=。 delay_1ms(2)。 E=1。 delay_1ms(2)。 E=0。 } //寫數(shù)據(jù) void writedata(uchar dat)//寫數(shù)據(jù) { E=0。 27 RS=1。 RW=0。 P0=dat。 delay_1ms(2)。 E=1。 delay_1ms(2)。 E=0。 } //初始化 void init(void) { delay_1ms(15)。 writecmd(0x38)。 delay_1ms(5)。 writecmd(0x38)。 delay_1ms(5)。 writecmd(0x38)。 writecmd(0x38)。 busy()。 writecmd(0x08)。 busy()。 writecmd(0x01)。 busy()。 writecmd(0x06)。 busy()。 writecmd(0x0c)。 writecmd(0x01)。 } //延時 1ms 程序 void delay_1ms(uint i) { uint j,k。 for(j=0。ji。j++) for(k=0。k=168。k++)。 } void ifpan() //溫度判斷響應(yīng)函數(shù) { uint i。 if(temp=30) { GREEN_LED=0。 RED_LED=1。 28 YELLOW_LED=1。 writecmd(0x80+0x45)。 for(i=0。i6。i++) { writedata(table3[i])。 delay_1ms(2)。 } } if(temp30) { GREEN_LED=1。 RED_LED=1。 YELLOW_LED=0。 writecmd(0x80+0x45)。 for(i=0。i6。i++) { writedata(table4[i])。 delay_1ms(2)。 } } if(temp31) { GREEN_LED=1。 YELLOW_LED=1。 RED_LED=0。 RED_LED=0。 delay_1ms(500)。 RED_LED=1。 delay_1ms(500)。 writecmd(0x80+0x45)。 for(i=0。i6。i++) { writedata(table2[i])。 delay_1ms(2)。 } BELL()。 } } void temp_display() //溫度顯示函數(shù) { uint i。 writecmd(0x80)。 //顯示 The temp is for(i=0。i12。i++) { 29 writedata(table1[i])。 delay_1ms(2)。 } writecmd(0x80+0x0b)。 writedata(39。:39。)。 //顯示 冒號: temp=readtemp()。 //這條指令要在 while 語句里才會生效 writecmd(0x80+0x0D)。 writedata(table[temp%10]+48)。 delay_50us(50)。 writecmd(0x80+0x0C)。 writedata(table[temp/10]+48)。 delay_50us(50)。 writecmd(0x80+0x0e)。 writedata(0xdf)。 //顯示符號 度。 writecmd(0x80+0x0f)。 writedata(39。C39。)。 //顯示符號 C } void BELL() { KEY=0。 delay_1ms(1000)。 KEY=1。 delay_1ms(1000)。 } 文件程序: include uchar temp。 void init_DS18B20(void) //對 DS18B20 進行初始化 { uchar n。 //采樣 DQ=1。 delay(8)。 DQ=0。 delay(80)。 DQ=1。 delay(8)。 n=DQ。 delay(4)。 } void write_byte(uchar dat) //寫一個字節(jié) { uchar i。 for(i=0。i8。i++) //一位一位的寫,一共寫 8 位 { DQ=0。 30 DQ=datamp。0x01。 delay(4)。 DQ=1。 dat=1。 } delay(4)。 } uchar read_byte(void) //讀一個字節(jié) { uchar i,value。 for(i=0。i8。i++) { DQ=0。 value=1。 //延時一會 DQ=1。 if(DQ) value|=0x80。 delay(4)。 } return value。 } uchar readtemp() //讀溫度 { uchar a,b。 init_DS18B20()。 write_byte(0xcc)。 //跳過 ROM write_byte(0x44)。 //啟動溫度測量 delay(300)。 init_DS18B20()。 write_byte(0xcc)。 write_byte(0xbe)。 a=read_byte()。 //讀高八位 MSB b=read_byte()。 //讀第八位 LSB b=4。 b+=(aamp。0xf0)4。 return b。 }
點擊復(fù)制文檔內(nèi)容
研究報告相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1