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

正文內(nèi)容

基于nrf24l01的多點(diǎn)溫度采集系統(tǒng)設(shè)計(jì)-資料下載頁(yè)

2025-11-07 20:26本頁(yè)面

【導(dǎo)讀】隨著信息領(lǐng)域各種技術(shù)的發(fā)展,我們?cè)跀?shù)據(jù)采集方面的技術(shù)也取得了很大的進(jìn)步,采集數(shù)據(jù)的信息化是目前社會(huì)的主要發(fā)展方向。隨著工農(nóng)業(yè)生產(chǎn)對(duì)溫濕度的要求越來越高,準(zhǔn)確測(cè)量溫度變。的無線傳輸,在接收板上也有一塊無線通信模塊與它配對(duì)??刂芁CD1602液晶實(shí)時(shí)顯示溫度。本系統(tǒng)還設(shè)定了一個(gè)溫度報(bào)警,當(dāng)溫度超過這個(gè)界限。就由蜂鳴器發(fā)出警報(bào),當(dāng)溫度下降至報(bào)警溫度以下時(shí),警報(bào)自動(dòng)停止。用到的主要器件是AT89S52單片機(jī)、數(shù)字溫度傳感器DS18B20和無線。芯片nRF24L01,測(cè)量結(jié)果用LCD1602液晶顯示。的發(fā)展,現(xiàn)代控制設(shè)備不同于以前,它們?cè)谛阅芎徒Y(jié)構(gòu)發(fā)生了翻天覆地的變化。

  

