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

正文內(nèi)容

基于單片機(jī)控制的無線防盜系統(tǒng)設(shè)計(jì)畢業(yè)論文(參考版)

2025-06-22 12:48本頁面
  

【正文】 //接收地址1 //***************************************NRF24L01寄存器指令*******************************************************define READ_REG 0x00 // 讀寄存器指令define WRITE_REG 0x20 // 寫寄存器指令define RD_RX_PLOAD 0x61 // 讀取接收數(shù)據(jù)指令define WR_TX_PLOAD 0xA0 // 寫待發(fā)數(shù)據(jù)指令define FLUSH_TX 0xE1 // 沖洗發(fā)送 FIFO。 //本地地址 uint const RX_ADDRESS[RX_ADR_WIDTH]= {0x01,0x20,0x20,0x20,0x20}。uchar rx_buf[5]。N39。uchar i。define fmq_on() fmq=0define fmq_off() fmq=1define led_on() LED=0define led_off() LED=1typedef unsigned char uchar。sbit LED=P3^7。sbit CE =P2^2。sbit MOSI =P2^3。 dis_time()。 dis_date()。 LCD_DIS_STR(0,12,w[week1])。 LCD_DIS_STR(1,0,t)。 t[7]=num[miao%10]。:39。 t[4]=num[fen%10]。:39。 t[1]=num[shi%10]。 miao=read_ds(0)。 shi=read_ds(4)。 LCD_DIS_STR(0,1,d)。 d[9]=num[day%10]。39。 d[6]=num[month%10]。39。 d[3]=num[year%10]。039。239。 day=read_ds(7)。 year=read_ds(9)。 write_ds(9,11)。 write_ds(7,17)。 write_ds(4,19)。 write_ds(0,0)。}/******首次操作輸入,以后不必再寫入//**********首次操作DS12C887**************************void first_init_ds(){ // write_ds(0x0A,0x20)。 cs=1。 as=1。 ds_BUF=0xff。 as=0。 rw=1。 as=1。}//************讀DS12C887中的數(shù)據(jù)*****************************uchar read_ds(uchar add){ uchar time。 rw=1。 ds_BUF=DAT。 as=0。 rw=1。 as=1。void dis_week()。void dis_date()。uchar read_ds(uchar add)。uchar code w[7][4]={MON,TUE,WED,THU,FRI,SAT,SUN}。939。839。739。639。539。439。339。239。139。039。define uchar unsigned chardefine uint unsigned intdefine ulong unsigned longdefine ds_BUF P0uchar miao,fen,shi,day,week,month,year。sbit as=P2^6。 //寫數(shù)據(jù)到指令寄存器}//*********************此部分為時(shí)間顯示部分*********************************//**********************************************************//**************************************************************************includeincludesbit ds=P1^7。} if(c!=0){ kk+=1。 if(a!=0){ kk+=4。 ++s。 } } else { lcd_pos(0x40+pos2)。 while(*s!=0) { lcd_wdat(*s)。 lcd_wdat(CH)。 lcd_wdat(CH)。 //清除LCD的顯示內(nèi)容 delay_ms(1)。 //清除LCD的顯示內(nèi)容 delay_ms(1)。 // delay_ms(1)。 // delay_ms(1)。 // delay_ms(1)。 ep = 0。 _nop_()。 _nop_()。 _nop_()。 _nop_()。 send_HC595(dat)。 rw = 0。}/***************寫顯示數(shù)據(jù)到LCD************************/lcd_wdat(uchar dat) { delay_ms(10)。 ep = 0。 _nop_()。 _nop_()。 _nop_()。 _nop_()。 send_HC595(cmd)。 _nop_()。 rw = 0。 //鎖存產(chǎn)生高電平跳變,數(shù)據(jù)輸出 } /**************寫指令數(shù)據(jù)到LCD中*****************/lcd_wcmd(uchar cmd){ delay_ms(10)。 _nop_()。 //時(shí)鐘產(chǎn)生高電平跳變,數(shù)據(jù)移位 } RCK=0。 _nop_()。 //輸入后左移以為,準(zhǔn)備輸入第二位 SCLK=0。0x80。i8。 } }}/***********74HC595驅(qū)動(dòng)函數(shù)*******************/void send_HC595 (uchar wrDat) { uchar i。 _nop_()。 i++) { _nop_()。 while(ms) { for(i = 0。sbit ep = P1^3。 /********LCD引腳定義*********/sbit rs = P1^5。sbit RCK=P1^2。 SPI_RW_Reg(WRITE_REG+STATUS,0XFF)。 delay_ms(100)。 led_on()。 init_NRF24L01()。 hw=1。 }}void main(){ uchar tx_buf[]={1,1,1}。ji4。define led_on() led=0define led_off() led=1void delay_ms(uint x){ uchar i,j。}//*************************此部分為人體接近模塊主函數(shù)************************//*****************************************************************************includesbit led=P3^7。 //設(shè)置發(fā)射速率為1MHZ,發(fā)射功率為最大值0dB SPI_RW_Reg(WRITE_REG + CONFIG, 0x0e)。 //設(shè)置0通道接收數(shù)據(jù)長(zhǎng)度,本次設(shè)置為5字節(jié) SPI_RW_Reg(WRITE_REG + RX_PW_P1, RX_PLOAD_WIDTH)。 // 允許接收地址有頻道0和頻道1 SPI_RW_Reg(WRITE_REG + RF_CH, 0)。 // 寫接收端地址 SPI_RW_Reg(WRITE_REG + EN_AA, 0x03)。 // Spi clock line init high SPI_Write_Buf(WRITE_REG + TX_ADDR, TX_ADDRESS1, TX_ADR_WIDTH)。 // chip enable CSN=1。 } void init_NRF24L01(void){ inerDelay_us(100)。 CE=1。 //置高CE,激發(fā)數(shù)據(jù)發(fā)送 inerDelay_us(70)。 CE=0。 // 裝載接收端地址 SPI_Write_Buf(WR_TX_PLOAD, tx_buf, TX_PLOAD_WIDTH)。 // return nRF24L01 status uchar}/***********************************************************************************************************/*函數(shù):void nRF24L01_TxPacket(unsigned char * tx_buf)/*功能:發(fā)送 tx_buf中數(shù)據(jù)/**********************************************************************************************************/void nRF24L01_TxPacket(uchar * tx_buf){ CE=0。 // ..and write value to it.. CSN = 1。 // CSN low, init SPI transaction status = SPI_RW(reg)。 // }/****************************************************************************************************//*功能:NRF24L01讀寫寄存器函數(shù)/****************************************************************************************************/uint SPI_RW_Reg(uchar reg, uchar value){ uint status。 CSN = 1。 uchar_ctruchars。 //SPI使能 status = SPI_RW(reg)。 // return read uchar}/*********************************************************************************************************/*函數(shù):uint SPI_Write_Buf(uchar reg, uchar *pBuf, uchar uchars)/*功能: 用于寫數(shù)據(jù):為寄存器地址,pBuf:為待寫入數(shù)據(jù)地址,uchars:寫入數(shù)據(jù)的個(gè)數(shù) /*********************************************************************************************************/uint SPI_Write_Buf(uchar reg, uchar *pBuf, uchar uchars){ uint status,uchar_ctr。 // capture current MISO bit SCK = 0。 // shift next bit into MSB.. SCK = 1。uchar39。 0x80)。bit_ctr8。}/****************************************************************************************************/*函數(shù):uint SPI_RW(uint uchar)/*功能:NRF24L01的SPI寫時(shí)序 /****************************************************************************************************/uint SPI_RW(uint ucharx){ uint bit
點(diǎn)擊復(fù)制文檔內(nèi)容
環(huán)評(píng)公示相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1