software development for nRF24LE1

Hi

I have bought your nRF24LE1 development kit along with nRFgo starter kit.

I am using this kit for developing a wireless application. My project involves the following things

I need to convert analog signals to digital and transmit them to the receiver.

At the receiver the data is received and is sent to a serial port so that it can be connected to a computer to view the signals transmitted.

I have developed programs for the transmitter and the receiver using the SDK provided with the kit. But I dont know whether there is a transmission or not.

I am using the keil compiler for program development and nRFstudio for flashing the microcontroller.

I am attaching the codes I have written. Please take a look at them and tell me what is wrong with them.

this is the program for the transmitter side

#include <Nordic\reg24le1.h>

#include <stdint.h>

#include “hal_adc.h”

#include “hal_nrf.h”

#include “hal_nrf_hw.h”

code const uint8_t address[HAL_NRF_AW_5BYTES] = {0x22,0x33,0x44,0x55,0x01};

void radio_int(void);

void main()

{

uint8_t xdata rf_payload[1];

hal_adc_set_input_channel(HAL_ADC_INP_AIN1); //selecting channel 1

hal_adc_set_reference(HAL_ADC_REF_VDD); // reference VDD

// hal_adc_set_input_mode(HAL_ADC_DIFF_AIN2); // differential input

hal_adc_set_conversion_mode(HAL_ADC_CONTINOUS); //continuous conversion mode

hal_adc_set_sampling_rate(HAL_ADC_2KSPS); //sampling rate

hal_adc_set_acq_window(HAL_ADC_AQW_12US);//acquistion time

hal_adc_set_resolution(HAL_ADC_RES_8BIT); //resolution

hal_adc_set_data_just(HAL_ADC_JUST_RIGHT);//Justification

RFCKEN = 1;

RF = 1;

EA = 1;

CE_LOW();

while(1)

{

hal_adc_start();

while(hal_adc_busy());

rf_payload[0] = hal_adc_read_LSB();

//rf_payload[1] = hal_adc_read_LSB();

hal_nrf_write_tx_payload(rf_payload, 1);

CE_PULSE();

delay_10ms();

}

}

void radio_int(void)

{

hal_nrf_enable_ack_payload(true); // Enable dynamic ack

hal_nrf_enable_dynamic_payload(true); // Enable dynamic payload

hal_nrf_setup_dynamic_payload(0xFF); // All pipes uses dynamic ack.

hal_nrf_close_pipe(HAL_NRF_ALL); // First close all radio pipes

// Pipe 0 and 1 open by default

hal_nrf_open_pipe(HAL_NRF_PIPE0, true); // Open pipe0, with autoack

hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT); // Operates in 16bits CRC mode

hal_nrf_set_auto_retr(15, 250); // 250 µs delay, 15 retransmits

hal_nrf_set_address_width(HAL_NRF_AW_5BYTES); // 5 bytes address width

hal_nrf_set_address(HAL_NRF_TX, address); // Set device’s addresses

hal_nrf_set_address(HAL_NRF_PIPE0, address); // Pipe0 used for auto ACK

hal_nrf_set_operation_mode(HAL_NRF_PTX);

hal_nrf_set_power_mode(HAL_NRF_PWR_UP);

hal_nrf_set_output_power(HAL_NRF_0DBM);

hal_nrf_set_rf_channel(40);

hal_nrf_set_datarate(HAL_NRF_1MBPS);

}

void rf_irq() interrupt 0//INTERRUPT_RFIRQ

{

hal_nrf_get_clear_irq_flags();

}

program for the receiver

#include <Nordic\reg24le1.h>

#include <stdint.h>

#include “hal_nrf.h”

#include “hal_nrf_hw.h”

#include “hal_uart.h”

uint8_t rf_status;

uint8_t xdata rf_payload[1];

uint8_t temp_data;

bool hal_nrf_tx_complete(void);

code const uint8_t address[HAL_NRF_AW_5BYTES] = {0x22,0x33,0x44,0x55,0x01};

void main()

{

RFCKEN = 1;

RF = 1;

EA = 1;

hal_uart_init(UART_BAUD_9K6);

CE_LOW(); // Disable radio

hal_nrf_enable_ack_payload(true); // Enable dynamic ack

hal_nrf_enable_dynamic_payload(true); // Enable dynamic payload

hal_nrf_setup_dynamic_payload(0xFF); // All pipes uses dynamic ack.

hal_nrf_close_pipe(HAL_NRF_ALL); // First close all radio pipes

// Pipe 0 and 1 open by default

hal_nrf_open_pipe(HAL_NRF_PIPE0, true); // Open pipe0, with autoack

hal_nrf_set_crc_mode(HAL_NRF_CRC_16BIT); // Operates in 16bits CRC mode

hal_nrf_set_auto_retr(15, 250); // 250 µs delay, 15 retransmits

hal_nrf_set_address_width(HAL_NRF_AW_5BYTES); // 5 bytes address width

hal_nrf_set_address(HAL_NRF_TX, address); // Set device’s addresses

hal_nrf_set_address(HAL_NRF_PIPE0, address); // Pipe0 used for auto ACK

hal_nrf_set_operation_mode(HAL_NRF_PRX);

hal_nrf_set_datarate(HAL_NRF_1MBPS);

hal_nrf_set_rf_channel(40);

hal_nrf_set_power_mode(HAL_NRF_PWR_UP);

hal_nrf_set_rx_payload_width(HAL_NRF_PIPE0, 1);

RFCE = 1;

while(1)

{

}

}

void rf_irq() interrupt 2

{

rf_status = hal_nrf_get_clear_irq_flags();

switch( rf_status )

{

case (1<<HAL_NRF_RX_DR):

hal_nrf_read_rx_payload(rf_payload);

temp_data = rf_payload[0];

P0DIR = 0xDF;

hal_uart_putchar(temp_data);

if(hal_nrf_tx_complete())

{

TI0 = 0;

}

break;

case (1<<HAL_NRF_TX_DS):

break;

case (1<<HAL_NRF_MAX_RT):

break;

}

}