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

正文內(nèi)容

基于單片機(jī)的溫控報(bào)警器設(shè)計(jì)(完整版)

2025-01-04 20:58上一頁面

下一頁面
  

【正文】 led_off。 //關(guān) led 燈 bell_off。 display_str(0,0,realtime T:)。 lcd_w_(0x38,0)。 lcd_en_1。 _NOP()。 } //lcd1602 寫命令子函數(shù) void lcd_w_(uchar ,uchar attribc) 40 { if(attribc) //attribc 為是否是否需求 判斷 lcd1602 忙信號(hào) { lcd_busy()。 _NOP()。amp。\039。 posyamp。 PORTC=0x00。 for(i=0。 uchar read_18b20_byte(void)。 void lcd_w_(uchar ,uchar attribc)。=~(1PD4) //關(guān)閉蜂鳴器 /***********************************************************/ define dataport PORTC //設(shè)置 dataport 代表 PORTC define busy 0x80 //lcd1602 忙信號(hào)代碼 define xtal 1 //============================================================== uchar display[]=0123456789。=~BIT(PD7) //1602 的 en信號(hào)拉低電平 define DQ_OUT DDRB|=(1PB3) //設(shè)置 PB3 為輸出 define DQ_IN DDRBamp。事實(shí)上,這里也是一個(gè)時(shí)間的問題,在設(shè)計(jì)之初就沒有很好地明白,原來 DS18B20 這樣一個(gè)敏感的設(shè)備耽誤工作。在開始的時(shí)候沒有加入防抖功能,會(huì)有一個(gè)連續(xù)變化或不穩(wěn)定的關(guān)鍵值。 6 系統(tǒng)調(diào)試 在本節(jié)中,設(shè)計(jì)調(diào)試。 //溫度設(shè)定子函數(shù) display_2(t)。 //100ms 延時(shí) port_init()。 if(bai1) { bai=0。amp。 ge。 } } if((plus==0)amp。(sw==1)) //當(dāng)加 1 鍵按下并且轉(zhuǎn)換位變量 sw等于 1 { delay_ms(100)。后 RS 水平被拉低,并拉低 RW 水平,延緩 LCD1602 反應(yīng)。 //空指令,延時(shí) dataport=。 lcd_en_0。 //檢測(cè) lcd 是否處于忙狀態(tài) lcd_rs_1。 //清屏,檢測(cè)忙信號(hào) lcd_w_(0x06,1)。 //8 位數(shù)據(jù)傳輸, 2 行顯示, 5*7 字形,不檢測(cè)忙信號(hào) delay_ms(5)。 //返回?cái)?shù)據(jù)變量 } 這個(gè)函數(shù)是用于讀取傳感器一個(gè)字節(jié)的數(shù)據(jù),就是一個(gè) 8 位數(shù)據(jù)。 //拉高電平 NOP()。這樣直到整個(gè)命令完全傳送到傳感器中,再然后延時(shí)等待傳感器反應(yīng)。 //延時(shí) DQ_SET。i8。由單片機(jī)發(fā)出信號(hào),等待傳感器返回溫度數(shù)值,再將返回的數(shù)值進(jìn)行處理。 write_18b20_(0xcc)。 //設(shè)置 PB3為輸入 while(DQ_R)。 18 4 系統(tǒng)軟件設(shè)計(jì) 開始 初始化芯片 聲光報(bào)警 初始化 DS18B20 設(shè)定數(shù)值加 1 設(shè)定數(shù)值減 1 設(shè)定數(shù)值位數(shù)切換 鍵 4 是否按下 鍵 2 是否按下 鍵 3 是否按下 判斷數(shù)值是否達(dá)到設(shè)定數(shù)值 初始化 LCD1602 19 5 溫度 數(shù)據(jù)處理函數(shù) 初始化函數(shù) 程序代碼如下: void init_18b20(void) { DQ_OUT。 報(bào)警設(shè)計(jì) 采用的是聲光報(bào)警的方式來提示實(shí)時(shí)溫度已經(jīng)達(dá)到設(shè)定的溫度。如下圖,采用的是 10PIN 插針。因此,帶字符的 lcd1602 液晶顯示器對(duì)于今次設(shè)計(jì)來說, 簡(jiǎn)單直觀地 實(shí) 現(xiàn)效果。 3 系統(tǒng)硬件設(shè)計(jì) 這部分設(shè)計(jì)用到了溫度傳感器 DS18B20,這種傳感器是單數(shù)據(jù)總線傳感器,一共有三只引腳,一個(gè)引腳接電源 VCC,一個(gè)引腳接地 GND,還有一個(gè)就是數(shù)據(jù)總線引腳 DQ 接到單片機(jī)的其中一只引腳。 第 7~ 14 腳: D0~ D7 為 8 位雙向數(shù)據(jù)線。 DS18B20 內(nèi)部結(jié)構(gòu)圖 DS18B20 內(nèi)部結(jié)構(gòu)主要由四部分組成: 64 位光刻 ROM 、溫度傳感器、非揮發(fā)的溫度報(bào)警觸發(fā)器 TH 和 TL、配置寄存器。 DS18B20 的讀操作 ( 1)將數(shù)據(jù)線拉高 “1” 。 ( 8) 將數(shù)據(jù)線再次拉高到高電平 “1” 后結(jié)束。 圖 2 DS18B20 封裝圖 要注意的一點(diǎn)是, 在 DS18B20 測(cè)溫程序設(shè)計(jì)中,向 DS18B20 發(fā)出溫度轉(zhuǎn)換命令后,程序總要等待 DS18B20 的返回信號(hào),一旦某個(gè) DS18B20 接觸不好或斷線,當(dāng)程序讀該 DS18B20 時(shí),將沒有返回信號(hào),程序進(jìn)入死循環(huán),這一點(diǎn)在進(jìn)行 DS18B20 硬件連接和軟件設(shè)計(jì)時(shí)也要給予一定的重視。 DS18B20 溫度傳感器介紹 DS18B20 溫度傳感器是美國 DALLAS 半導(dǎo)體公司最新推出的一種改進(jìn)型智能溫度傳感器,與傳統(tǒng)的熱敏電阻等測(cè)溫元件相比,它能直接讀出被測(cè)溫度,并且可根據(jù)實(shí)際要求通過簡(jiǎn)單的編程實(shí)現(xiàn)9~12位的數(shù)字值讀數(shù)方式。對(duì)比之后,由單片機(jī)判斷是否報(bào)警。 2 設(shè)計(jì)的思路 這次設(shè)計(jì)的思路在于設(shè)計(jì)出一個(gè)可以根據(jù)實(shí)時(shí)溫度和設(shè)定溫度對(duì)比之后進(jìn)行聲光報(bào)警的溫度控制報(bào)警器。利用集成化的傳感器成本較高,但其準(zhǔn)確性相對(duì)于熱敏電阻比較有保障,而且單片機(jī)處理的數(shù)據(jù)也會(huì)少很多。在日常生活中,也經(jīng)常要用到高功率的電器,但是高功率電器的發(fā)熱量大,有時(shí)候又可能引起火災(zāi)等等之類的危險(xiǎn)情況。這種溫度報(bào)警器的機(jī)構(gòu)并不復(fù)雜,而且可操作性強(qiáng),應(yīng)用廣泛,擴(kuò)展性好。 關(guān)鍵詞: DS18B20, lCD1602, 單片機(jī), 聲光報(bào)警 3 Temperature alarm design based on SCM Abstract: The temperature is realtime access to the physical quantities in our daily production and life, but it can not see, just by feeling it probably only feel the temperature values, traditional pointer thermometer indicates that the temperature, but low accuracy, use is not convenient enough, the display is not intuitive, digital thermometer is made using digital more intuitive understanding of the temperature in the end they want to know is how much. Therefore, the temperature measurement is a very important physical parameters can directly tell people the size of the required temperature. With the development of science and technology of the world, for the temperature measurement requirements bee increasingly stringent, measure the temperature of the environment is also worsening. Temperature measurement is not limited to the indicators go out dressed in the reality of the society, the measurement and control of temperature everywhere, for example, the family can see inside the refrigerator thermostat. But many times, in the harsh environment of the measurement will be subject to a large degree of restriction, especially in industrial control, at this time, the automatic control of the temperature measuremente particularly important. This article is DS18B20 as the temperature sensor and the use of automatic measurement of the current temperature, to be processed by the microcontroller avr mega16 control displays the set temperature and the current temperature and through lCD1602 to, if the temperature exceeds the set temperature, the system will be relatively simple the sound and light alarm. Keywords: SCM, DS18B20, lCD1602, sound and light alarm 4 目錄 1 緒論 .............................................................................................................. 6 課題的背景 ........................................................................................ 6 課題的意義 ........................................................................................ 6 研究的基本內(nèi)容與擬解決的主要問題 ............................................ 7 研究的基本內(nèi)容 ......................................................................... 7 擬解決的主要問題 ..................................................................... 8 2 設(shè)計(jì)的思路 .................................................................................................. 8 設(shè)計(jì)基本原理 .................................................................................... 8 設(shè)計(jì)的基本條件 ................................................................................ 9 溫度報(bào)警器的技術(shù)和工作原理 ........................................................ 9 DS18B20 溫度傳感器介紹 ......................................................... 9 DS18B20 的初始化 ................................................................... 10 DS18B20 的寫操作 ................................................................... 10 DS18B20 的讀操作 ................................................................... 11 DS18B20 內(nèi)部結(jié)構(gòu)圖 ............................................................... 11 DS1
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1