【正文】
if(staamp。 //返回讀到的狀態(tài)值 } //在指定位置寫指定長(zhǎng)度的數(shù)據(jù), reg:寄存器 (位置 ), *pBuf:數(shù)據(jù)指針 //len:數(shù)據(jù)長(zhǎng)度,返回值 ,此次讀到的狀態(tài)寄存器值 u8 NRF24L01_Write_Buf(u8 reg, u8 *pBuf, u8 len) { u8 status,ctr。 //寫入寄存器的值 NRF24L01_CSN_high()。 while(1) { NRF24L01_RxPacket(rx_buf)。 IWDG_Enable()。 int fputc(int ch,FILE *f) 天津職業(yè)技術(shù)師范大學(xué) 201 屆本科生畢業(yè)設(shè)計(jì) 26 { USART_SendData(USART1, ch)。 extern u8 T1,T2,R1,R2。 第四步: 將 nRF24L01 模塊 與 STM32 單片機(jī) 相連, 給單片機(jī)寫入一個(gè)發(fā)送任意數(shù)據(jù)的檢測(cè)程序,保證主從機(jī)能夠正常的進(jìn)行數(shù)據(jù)傳輸 。 圖 45 發(fā)射部分總體流程圖 圖 46 接收部分總體流程圖 開始初始化從 DHT 11 讀溫濕度數(shù)據(jù)轉(zhuǎn)換溫濕度為十進(jìn)制將轉(zhuǎn)換后的溫濕度寫入發(fā)射數(shù)組發(fā)射數(shù)據(jù)延時(shí)開始初始化判斷接收中斷從 RX _ buffer 讀數(shù)據(jù)轉(zhuǎn)換為十進(jìn)制LCD 12864 顯示天津職業(yè)技術(shù)師范大學(xué) 201 屆本科生畢業(yè)設(shè)計(jì) 15 部分軟件設(shè)計(jì) 傳感節(jié)點(diǎn)溫濕度檢測(cè)的軟件設(shè)計(jì) 為了確保通信數(shù)據(jù)接收的穩(wěn)定性和準(zhǔn)確性,對(duì)于 DHT11 溫 濕 度檢測(cè) 傳感器 軟件設(shè)計(jì)的測(cè)溫原理 必須 遵循 標(biāo)準(zhǔn) 的單總線 通信 協(xié)議,單片機(jī)通過(guò) 標(biāo)準(zhǔn)的 時(shí)序?qū)懭牒妥x出DHT11 寄存器中 的數(shù)據(jù),包括初始化 命令 、 等待應(yīng)答脈沖、發(fā)送指令及數(shù)據(jù)合并計(jì)算等 操作。并且 LCD12864 液晶屏 的顯示程序比較簡(jiǎn)單,與外部控制器的電路設(shè)計(jì)連接非常方便,能夠很好的嵌入到系統(tǒng)中。 DHT11 溫濕度傳感器的濕度檢測(cè)范圍是 20% ~90%RH; 177。但是數(shù)碼管的顯示對(duì)單片機(jī)的初學(xué)者能起到很好的編程思路學(xué)習(xí),但是本系統(tǒng)設(shè)計(jì)要求較高,不適應(yīng)用數(shù)碼管進(jìn)行顯示。 系統(tǒng)供電 電源 的 選 型 方案一: 通過(guò)單 相變壓器 將 AC220V 的交流電降壓到 AC12V 之后, 再經(jīng) 過(guò)由單向不可控二極管搭建的 橋式整流 電路對(duì)其進(jìn)行進(jìn)一步的電壓整流處理,然后再將整流后的電壓通過(guò)三端 穩(wěn)壓電源芯片 和相關(guān)濾波電路對(duì)其電壓進(jìn)行進(jìn)一步的處理 。開機(jī)時(shí)系統(tǒng)顯示系統(tǒng)時(shí)間并復(fù)位,從機(jī)采集一組環(huán)境的實(shí)時(shí)溫濕度數(shù)據(jù),通過(guò)無(wú)線通訊模塊將傳感檢測(cè)節(jié)點(diǎn)周圍的溫濕度數(shù)據(jù)發(fā)送給主機(jī)并在液晶上顯示出來(lái),主機(jī)通過(guò)程序判斷是否達(dá)到預(yù)警值,并控制報(bào)警電路主機(jī)從機(jī)一 從機(jī)二LCD 顯示天津職業(yè)技術(shù)師范大學(xué) 201 屆本科生畢業(yè)設(shè)計(jì) 4 等相關(guān)模組工作的程序流程。 國(guó)內(nèi)外研究狀況及 發(fā)展趨勢(shì) 近年來(lái),伴隨著計(jì)算機(jī)技術(shù)的發(fā)展,無(wú)線射頻通信技術(shù)在近幾年也得到了迅猛的發(fā)展,目前國(guó)內(nèi)的無(wú)線射頻技術(shù)也逐漸成熟,很多公司開研發(fā)出種類齊全的射頻無(wú)線數(shù)據(jù)傳輸模塊和芯片。s living standards and the continuous improvement of technology, whether it is the agricultural or industrial or daily life of the temperature and humidity data monitoring are increasingly high requirements. The basis for the design of the subject is based on nRF24L01 munication module of multichannel wireless temperature and humidity data acquisition and transmission circuit system design, mainly used in special environment or agriculture and industry field of temperature and humidity data acquisition and monitoring. System uses wireless munication technology and wireless temperature and humidity sensor technology, the wireless data munication technology can reduce the wiring space brought about by the construction difficulty and the construction cost in a great extent. The system use STM32 microcontroller as the main control chip. The system prises a wireless data munication module, temperature and humidity sensor DHT11, LCD liquid crystal display module, buzzer voice alarm module, and LED indicator relay simulation and other peripheral circuits. The system consists of a host puter architecture, and the host system can collect data from multiple sensing nodes simultaneously.. Sensor nodes through from the machine will be realtime temperature and humidity data acquisition to the microcontroller, after data processing by nRF24L01 module to send to the host host receives the need to deal with the data measured from the data on the machine, and procedures set upper limit value for parison, judgment parameters monitoring sensor node whether it reaches the warning value and the alarm circuit and analog relay module were corresponding control. Finally after the actual hardware and software testing, this work realized STM32 MCU acquisition multi node temperature and humidity sensor data, transmits a certain distance through the nRF24L01 module and special munication protocol, finally in the host LCD12864 liquid crystal display model. Key Words: CPU; nRF24L01; Sensor; Host; LCD screenI 目 錄 第 1 章 緒論 ..................................................................................................................... 1 引言 .................................................................................................................... 1 課題的研究背景及意義 .................................................................................... 1 國(guó)內(nèi)外研究狀況及發(fā)展趨勢(shì) ............................................................................ 2 第 2 章 系統(tǒng)總體設(shè)計(jì) ..................................................................................................... 3 系統(tǒng)總體方案設(shè)計(jì) ............................................................................................ 3 系統(tǒng)功能 ................................................................................................. 3 系統(tǒng)方案 ................................................................................................. 3 系統(tǒng)各模塊設(shè)計(jì)與選擇 .................................................................................... 4 溫濕度傳感器模塊設(shè)計(jì)與選擇 ............................................................. 4 無(wú)線數(shù)據(jù)傳輸模塊的設(shè)計(jì)與選擇 ......................................................... 5 電源的設(shè)計(jì)與選擇 ................................................................................. 5 單片機(jī)最小系統(tǒng)設(shè)計(jì)與選擇 ................................................................. 6 顯示電路設(shè)計(jì)與選擇 ............................................................................. 6 第 3 章 硬件電路設(shè)計(jì) ..................................................................................................... 7 系統(tǒng)硬件組成 .................................................................................................... 7 CPU 主控模塊 ................................................................................................. 7 溫濕度傳感檢測(cè)模塊 ........................................................................................ 8 無(wú)線數(shù)據(jù)收發(fā)通訊模塊 .................................................................................... 9 LCD 液晶顯示模塊 ....................................................................................... 11 蜂鳴語(yǔ)音報(bào)警模塊及模擬繼電器 LED 指示模塊 ........................................ 11 電源驅(qū)動(dòng)模塊 .................................................................................................. 12 第 4 章 系統(tǒng)軟件設(shè)計(jì) ...............................................................................