can anyone show some example code or link that help me to solve this problem. I want to receive and transmit a string using a terminal.
till now, I only got this -->
void usart_init(void)
{
UBRRH = 0x00;
UBRRL = 95;
UCSRB = (1 << RXEN) | (1 << TXEN) | **(1<<RXCIE)**;
UCSRC = (1<<URSEL)|(1<<USBS)|(3<<UCSZ0)|(1 << UCSZ1);
}
ISR (USART_RXC_vect)
{
PORTD= 0b00000100; //enable RTS
char ReceivedByte ;
ReceivedByte = UDR ; // Fetch the received byte value into the variable " ByteReceived "
UDR = ReceivedByte ; // Echo back the received byte back to the computer
PORTD= 0b00000000; //disable RTS
}
int main (void)
{
usart_init();
while(1)
{
sei();
}
return 0;
}
but this only can transmit and receive a character. How to modified this code to enable it to send and transmit a string.
Thank for the help :)