hexagon5un / AVR-Programming

Code examples for the book "Make: AVR Programming"
http://littlehacks.org/AVR-Programming
MIT License
725 stars 340 forks source link

USART.c ATmega16A fix. #42

Closed cmacu4 closed 5 years ago

cmacu4 commented 5 years ago

When trying to compile for the first time I got this: Capture So in USART.c I change "UBR0H" to "UBRH", "UBR0L" to "UBRL" etc. until the code compiled. But when I finally got to actualy using the USART I had to make one last tweak before the serialLoopback.c code worked. Change:"UCSR0C = (1 << UCSZ01) | (1 << UCSZ00);" to: " UCSRC = (1 << UCSZ1) | (1 << URSEL) | (1 << UCSZ0); " This is because you need to set the URSEL bit when you write to the UCSRC register.