Utilizing setbaud
This commit is contained in:
parent
241536a6e9
commit
bb69b840cf
1 changed files with 3 additions and 3 deletions
6
uart.c
6
uart.c
|
@ -7,9 +7,9 @@
|
|||
#include <util/setbaud.h>
|
||||
|
||||
void initUART() {
|
||||
// Set baud rate
|
||||
UBRR0H = (uint8_t)(F_CPU / (BAUD * 16UL) - 1) >> 8;
|
||||
UBRR0L = (uint8_t)(F_CPU / (BAUD * 16UL) - 1);
|
||||
// Set baud rate with precalculated values (see setbaud.h)
|
||||
UBRR0H = UBRRH_VALUE;
|
||||
UBRR0L = UBRRL_VALUE;
|
||||
// Enable receiver and transmitter
|
||||
UCSR0B |= (1 << RXEN0) | (1 << TXEN0);
|
||||
// Set frame format: 8 data, 1 stop bit
|
||||
|
|
Loading…
Reference in a new issue