找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1637|回复: 1
打印 上一主题 下一主题
收起左侧

刚调通的nrf24l01_89C52RC查询收发源码

[复制链接]
跳转到指定楼层
楼主
大家可以参考啊!

单片机源程序如下:
  1. #include "yxl_51\\yxl.h"
  2. #include "yxl_51\\uart.h"//测试部分
  3. #include "yxl_51\\io_spi.h"
  4. #include "yxl_51\\nrf24l01.h"
  5. #include "yxl_51\\delay.h"

  6. void delay500ms(void)   //误差 0us
  7. {
  8.     unsigned char a,b,c;
  9.     for(c=205;c>0;c--)
  10.         for(b=116;b>0;b--)
  11.             for(a=9;a>0;a--);
  12. }


  13. void main(void)
  14. {
  15.         InitUART();//测试部分
  16.      NRF24L01_Init() ;                                                        
  17.         printf("%s\n","chushihua OK.");//测试部分
  18.         LED_fasong=1;LED_jieshou=1;//熄灭两个指示灯        
  19.         TxBuf[0]=0;TxBuf[1]=1;TxBuf[2]=2;
  20.         while(NRF24L01_Check())
  21.         {
  22.                 printf("NRF24L01 Error\r\n");
  23.                  delay500ms();
  24.         }
  25.      printf("NRF24L01 OK\r\n");
  26.      NRF24L01_TX_Mode();
  27.         while(1)
  28.         {        
  29.                 TxBuf[0]++;
  30.           LED_fasong=1;
  31.                 while(NRF24L01_TxPacket(TxBuf)!=TX_OK)
  32.           {
  33.                
  34.           }
  35.           LED_fasong=0;
  36.           printf("NRF24L01 TX OK\r\n");               
  37.         }        
  38. }
复制代码

所有资料51hei提供下载:
nrf24l01_89C52RC 查询收发.rar (164.11 KB, 下载次数: 19)


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:51142 发表于 2018-8-28 00:02 | 只看该作者
顶!好贴,学习了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表