【正文】 = 0。 //0 寫指令 ,1 寫數(shù)據(jù) LCD1602_EN = 0。 P0=。 //D0~D7 寫指令碼 delay_50us(10)。 LCD1602_EN = 1。 delay_50us(20)。 LCD1602_EN = 0。 } void write_data(uchar dat) //LCD 寫數(shù)據(jù)函數(shù) { LCD1602_RS = 1。 //0 寫指令 ,1 寫數(shù)據(jù) LCD1602_EN = 0。 P0 = dat。 //D0~D7 寫指令碼 delay_50us(10)。 LCD1602_EN = 1。 delay_50us(20)。 LCD1602_EN = 0。 } void LCD_init(void) //液晶初始化 { delay_50us(300)。 //延時(shí) 15ms write_(0x38)。 //寫指令 0x38 delay_50us(100)。 //延時(shí) 5ms write_(0x38)。 //寫指令 0x38 delay_50us(100)。 //延時(shí) 5ms write_(0x38)。 //寫指令 0x38 write_(0x38)。 //寫指令 0x38 write_(0x08)。 //寫指令 0x08,顯示關(guān)閉 write_(0x01)。 //寫指令 0x01,顯示清屏 第 31 頁(yè) 共 40 頁(yè) write_(0x06)。 //寫指令 0x06,顯示光標(biāo)移動(dòng)設(shè)置 write_(0x0c)。 //寫指令 0x0c,顯示開及光標(biāo)設(shè)置 } void disdignit1() {uchar i。 write_(0x80)。 //LCD1602 顯示行 for(i=0。i6。i++) { write_data(tab_temp1[i])。 } //write_(0xc0+6)。 write_data(0x30+RxBuf1[3])。 //0x30 的 10 進(jìn)制表示為 48,即 ASCII 碼字符 0 write_data(0x30+RxBuf1[2])。 write_data(0x30+RxBuf1[1])。 write_data(39。.39。)。 write_data(0x30+RxBuf1[0])。 write_data(0xDF)。 write_data(39。C39。)。 } void disdignit2() { uchar i。 write_(0xc0)。 //LCD1602 顯示行 for(i=0。i6。i++) { write_data(tab_temp2[i])。 } write_(0xc0+6)。 write_data(0x30+aa[3])。 //0x30 的 10 進(jìn)制表示為 48,即 ASCII 碼字符 0 write_data(0x30+aa[2])。 write_data(0x30+aa[1])。 write_data(39。.39。)。 write_data(0x30+aa[0])。 write_data(0xDF)。 write_data(39。C39。)。 第 32 頁(yè) 共 40 頁(yè) } void main() { BELL=0。 init_NRF24L01()。 //NRF24L01 初始化 LCD_init()。 write_(0x01)。 Delay(100)。 while(1) { SetRX_Mode1()。 nRF24L01_RxPacket1(aa)。 if(nRF24L01_RxPacket1(aa)) { aa[10]=((aa[2]4)|aa[1])。 if(aa[10]0x30) BELL=1。 //打開蜂鳴器 else BELL=0。 //關(guān)閉蜂鳴器 disdignit2()。 Delay(100)。 } SetRX_Mode()。 nRF24L01_RxPacket(RxBuf1)。 if(nRF24L01_RxPacket(RxBuf1)) { RxBuf1[10]=((RxBuf1[2]4)|RxBuf1[1])。 if(RxBuf1[10]0x30) BELL=1。 //打開蜂鳴器 else BELL=0。 //關(guān)閉蜂鳴器 disdignit1() 。 Delay(100)。 } } 第 33 頁(yè) 共 40 頁(yè) } ( 2)發(fā)送部分程序如下: include include typedef unsigned char uchar。 typedef unsigned char uint。 uchar table[7]={0}。 uchar data temp_data[2]={0x00,0x00}。 sbit MISO =P2^3。 sbit MOSI =P2^1。 sbit SCK =P2^4。 sbit CE =P2^5。 sbit CSN =P2^0。 sbit IRQ =P2^2。 sbit DQ=P1^3 。 uint bdata sta。 //NRF24L01 狀態(tài)標(biāo)志 sbit RX_DR =sta^6。 sbit TX_DS =sta^5。 sbit MAX_RT =sta^4。 define TX_ADR_WIDTH 5 // 本機(jī)地址寬度設(shè)置 define RX_ADR_WIDTH 5 // 接收方地址寬度設(shè)置 define TX_PLOAD_WIDTH 20 // 4 字節(jié)數(shù)據(jù)長(zhǎng)度 define RX_PLOAD_WIDTH 20 // 4 字節(jié)數(shù)據(jù)長(zhǎng)度 uint const TX_ADDRESS[TX_ADR_WIDTH]= {0xc2,0xc2,0xc2,0xc2,0xc3}。//本地地址 void Delay(unsigned int s) { unsigned int i。 for(i=0。 is。 i++)。 for(i=0。 is。 i++)。 } /*延時(shí)函數(shù) void inerDelay_us(unsigned char n) { for(。n0。n) _nop_()。 //延時(shí) 1us 第 34 頁(yè) 共 40 頁(yè) } /*NRF24L01 初始化 void init_NRF24L01(void) { inerDelay_us(100)。 CE=0。 // chip enable CSN=1。 // Spi disable SCK=0。 // Spi clock line init high SPI_Write_Buf(WRITE_REG + TX_ADDR, TX_ADDRESS, TX_ADR_WIDTH)。 // 寫本地地址 SPI_RW_Reg(WRITE_REG + EN_AA, 0x01)。 // 頻道 0 自動(dòng) ACK應(yīng) 答允許 SPI_RW_Reg(WRITE_REG + EN_RXADDR, 0x01)。 // 允許接收地址只有頻道 0,如果需要多頻道可以參考 Page21 SPI_RW_Reg(WRITE_REG + RF_CH, 0)。// 設(shè)置信道工作為 ,收發(fā)必須一致 SPI_RW_Reg(WRITE_REG + RX_PW_P0, RX_PLOAD_WIDTH)。 //設(shè)置接收數(shù)據(jù)長(zhǎng)度,本次設(shè)置為 4字節(jié) SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x07)。 //設(shè)置發(fā)射速率為1Mkbps,發(fā)射功率為最大值 0dB } /*函數(shù): uint SPI_RW(uint uchar) /*功能: NRF24L01 的 SPI 寫時(shí)序 ,詳細(xì)看時(shí)序圖, Page19 uint SPI_RW(uint uchar) { uint bit_ctr。 for(bit_ctr=0。bit_ctr8。bit_ctr++) // output 8bit { MOSI = (uchar amp。 0x80)。 // output 39。uchar39。, MSB to MOSI uchar = (uchar 1)。 // shift next bit into MSB.. SCK = 1。 // Set SCK high.. uchar |= MISO。 // capture current MISO bit SCK = 0。 // ..then set SCK low again } return(uchar)。 // return read uchar } /*函數(shù): uchar SPI_Read(uchar reg) /*功能: NRF24L01 的 SPI 時(shí)序 第 35 頁(yè) 共 40 頁(yè) uchar SPI_Read(uchar reg) { uchar reg_val。 CSN = 0。 // CSN low, initialize SPI munication... SPI_RW(reg)。 // Select register to read from.. reg_val = SPI_RW(0)。 // ..then read registervalue CSN = 1。 // CSN high, terminate SPI munication return(reg_val)。 // return register value } /*功能: NRF24L01 讀寫寄存器函數(shù) , uint SPI_RW_Reg(uchar reg, uchar value) { uint status。 CSN = 0。 // CSN low, init SPI transaction status = SPI_RW(reg)。 // select register SPI_RW(value)。 // ..and write value to it.. CSN = 1。 // CSN high again return(status)。 // return nRF24L01 status uchar } /*函數(shù): uint SPI_Read_Buf(uchar reg, uchar *pBuf, uchar uchars) /*功能 : 用于讀數(shù)據(jù), reg:為寄存器地址, pBuf:為待讀出數(shù)據(jù)地址, uchars:讀出數(shù)據(jù)的個(gè)數(shù) uint SPI_Read_Buf(uchar reg, uchar *pBuf, uchar uchars) { uint status,uchar_ctr。 CSN = 0。 // Set CSN low, init SPI tranaction status = SPI_RW(reg)。 // Select register to write to and read status uchar for(uchar_ctr=0。uchar_ctruchars。uchar_ctr++) pBuf[uchar_ctr] = SPI_RW(0)。 // CSN = 1。 return(status)。 // return nRF24L01 status uchar } /*函數(shù): uint SPI_Write_Buf(uchar reg, uchar *pBuf, uchar uchars) /*功能 : 用于寫數(shù)據(jù):為寄存器地
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1