ATmega328A UART: everything working, but not as expected
You have missing parentheses in while(!(UCSR0A) &amp; (1&lt;&lt;RXC0)); condition. Correct it as

while(!(UCSR0A &amp; (1&lt;&lt;RXC0))); 

or 

while(!(UCSR0A &amp; _BV(RXC0))); 

to reuse macros or 

while(!bitRead(UCSR0A, RXC0));

if using Arduino.h library.