SetRX_Mode();
if(nRF24L01_RxPacket(RxBuf))
{LED1 = 0;
if(RxBuf[1] == 1)
{
Delay(1000);
}LED2 = 0;Delay(1000);
if(RxBuf[2] == 1)
{
}
}
这是
接受段的程序,为什么接收端不管安不安装nrf2401总是跳进if(nRF24L01_RxPacket(RxBuf)),
unsigned char nRF24L01_RxPacket(unsigned char* rx_buf)
{
unsigned char revale=0;
//SetRX_Mode();
sta=SPI_Read(STATUS); // read register STATUS's value
if(RX_DR) // if receive data ready (RX_DR) interrupt
{
CE = 0;
SPI_Read_Buf(RD_RX_PLOAD,rx_buf,TX_PLOAD_WIDTH);// read receive payload from RX_FIFO buffer
revale =1;//we have receive data
}
SPI_RW_Reg(WRITE_REG+STATUS,sta);// clear RX_DR or TX_DS or MAX_RT interrupt flag
return revale;
}