Go to the documentation of this file.00001
00030 #include <avr/io.h>
00031 #include <avr/interrupt.h>
00032 #include <avr/pgmspace.h>
00033 #include <util/delay.h>
00034 #include <stdlib.h>
00035
00036
00037 #include "lcd.h"
00038 #include "uart.h"
00039
00040 uint8_t cnt=0;
00041 extern uint8_t scroll;
00042
00043
00049 inline void timer2_init(void) {
00050
00051 TCCR2 = (1<<CS22) | (1<<CS21) | (1<<CS20);
00052 TIMSK |= (1<<TOIE2);
00053 }
00054
00055
00056 int main(void) {
00057
00058 uint8_t data;
00059
00060 uart_init();
00061
00062 timer2_init();
00063
00064 sei();
00065
00066 lcd_init();
00067 print_buffer();
00068
00069 while(1) {
00070 if(uart_getbyte(&data)) {
00071 lcd_putchar(data, NULL);
00072 }
00073 if(scroll && cnt>4) {
00074 cnt=0;
00075 lcd_scroll();
00076 }
00077
00078 }
00079 }
00080
00081 ISR(TIMER2_OVF_vect ){
00082 cnt++;
00083 }
00084
00085