Created
October 4, 2013 18:24
-
-
Save dagon666/6830358 to your computer and use it in GitHub Desktop.
atmega328p usart init 57600 baud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void serial_init() { | |
| power_usart0_enable(); | |
| // configure ports double mode | |
| UCSR0A = _BV(U2X0); | |
| // configure the ports speed | |
| UBRR0H = 0x00; | |
| UBRR0L = 34; | |
| // asynchronous, 8N1 mode | |
| UCSR0C |= 0x06; | |
| // rx/tx enable | |
| UCSR0B |= _BV(RXEN0); | |
| UCSR0B |= _BV(TXEN0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment