您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > nrf905短距离射频通讯模块中文资料
NRF905433mhzcpdf1.nRF905NordicVLSI1.93.6V32QFN(5×5mm)433/868/915MHzISM()650usnRF905ShockBurstTMCRC()SPI-10dBm11mA12.5mAnRF9052.2.1[1]nRF905/nRF90512.21nRF9052.3nRF905ShockBurstTMShockBurstTMnRF905TRX_CETX_ENPWR_UP22.3.1ShockBurstTMnRF905SPInRF905nRF905ShockBurstTMShockBurstTM(AM)(DR)ShockBurstTMnRF905CRCnRF905ShockBurstTMnRF9052.3.1.1nRF905A.SPInRF905SPIB.TRX_CETX_ENnRF905ShockBurstTMC.nRF905ShockBurstTMll(CRC)llD.AUTO_RETRANnRF905TRX_CEE.TRX_CEnRF905ShockBurstTMTRX_ENTX_ENnRF9052.3.1.2A.TRX_CETX_ENnRF905ShockBurstTMB.650usnRF905C.nRF905D.E.nRF905CRCF.TRX_CEnRF905G.SPIH.nRF905I.nRF905ShockBurstTMShockBurstTMTRX_CETX_ENnRF905nRF905nRF9052.3.2nRF905nRF9052.5uAnRF905nRF905nRF9053.SPInRF905SIPSPInRF905SPI3.1SPISPI53.233ShockBurstTMTX_PAYLOADRX_PAYLOADTX_ADDRESSRX_ADDRESS4nRF9054.nRF905250ΩnRF905PCBnRF905[2]5.nRF905SPIShockBurstTMc#includereg52.h#includeintrins.h#includestdio.h#defineuintunsignedint#defineucharunsignedchar////sbitTXEN=P1^7;sbitTRX_CE=P1^6;sbitPWR=P1^5;//SPI//sbitMISO=P1^2;sbitMOSI=P1^3;sbitSCK=P1^1;sbitCSN=P1^0;sbitP2_0=P2^0;////sbitDR=P1^4;sbitLCD=P3^2;//RF//unsignedcharidataRFConf[11]={0x00,////0x6C,//CH_NO,433.2MHZ0x0E,//10db,0x44,//40x03,0x03,//30xE7,0xE7,0xE7,0xE7,//0xDE,//CRC16CRC16M};ucharTxRxBuffer[5];bitlcdbit;////////////////////////////voidDelay(uintx){uinti;for(i=0;ix;i++){_nop_();}}////////////SPINRF905//////////voidSpiWrite(unsignedcharb){unsignedchari=8;while(i--){Delay(10);SCK=0;MOSI=(bit)(b&0x80);b=1;Delay(10);SCK=1;Delay(10);SCK=0;}SCK=0;}///////////////from905readdata////////////////unsignedcharSpiRead(void){registerunsignedchari=8;unsignedcharddata=0;while(i--){ddata=1;SCK=0;_nop_();_nop_();ddata|=MISO;SCK=1;_nop_();_nop_();}SCK=0;returnddata;}////////////////////////////////voidRxPacket(void){uchari;i=0;while(DR){TxRxBuffer[i]=SpiRead();i++;}}/*;:20H;:21H;:22H;:23H;:24H*/voidTxPacket(void){TXEN=1;CSN=0;SpiWrite(0x22);//,4//SpiWrite(0xE7);SpiWrite(0xE7);SpiWrite(0xE7);SpiWrite(0xE7);CSN=1;_nop_();_nop_();CSN=0;SpiWrite(0x20);//,//SpiWrite(0x01);SpiWrite(0x02);SpiWrite(0x03);CSN=1;_nop_();_nop_();TRX_CE=1;////Delay(50);////TRX_CE=0;while(!DR);}///////////////////////////////////uchartemp;voidWait_Rec_Packet(void){TXEN=0;TRX_CE=1;while(1){if(DR){TRX_CE=0;//SPICSN=0;SpiWrite(0x24);RxPacket();CSN=1;temp=TxRxBuffer[0]+TxRxBuffer[1]+TxRxBuffer[2];if(temp==0x06){lcdbit=!lcdbit;LCD=lcdbit;//}break;}}}////////////////////////////voidIni_System(void){uchari;LCD=0;Delay(10000);LCD=1;lcdbit=1;CSN=1;SCK=0;PWR=1;TRX_CE=0;TXEN=0;_nop_();CSN=0;for(i=0;i11;i++){SpiWrite(RFConf[i]);}CSN=1;PWR=1;TRX_CE=1;TXEN=0;Delay(1000);}voidmain(void){uchari;Ini_System();PWR=0;while(1){Wait_Rec_Packet();////for(i=0;i2;i++)//Delay(65530);TxPacket();}}#includereg52.h#includeABSACC.h#includeintrins.h#includestdio.h#defineuintunsignedint#defineucharunsignedchar////sbitTXEN=P1^7;sbitTRX_CE=P1^6;sbitPWR=P1^5;//SPI//sbitMISO=P1^2;sbitMOSI=P1^3;sbitSCK=P1^1;sbitCSN=P1^0;sbitP2_0=P2^0;////sbitDR=P1^4;sbitLCD=P3^2;//RF//unsignedcharidataRFConf[11]={0x00,////0x6C,//CH_NO,433.2MHZ0x0E,//10db,0x44,//40x03,0x03,//30xE7,0xE7,0xE7,0xE7,//0xDE,//CRC16CRC16M};ucharTxRxBuffer[5];bitlcdbit;////////////////////////////voidDelay(uintx){uinti;for(i=0;ix;i++){_nop_();}}////////////SPINRF905//////////voidSpiWrite(unsignedcharb){unsignedchari=8;while(i--){Delay(10);SCK=0;MOSI=(bit)(b&0x80);b=1;Delay(10);SCK=1;Delay(10);SCK=0;}SCK=0;}///////////////from905readdata////////////////unsignedcharSpiRead(void){registerunsignedchari=8;unsignedcharddata=0;while(i--){ddata=1;SCK=0;_nop_();_nop_();ddata|=MISO;SCK=1;_nop_();_nop_();}SCK=0;returnddata;}////////////////////////////////voidRxPacket(void){uchari;i=0;while(DR){TxRxBuffer[i]=SpiRead();i++;}}/*;:20H;:21H;:22H;:23H;:24H*/voidTxPacket(void){TXEN=1;CSN=0;SpiWrite(0x22);//,4//SpiWrite(0xE7);SpiWrite(0xE7);SpiWrite(0xE7);SpiWrite(0xE7);CSN=1;_nop_();_nop_();CSN=0;SpiWrite(0x20);//,//SpiWrite(0x01);SpiWrite(0x02);SpiWrite(0x03);CSN=1;_nop_();_nop_();TRX_CE=1;////Delay(50);////TRX_CE=0;while(!DR);}///////////////////////////////////uchartemp;voidWait_Rec_Packet(void){TXEN=0;TRX_CE=1;while(1){if(DR){TRX_CE=0;//SPICSN=0;SpiWrite(0x24);RxPacket();CSN=1;temp=TxRxBuffer[0]+TxRxBuffer[1]+TxRxBuffer[2];if(temp==0x06){lcdbit=!lcdbit;LCD=lcdbit;//}break;}}}////////////////////////////voidIni_System(void){uchari;LCD=0;Delay(10000);LCD=1;lcdbit=1;CSN=1;SCK=0;PWR=1;TRX_CE=0;TXEN=0;_nop_();CSN=0;for(i=0;i11;i++){SpiWrite(RFConf[i]);}CSN=1;PWR=1;TRX_CE=1;TXEN=0;Delay(1000);}voidmain(void){uchari;Ini_System();PWR=0;while(1){Wait_Rec_Packet();////for(i=0;i2;i++)//Delay(65530);TxPacket();}}nrf905nrf905(10Byte)f=(422.4+CH_NO/10)*(1+HFREQ_PLL)MHz-------------------------------------------------------------------------------------------#defineRX_ADDRESS0x00000000//()#defineTX_ADDRESS0x02345678//()#defineCH_NO_FREQ_422_4MHz0x000//422.4MHz(433MHz)#defineCH_NO_FREQ_422_5MHz0x001//422.5MHz#defineCH_NO_FREQ_425_0MHz0x01a//425.0MHz#defineCH_NO_FREQ_427_5MHz0x033//427.5MHz#defineCH_NO_FREQ_
本文标题:nrf905短距离射频通讯模块中文资料
链接地址:https://www.777doc.com/doc-4294752 .html