完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
|
相关推荐
8个回答
|
|
一个设置发送模式,其他都设置为接受模式,就可以实现一发多收
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
每个接收的无线模块设置为不同的频道,发送端要给哪个接收端发送时在主函数更改对应频道就可以,也可以设置为不同的地址
参考文档 http://www.rationmcu.com/elecjc/1592.html?from=singlemessage&isappinstalled=0#10006-weixin-1-52626-6b3bffd01fdde4900130bc5a2751b6d1 |
|
|
|
如何设置其他通道的收发,我使用0通道可以接收数据,但是用其他通道就接收不到数据,而且发送端也一直显示状态是发送数据。 发射端 const u8 TX_ADDRESS[TX_ADR_WIDTH]={0x34,0x43,0x10,0x10,0x01}; const u8 RX_ADDRESS0[RX_ADR_WIDTH]={0x34,0x43,0x10,0x10,0x01}; const u8 RX_ADDRESS1[RX_ADR_WIDTH]={'1',0x43,0x10,0x10,0x01}; const u8 RX_ADDRESS2[RX_ADR_WIDTH]={'2',0x43,0x10,0x10,0x01}; const u8 RX_ADDRESS3[RX_ADR_WIDTH]={'3',0x43,0x10,0x10,0x01}; const u8 RX_ADDRESS4[RX_ADR_WIDTH]={'4',0x43,0x10,0x10,0x01}; const u8 RX_ADDRESS5[RX_ADR_WIDTH]={'5',0x43,0x10,0x10,0x01}; void NRF24L01_TX_Mode(void) { NRF24L01_CE=0; NRF24L01_Write_Buf(WRITE_REG_NRF+TX_ADDR,(u8*)TX_ADDRESS,TX_ADR_WIDTH); NRF24L01_Write_Buf(WRITE_REG_NRF+RX_ADDR_P0,(u8*)RX_ADDRESS0,RX_ADR_WIDTH); NRF24L01_Write_Buf(WRITE_REG_NRF+RX_ADDR_P1,(u8*)RX_ADDRESS1,RX_ADR_WIDTH);//这一步有没有必要,是不是直接使能通道 的接收地址就可以了 NRF24L01_Write_Reg(WRITE_REG_NRF+EN_AA,0x02); //使能通道1的应答模式;如果将0x02设置为0x03 ,使能通道0、1的应答模式 NRF24L01_Write_Reg(WRITE_REG_NRF+EN_RXADDR,0x02);// 使能通道1的接收地址;如果将0x02设置为0x03 ,使能通道0、1的接收地址。 NRF24L01_Write_Reg(WRITE_REG_NRF+SETUP_RETR,0x1a); NRF24L01_Write_Reg(WRITE_REG_NRF+RF_CH,50); NRF24L01_Write_Reg(WRITE_REG_NRF+RF_SETUP,0x0f); NRF24L01_Write_Reg(WRITE_REG_NRF+CONFIG,0x0e); NRF24L01_CE=1; } 接收端 const u8 TX_ADDRESS[TX_ADR_WIDTH]={0x34,0x43,0x10,0x10,0x01}; const u8 RX_ADDRESS0[RX_ADR_WIDTH]={0x34,0x43,0x10,0x10,0x01}; const u8 RX_ADDRESS1[RX_ADR_WIDTH]={'1',0x43,0x10,0x10,0x01}; const u8 RX_ADDRESS2[RX_ADR_WIDTH]={'2',0x43,0x10,0x10,0x01}; const u8 RX_ADDRESS3[RX_ADR_WIDTH]={'3',0x43,0x10,0x10,0x01}; const u8 RX_ADDRESS4[RX_ADR_WIDTH]={'4',0x43,0x10,0x10,0x01}; const u8 RX_ADDRESS5[RX_ADR_WIDTH]={'5',0x43,0x10,0x10,0x01}; void NRF24L01_RX_Mode(void) { NRF24L01_CE=0; NRF24L01_Write_Buf(WRITE_REG_NRF+TX_ADDR,(u8*)TX_ADDRESS,TX_ADR_WIDTH); NRF24L01_Write_Buf(WRITE_REG_NRF+RX_ADDR_P0,(u8*)RX_ADDRESS0,RX_ADR_WIDTH); NRF24L01_Write_Buf(WRITE_REG_NRF+RX_ADDR_P1,(u8*)RX_ADDRESS1,RX_ADR_WIDTH); NRF24L01_Write_Buf(WRITE_REG_NRF+RX_ADDR_P2,(u8*)RX_ADDRESS2,RX_ADR_WIDTH); NRF24L01_Write_Buf(WRITE_REG_NRF+RX_ADDR_P3,(u8*)RX_ADDRESS3,RX_ADR_WIDTH); NRF24L01_Write_Buf(WRITE_REG_NRF+RX_ADDR_P4,(u8*)RX_ADDRESS4,RX_ADR_WIDTH); NRF24L01_Write_Buf(WRITE_REG_NRF+RX_ADDR_P5,(u8*)RX_ADDRESS5,RX_ADR_WIDTH); NRF24L01_Write_Reg(WRITE_REG_NRF+EN_AA,0x3f); NRF24L01_Write_Reg(WRITE_REG_NRF+EN_RXADDR,0x3f); NRF24L01_Write_Reg(WRITE_REG_NRF+RF_CH,50); NRF24L01_Write_Reg(WRITE_REG_NRF+RX_PW_P0,RX_PLOAD_WIDTH); NRF24L01_Write_Reg(WRITE_REG_NRF+RX_PW_P1,RX_PLOAD_WIDTH); NRF24L01_Write_Reg(WRITE_REG_NRF+RX_PW_P2,RX_PLOAD_WIDTH); NRF24L01_Write_Reg(WRITE_REG_NRF+RX_PW_P3,RX_PLOAD_WIDTH); NRF24L01_Write_Reg(WRITE_REG_NRF+RX_PW_P4,RX_PLOAD_WIDTH); NRF24L01_Write_Reg(WRITE_REG_NRF+RX_PW_P5,RX_PLOAD_WIDTH); NRF24L01_Write_Reg(WRITE_REG_NRF+RF_SETUP,0x0f); NRF24L01_Write_Reg(WRITE_REG_NRF+CONFIG, 0x0f); NRF24L01_CE = 1; } 有许多问题 1.为什么在发送函数中使用通道0(0x01),接收端就可以接收数据,而使用通道1(0x02)却不可以? 2.当将使能通道的应答模式和使能通道的接收地址中的0x02设置0x03,接收端又可以接收数据,其实应该还是通道0接收的数据 3.当接收端接收不到数据时,为什么发送端接收到应答,显示发送数据而不是发送失败, |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
如何使用STM32+nrf24l01架构把有线USB设备无线化?
2448 浏览 7 评论
请问能利用51单片机和nRF24L01模块实现实时语音无线传输吗?
2222 浏览 5 评论
2987 浏览 3 评论
2673 浏览 8 评论
为什么ucosii上移植lwip后系统进入了HardFault_Handler?
2642 浏览 4 评论
请教各位大咖:有没有接收频率32M左右的芯片推荐的?先感谢啦!
426浏览 1评论
688浏览 0评论
764浏览 0评论
474浏览 0评论
282浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-8-26 18:18 , Processed in 1.445069 second(s), Total 91, Slave 74 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191