![Emakefun RF-NANO Скачать руководство пользователя страница 21](http://html1.mh-extra.com/html/emakefun/rf-nano/rf-nano_operating-instructions-manual_2398917021.webp)
Copy right © 2018 Shenzhen Emakefun Technology co., Ltd.
21
3
、
Arduino configures the CE to be high for at least 10 μs and transmits data after a delay of 130 μs. If the
auto answer is on, the nRF24L01 enters the receive mode immediately after transmitting the data and
receives the answer signal. If a reply is received, the communication is considered successful.
4
、
NRF24L01 will automatically set TX_DS high and the TX_PLD will be cleared from the transmit stack.
If no response is received, the data will be automatically retransmitted. If the number of retransmissions
(ARC_CNT) reaches the upper limit, MAX_RT is set high and TX_PLD will not be cleared; MAX_RT
When TX_DS is set high, IRQ goes low to trigger MCU interrupt. When the last transmission is successful,
if the CE is low, the nRF24L01 will enter standby mode.
5
、
If there is data in the transmission stack and CE is high, the next transmission is started; if there is no data
in the transmission stack and CE is high, the nRF24L01 will enter standby mode 2.
Receive data process
1、
When the nRF24L01 receives data, please configure the nRF24L01 to receive mode firstly.
2
、
Then delay 130μs into the receiving state to wait for the arrival of data. When the receiver detects a valid
address and CRC, it stores the data packet in the receiver stack. At the same time, the interrupt sign RX_DR
is set high and the IRQ goes low to notify the MCU to fetch the data.
3
、
If auto-response is turned on at this time, the receiver will enter the transmit status echo response signal at
the same time. When the last reception is successful, if CE goes low, the nRF24L01 will go into idle mode
1.
3.1.3 Program code
Transmission data program code:
:
Code path
:
RF-NANO Demo Program\Peer-to-peer Communication\Emitter\Emitter.ino
Code source
//Transmitter program
#include <SPI.h>
#include "Mirf.h"
#include "nRF24L01.h"
#include "MirfHardwareSpiDriver.h"
Nrf24l Mirf
=
Nrf24l
(
10
,
9
);
int
value
;
String vas
;
void
setup
()
{
Serial
.
begin
(
9600
);