初级会员
- 积分
- 58
- 金钱
- 58
- 注册时间
- 2015-4-16
- 在线时间
- 2 小时
|
5金钱
下面是甲乙两个模块用通道2接收,甲模块作为主机发送的话,数据一直处于发送状态,而乙模块却接收不到数据<br />
而用通道0接收的话,收发都很正常,请问大神们怎么设置<br />
<br />
<br />
<br />
<br />
<br />
<br />
甲模块<br />
发送地址<br />
const u8 TX_ADDRESS[TX_ADR_WIDTH]={0x34,0x43,0x10,0x10,0x01}; //·??????·<br />
const u8 RX_ADDRESS0[RX_ADR_WIDTH]={0x34,0x43,0x10,0x10,0x01}; //·??????·<br />
const u8 RX_ADDRESS1[RX_ADR_WIDTH]={'1'};<br />
const u8 RX_ADDRESS2[RX_ADR_WIDTH]={'2'};<br />
const u8 RX_ADDRESS3[RX_ADR_WIDTH]={'3'};<br />
const u8 RX_ADDRESS4[RX_ADR_WIDTH]={'4'};<br />
const u8 RX_ADDRESS5[RX_ADR_WIDTH]={'5'};<br />
<br />
<br />
<br />
void NRF24L01_TX_Mode(void)<br />
{ <br />
NRF24L01_CE=0; <br />
NRF24L01_Write_Buf(WRITE_REG_NRF+TX_ADDR,(u8*)TX_ADDRESS,TX_ADR_WIDTH);<br />
NRF24L01_Write_Buf(WRITE_REG_NRF+RX_ADDR_P2,(u8*)RX_ADDRESS2,RX_ADR_WIDTH);<br />
<br />
<br />
NRF24L01_Write_Reg(WRITE_REG_NRF+EN_AA,0x04); <br />
NRF24L01_Write_Reg(WRITE_REG_NRF+EN_RXADDR,0x04);<br />
NRF24L01_Write_Reg(WRITE_REG_NRF+SETUP_RETR,0x1a);<br />
NRF24L01_Write_Reg(WRITE_REG_NRF+RF_CH,40); <br />
NRF24L01_Write_Reg(WRITE_REG_NRF+RF_SETUP,0x0f); <br />
NRF24L01_Write_Reg(WRITE_REG_NRF+CONFIG,0x0e); <br />
NRF24L01_CE=1;<br />
} <br />
<br />
<br />
void NRF24L01_RX_Mode(void)<br />
{<br />
NRF24L01_CE=0; <br />
NRF24L01_Write_Buf(WRITE_REG_NRF+RX_ADDR_P2,(u8*)RX_ADDRESS2,RX_ADR_WIDTH);<br />
<br />
NRF24L01_Write_Reg(WRITE_REG_NRF+EN_AA,0x04); <br />
NRF24L01_Write_Reg(WRITE_REG_NRF+EN_RXADDR,0x04);<br />
NRF24L01_Write_Reg(WRITE_REG_NRF+RF_CH,40); <br />
NRF24L01_Write_Reg(WRITE_REG_NRF+RX_PW_P2,RX_PLOAD_WIDTH);<br />
<br />
<br />
NRF24L01_Write_Reg(WRITE_REG_NRF+RF_SETUP,0x0f);<br />
NRF24L01_Write_Reg(WRITE_REG_NRF+CONFIG, 0x0f);<br />
NRF24L01_CE = 1; <br />
} <br />
<br />
<br />
<br />
<br />
<br />
乙模块<br />
<br />
<span style="line-height:23.3333339691162px;">const u8 TX_ADDRESS[TX_ADR_WIDTH]={0x34,0x43,0x10,0x10,0x01}; //·??????·</span><br />
<span style="line-height:23.3333339691162px;">const u8 RX_ADDRESS0[RX_ADR_WIDTH]={0x34,0x43,0x10,0x10,0x01}; //·??????·</span><br />
<span style="line-height:23.3333339691162px;">const u8 RX_ADDRESS1[RX_ADR_WIDTH]={'1'};</span><br />
<span style="line-height:23.3333339691162px;">const u8 RX_ADDRESS2[RX_ADR_WIDTH]={'2'};</span><br />
<span style="line-height:23.3333339691162px;">const u8 RX_ADDRESS3[RX_ADR_WIDTH]={'3'};</span><br />
<span style="line-height:23.3333339691162px;">const u8 RX_ADDRESS4[RX_ADR_WIDTH]={'4'};</span><br />
<span style="line-height:23.3333339691162px;">const u8 RX_ADDRESS5[RX_ADR_WIDTH]={'5'};</span><br />
<span style="line-height:23.3333339691162px;"></span><br />
<span style="line-height:23.3333339691162px;"></span><br />
<span style="line-height:23.3333339691162px;"></span><br />
<span style="line-height:23.3333339691162px;">void NRF24L01_TX_Mode(void)</span><br />
<span style="line-height:23.3333339691162px;">{ </span><br />
<span style="line-height:23.3333339691162px;">NRF24L01_CE=0; </span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Buf(WRITE_REG_NRF+TX_ADDR,(u8*)TX_ADDRESS,TX_ADR_WIDTH);</span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Buf(WRITE_REG_NRF+RX_ADDR_P2,(u8*)RX_ADDRESS2,RX_ADR_WIDTH);</span><br />
<span style="line-height:23.3333339691162px;"> </span><br />
<br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Reg(WRITE_REG_NRF+EN_AA,0x04); </span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Reg(WRITE_REG_NRF+EN_RXADDR,0x04);</span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Reg(WRITE_REG_NRF+SETUP_RETR,0x1a);</span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Reg(WRITE_REG_NRF+RF_CH,40); </span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Reg(WRITE_REG_NRF+RF_SETUP,0x0f); </span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Reg(WRITE_REG_NRF+CONFIG,0x0e); </span><br />
<span style="line-height:23.3333339691162px;">NRF24L01_CE=1;</span><br />
<span style="line-height:23.3333339691162px;">} </span><br />
<span style="line-height:23.3333339691162px;"></span><br />
<span style="line-height:23.3333339691162px;"></span><br />
<span style="line-height:23.3333339691162px;"></span><span style="line-height:23.3333339691162px;">void NRF24L01_RX_Mode(void)</span><br />
<span style="line-height:23.3333339691162px;">{</span><br />
<span style="line-height:23.3333339691162px;">NRF24L01_CE=0; </span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Buf(WRITE_REG_NRF+RX_ADDR_P2,(u8*)RX_ADDRESS2,RX_ADR_WIDTH);</span><br />
<span style="line-height:23.3333339691162px;"> </span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Reg(WRITE_REG_NRF+EN_AA,0x04); </span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Reg(WRITE_REG_NRF+EN_RXADDR,0x04);</span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Reg(WRITE_REG_NRF+RF_CH,40); </span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Reg(WRITE_REG_NRF+RX_PW_P2,RX_PLOAD_WIDTH);</span><br />
<br />
<br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Reg(WRITE_REG_NRF+RF_SETUP,0x0f);</span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_Write_Reg(WRITE_REG_NRF+CONFIG, 0x0f);</span><br />
<span style="line-height:23.3333339691162px;"> NRF24L01_CE = 1; </span><br />
<span style="line-height:23.3333339691162px;">} </span><br />
<span style="line-height:23.3333339691162px;"></span><br />
<br /> |
最佳答案
查看完整内容[请看2#楼]
这个帖子讲的比较详细,与大家分享一下。
http://wenku.baidu.com/link?url=iAVQjFeFTKJ0OFEmf9QIJwhPRtvTXU8Mtl41L0-HzKuVnE8gt64kaYO3EboxxjpT1s8BySTDeHJL3iQLKQAYnrkEfPJ8Jv3xGStPcIhDVvC
|