大家可以参考啊!
单片机源程序如下:
- #include "yxl_51\\yxl.h"
- #include "yxl_51\\uart.h"//测试部分
- #include "yxl_51\\io_spi.h"
- #include "yxl_51\\nrf24l01.h"
- #include "yxl_51\\delay.h"
- void delay500ms(void) //误差 0us
- {
- unsigned char a,b,c;
- for(c=205;c>0;c--)
- for(b=116;b>0;b--)
- for(a=9;a>0;a--);
- }
- void main(void)
- {
- InitUART();//测试部分
- NRF24L01_Init() ;
- printf("%s\n","chushihua OK.");//测试部分
- LED_fasong=1;LED_jieshou=1;//熄灭两个指示灯
- TxBuf[0]=0;TxBuf[1]=1;TxBuf[2]=2;
- while(NRF24L01_Check())
- {
- printf("NRF24L01 Error\r\n");
- delay500ms();
- }
- printf("NRF24L01 OK\r\n");
- NRF24L01_TX_Mode();
- while(1)
- {
- TxBuf[0]++;
- LED_fasong=1;
- while(NRF24L01_TxPacket(TxBuf)!=TX_OK)
- {
-
- }
- LED_fasong=0;
- printf("NRF24L01 TX OK\r\n");
- }
- }
复制代码
所有资料51hei提供下载:
nrf24l01_89C52RC 查询收发.rar
(164.11 KB, 下载次数: 19)
|