中级会员
- 积分
- 303
- 金钱
- 303
- 注册时间
- 2012-12-19
- 在线时间
- 16 小时
|
发表于 2013-12-11 19:54:53
|
显示全部楼层
<div>void send_data(void)</div>
<div> { </div>
<div> power_off(); </div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>NRFWriteReg(WRITE_REG + EN_AA, 0x01); // Enable Auto.Ackipe0</div>
<div> <span class="Apple-tab-span" style="white-space:pre;"> </span>NRFWriteReg(WRITE_REG + EN_RXADDR, 0x01); // Enable Pipe0</div>
<div> <span class="Apple-tab-span" style="white-space:pre;"> </span>NRFWriteReg(WRITE_REG + SETUP_RETR, 0x1a); // 500us + 86us, 10 retrans...</div>
<div> <span class="Apple-tab-span" style="white-space:pre;"> </span>NRFWriteReg(WRITE_REG + RF_CH, 1); // Select RF channel 40 /////pSysPara->Mod[11] /////设置信道<span class="Apple-tab-span" style="white-space:pre;"> </span></div>
<div> <span class="Apple-tab-span" style="white-space:pre;"> </span>NRFWriteReg(WRITE_REG + RF_SETUP, 0x27); // TX_PWR:0dBm, Datarate:2Mbps, LNA:HCURR</div>
<div> <span class="Apple-tab-span" style="white-space:pre;"> </span>NRFWriteReg(WRITE_REG + CONFIG, 0x0e); // Set PWR_UP bit, enable CRC(2 bytes) & Prim:TX. MAX_RT & TX_DS enabled.. </div>
<div> <span class="Apple-tab-span" style="white-space:pre;"> </span>NRFWrite_Buf(WRITE_REG + TX_ADDR, Rx_Addr0, RX_ADDR_WITDH); // Writes TX_Address to nRF24L01</div>
<div> <span class="Apple-tab-span" style="white-space:pre;"> </span>NRFWrite_Buf(WRITE_REG + RX_ADDR_P0, Rx_Addr0, RX_ADDR_WITDH); // RX_Addr0 same as TX_Adr for Auto.Ack</div>
<div> <span class="Apple-tab-span" style="white-space:pre;"> </span>NRFWrite_Buf(WR_TX_PLOAD, TxDate0, TX_DATA_WITDH); // Writes data to TX payload</div>
<div> NRFWriteReg(WRITE_REG+STATUS,0xff); // 清除TX_DS或MAX_RT中断标志</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>SPICE=1; </div>
<div> }</div> |
|