Looking in eBay I found the nRF24L01+ in three different modules. I bought the smd module, but for testing is better the module with pin header.
Description of library.
Initializes the nRF24L01 module.
NRF24L01_Init(mode, rf_channel)
- mode: Sets RX_MODE or TX_MODE.
- rf_channel: Sets the channel to be used.
Example:
NRF24L01_Init(TX_MODE, 0x20);
Sends a data from Transmitter to Receiver.
NRF24L01_SendData(buffer)
- buffer: Data to be sent.
Example:
unsigned char data[32] = {'P', 'I', 'C', '1', '8', 'F', '4', '5', '5', '0'};
NRF24L01_SendData(data);
Reads the interrupt.
NRF24L01_DataReady(void)
This function reads the STATUS and returns a 0 logic if the receiver got a new data.
- return 0: When is available a data.
- return 1: When isn't available a data.
Example:
while(NRF24L01_DataReady()){}
Reads a data received from transmitter.
NRF24L01_ReadData(buffer)
- buffer: Saves the data received.
Example:
unsigned char buffer1[32];
while(NRF24L01_DataReady()){}
NRF24L01_ReadData(buffer1);
Sets the nRF24L01 as RX or TX mode.
NRF24L01_SetMode(mode)
NRF24L01_SetMode( RX_MODE);
while(NRF24L01_DataReady()){}
NRF24L01_ReadData(buffer1);
Sets the nRF24L01 as RX or TX mode.
NRF24L01_SetMode(mode)
- mode: Sets RX_MODE or TX_MODE.
NRF24L01_SetMode( RX_MODE);
Sets a channel.
NRF24L01_SetChannel(rf_channel)
NRF24L01_SetChannel(0x45);
Gets the channel used.
NRF24L01_GetChannel(void)
unsigned char channel;
channel = NRF24L01_GetChannel();
Example 1. Simplex communication.
NRF24L01_SetChannel(rf_channel)
- rf_channel: Sets a new channel.
NRF24L01_SetChannel(0x45);
Gets the channel used.
NRF24L01_GetChannel(void)
- return the channel used.
unsigned char channel;
channel = NRF24L01_GetChannel();
Example 1. Simplex communication.
This
video shows a system simplex, where the transmitter sends a byte to
receiver. The receiver gets the byte and set the value binary at the
PORTB.
I am creating a STM32 code based on that code, i notice the Config register has 2 value.. Inicially the valu 0X0A is wroted, then into the NRF24L01_SetMode overwrite with the value 0X0E.
ReplyDeletevoid NRF24L01_Init(unsigned char mode, unsigned char rf_channel){
GPIO_WriteBit(GPIOC,ce,Bit_RESET);
GPIO_WriteBit(GPIOA,nss,Bit_SET);
Delay_ms(100);
NRF24L01_WriteRegister(CONFIG, 0x0A);
hi i have an one doubt. same code will be working on nrf24lo1+pa+lna module. i will try for nrf24l01+pa+lna module interfacing pic16f877a controller.. but it was not working.
ReplyDeleteanyone is working in nrf24l01+pa+lna pls give us to suggestion
ReplyDeletethanks by Aravinth