Professional Documents
Culture Documents
In The Receiver Module
In The Receiver Module
the problem which i am facing is that I am always getting MAX_RT interrupt at the
transmitter side and no successful transmission or reception.
Thanks in advance.
Pls check the Tx and Rx functions have made some changes. but the results are still same (no
reception)
these are 2 separate programs loaded on two different AT89S52 controllers. I intend to
program 1 device only as a transmitter and another only as a receiver.
These functions are supported by spi functions and other functions which complete the code.
I have checked the spi communication. I have successfully read the data which i had written
to the registers. So, there is no problem in the spi functions.
void TX_Mode()//transmitter function
{
unsigned char ch;
unsigned int i=0;
clear_interrupts();
Write_spi(WRITE_REG+RX_PW_P0,0); //setting payload width initially
to 0
delay_ms(100);
ce=0; //making CE low for writing the values to registers
delay_ms(1);
/************************************************************/
set_reg_bit(CONFIG,3); //enable CRC (setting bit 3 of config
register)
set_reg_bit(CONFIG,2); //2 byte CRC (setting bit 2 of config
register)
clear_reg_bit(CONFIG,0); //TX MODE (clearing bit 0 of config
register)
/************************************************************/
cs=0;
write(FLUSH_TX);
cs=1;
// clear_interrupts();
/* ch=Read_spi(FIFO_STATUS,1);
Serial_print("\r\nvalue of fifo status reg ");
conversion(ch);
clear_interrupts(); */
//delay_ms(10);
ce=1; //making ce high for transmission
// delay_Us(40); //for 1mbps
delay_Us(250); //for 250kbps
ce=0; //making ce low
delay_ms(50); //for 250kbps
// delay_ms(40); // for 1mbps
// clear_interrupts();
/* ch=Read_spi(FIFO_STATUS,1);
Serial_print("\r\nvalue of fifo status reg ");
conversion(ch);
void RX_Mode(void)
{
ce=0;
clear_interrupts();
Write_spi(WRITE_REG+RX_PW_P0,0);
Write_spi(WRITE_REG+CONFIG,0X02);//power up
Write_spi(WRITE_REG+SETUP_AW,0X03);
Write_spi(WRITE_REG+SETUP_RETR,0X00);
Write_spi_buffer(WRITE_REG + RX_ADDR_P0, TX_ADDRESS,
TX_ADR_LENGTH); // Used the same address on the RX device as the TX device
/************************************************************/
/************************************************************/
delay_ms(1);
cs=0;
write(FLUSH_TX); //CLEARING FIFO'S (TX AND RX FIFO
RESPECTIVELY)
cs=1;
delay_ms(10);
cs=0;
write(FLUSH_RX);
cs=1;
delay_ms(1000);
ce = 1; // Set CE pin high to enable RX device
delay_ms(100);
}