• Main Page
  • Related Pages
  • Files
  • File List
  • Globals

UartDisplay.c

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                 //Timer zum scrollen
00051         TCCR2 = (1<<CS22) | (1<<CS21) | (1<<CS20);                      //Clock Select. Prescaler set to 1024
00052         TIMSK |= (1<<TOIE2);                                                            //Timer2 Overflow Interrput Enable
00053 }
00054 
00055 
00056 int main(void) {
00057         
00058         uint8_t data;
00059         
00060         uart_init();
00061         
00062         timer2_init();
00063         
00064         sei();                                                                                          // Global Interrput Enable
00065         
00066         lcd_init();                                                                             // Initialize LCD driver IC
00067         print_buffer();                                                                         // Write buffer to display
00068         
00069         while(1) {
00070                 if(uart_getbyte(&data)) {                                               //If there is received 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 

Generated on Tue Feb 15 2011 18:32:45 for UartDisplay by  doxygen 1.7.2