31 lines
599 B
C
31 lines
599 B
C
#include <avr/io.h>
|
|
#include "lcd.h"
|
|
|
|
#define USART_BAUDRATE 9600 //! USART baudrate, change this to set it.
|
|
#define UBRR_VALUE (((F_CPU/(USART_BAUDRATE*16UL)))-1)
|
|
|
|
/** @brief Sets up USART for TX and RX with a baud rate of USART_BAUDRATE
|
|
*/
|
|
void usart_init() {
|
|
// initialize USART
|
|
UBRRL = UBRR_VALUE & 255;
|
|
UBRRH = UBRR_VALUE >> 8;
|
|
UCSRB = (1 << TXEN) | (1 << RXEN); // fire-up USART
|
|
UCSRC = (1 << UCSZ1) | (1 << UCSZ0); // fire-up USART
|
|
|
|
|
|
UCSRB |= (1 << RXCIE);
|
|
}
|
|
|
|
int main() {
|
|
usart_init();
|
|
|
|
lcd_clrscr();
|
|
lcd_gotoxy(0,0);
|
|
|
|
// Main loop
|
|
while (1) {
|
|
|
|
}
|
|
|
|
} |