I basically want to receive a arbitrary string of approximately 80 characters through usart of microcontroller, but I could not succeed accordingly.Pseudo code for my project is as below
#include<avr/io.h>
#include<util/delay.h>
unsigned char USART_receive();//function to receive single character at a time from USART
char *rcv_buffer; //string to be received into pointer
char count=0;
void main()
{
count=0;
while(1)
{
do
{
*rcv_buffer=USART_receive();
rcv_buffer++;
count++;
} while(count<80);
count=0;
printf(rcv_buffer);
OR
any output console such as lcd
lcd_putstring(rcv_buffer);
_delay_ms(5000);
erase_bufffer(rcv_buffer); // to erase the string or refresh it for next time
}
}
The string data gets corrupted which is shown on the console.
What is main issue or problem persisting???