This is a minimal configuration that I found in the forum, to make the Transmit of the USART of the ATMega work. No Interrupt, TX only. Hardcoded Baud rate (change first line to your need) No serial.h librairies needed

#define myubbr (16000000/16/9600-1)
void simpletx( char * string ){
  if (UCSR0B != (1<<TXEN0)){ //do we need to init the uart?
    UBRR0H = (unsigned char)(myubbr>>8);
    UBRR0L = (unsigned char)myubbr;
    UCSR0A = 0;//Disable U2X mode
    UCSR0B = (1<<TXEN0);//Enable transmitter
    UCSR0C = (3<<UCSZ00);//N81
  }
  while (*string){
    while ( !( UCSR0A & (1<<UDRE0)) );
    UDR0 = *string++; //send the data
  }
}

Share