欢迎来到天天文库
浏览记录
ID:40725866
大小:18.26 KB
页数:6页
时间:2019-08-06
《基于NRF905模块源程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、#include#include#include#include//----------------------------------------------------------------------------------------------------------------#defineuintunsignedint#defineucharunsignedchar//-------------------------------------------------------
2、---------------------------------------------------------#defineBYTE_BIT00x01#defineBYTE_BIT70x80//----------------------------------------------------------------------------------------------------------------bdataunsignedcharDATA_BUF;#defineDATA7((DATA_BUF&BYTE_BIT7)!=0)#defineDATA0((
3、DATA_BUF&BYTE_BIT0)!=0)sbitflag=DATA_BUF^7;sbitflag1=DATA_BUF^0;//---------------------------------------------------发送数据缓冲区-------------------------------------------------#defineTxRxBuf_Len4unsignedcharTxRxBuf[TxRxBuf_Len]={0x29,0x30,0x31,0x32,};codeTxAddress[4]={0xcc,0xcc,0xcc,0xcc};c
4、hartf;//----------------------------------------NRF905工作模式控制端口------------------------------------------------------sbitTXEN=P1^4;sbitTRX_CE=P3^2;sbitPWR=P1^3;//----------------------------------------LED显示端口---------------------------------------------------sbitLED=P3^5;//--------------
5、--------------------------NRF905数据交换端口---------------------------------------------------sbitMISO=P1^6;sbitMOSI=P1^1;sbitSCK=P1^5;sbitCSN=P1^0;//----------------------------------------nrf905状态端口---------------------------------------------------------sbitAM=P1^7;sbitDR=P3^3;sbitCD=P1^2;
6、//---------------------------------------------------------------------------------------------------------------//----------------------------------------按键端口-------------------------------------------------------sbitKEY=P3^4;//----------------------------------------nrf905控制指令---------
7、----------------------------------#defineWC0x00#defineRC0x10#defineWTP0x20#defineRTP0x21#defineWTA0x22#defineRTA0x23#defineRRP0x24//------------------------------------------------NRF905寄存器配置------------------------------------------------unsignedcharidataRFConf[11]={0x00
此文档下载收益归作者所有