Atmega328 ubrr value shifting issue for serial transmission
Why are we moving the lower byte to the high register UBRR0H and the higher byte to UBRR0L (after shifting).


You aren't.

ubrr &gt;&gt; 8 takes the upper 8 bits of ubrr and shifts them into the lower 8 bits, where they are written to UBRR0H. It doesn't modify the value of ubrr.

Writing a 16-bit value, like ubrr, to an 8-bit register, like UBRR0L, truncates the value to its lower 8 bits.