新手上路
- 积分
- 48
- 金钱
- 48
- 注册时间
- 2014-12-22
- 在线时间
- 0 小时
|
楼主 |
发表于 2015-7-28 20:35:22
|
显示全部楼层
问题已解决,我使用的NRF24L01给6个通道设置地址时,0和1 可以设置5位,而2345只能设置其最低位,其他位锁定为和1通到的相同,并且我使用这个无线2345通到地址的高32位不能设置,其他的nrf24l01可能可以设置,不过要和1通到的高32位相同
<br>代码如下
<br>const uchar RX_ADDRESS0[RX_ADR_WIDTH]={0x00,0x10,0x10,0x34,0x43}; //接收通道地址
<br>const uchar RX_ADDRESS1[RX_ADR_WIDTH]={0x01,0x10,0x10,0x34,0x43};
<br>const uchar RX_ADDRESS2[1]={0x02};
<br>const uchar RX_ADDRESS3[1]={0x03};
<br>const uchar RX_ADDRESS4[1]={0x04};
<br>const uchar RX_ADDRESS5[1]={0x05};
<br>
<br>
<br>一下是初始化时对各通道地址的设置
<br>
<br>
<br> SPI_W_DBuffer(WRITE_REG+RX_ADDR_P0,(uchar*)RX_ADDRESS0,RX_ADR_WIDTH); //为了接收设备应答信号,接收通道0地址与发送地址相同
<br> SPI_R_DBuffer(0x0a,RX_A[0],5);//读取设置地址
<br> SPI_W_DBuffer(WRITE_REG+RX_ADDR_P1,(uchar*)RX_ADDRESS1,RX_ADR_WIDTH);//1
<br> SPI_R_DBuffer(0x0b,RX_A[1],5);
<br> SPI_W_DBuffer(WRITE_REG+RX_ADDR_P2,(uchar*)RX_ADDRESS2,1);//2
<br> SPI_R_DBuffer(0x0c,RX_A[2],5);
<br> SPI_W_DBuffer(WRITE_REG+RX_ADDR_P3,(uchar*)RX_ADDRESS3,1);//3
<br> SPI_R_DBuffer(0x0d,RX_A[3],5);
<br> SPI_W_DBuffer(WRITE_REG+RX_ADDR_P4,(uchar*)RX_ADDRESS4,1);//4
<br> SPI_R_DBuffer(0x0e,RX_A[4],5);
<br> SPI_W_DBuffer(WRITE_REG+RX_ADDR_P5,(uchar*)RX_ADDRESS5,1);//5
<br> SPI_R_DBuffer(0x0f,RX_A[5],5); |
|