#include #include #include #include #include "lcd-routines.h" #include #define high 1 #define low 0 volatile uint16_t dummy=0; volatile uint16_t milli=0; volatile uint8_t sec=0; volatile uint8_t min=0; volatile uint8_t hour=0; volatile uint8_t day=0; volatile uint8_t eventlog[4000]; volatile uint16_t eventcounter=0; volatile uint8_t bounce0=0; volatile uint8_t bounce1=0; volatile uint8_t bounce2=0; volatile uint8_t bounce3=0; volatile uint8_t bounce4=0; volatile uint8_t bounce5=0; volatile uint8_t bounce6=0; volatile uint8_t bounce7=0; void input_init() { DDRC &= ~((1<0) { output[0] = ( eventlog[(eventcounter*8)-6] << 8 ) | eventlog[(eventcounter*8)-7]; output[1] = eventlog[(eventcounter*8)-5]; output[2] = eventlog[(eventcounter*8)-4]; output[3] = eventlog[(eventcounter*8)-3]; output[4] = eventlog[(eventcounter*8)-2]; output[5] = eventlog[(eventcounter*8)-1]; itoa (output[0], test, 10); lcd_string( test); lcd_string( "/"); itoa (output[1], test, 10); lcd_string( test); lcd_string( "/"); _delay_ms(100); itoa (output[2], test, 10); lcd_string( test); lcd_string( "/"); itoa (output[3], test, 10); lcd_string( test); lcd_string( "/"); itoa (output[4], test, 10); lcd_string( test); lcd_string( "/"); itoa (output[5], test, 10); lcd_string( test); _delay_ms(100); } lcd_setcursor( 0, 2 ); _delay_ms(100); itoa (eventcounter/7, test, 10); lcd_string(test); _delay_ms(1000); lcd_clear(); } return 0; } ISR (TIMER1_COMPA_vect) { milli++; if (milli == 1000) { sec++; milli=0; if(sec == 60 ) { min++; sec = 0; if(min == 60 ) { hour++; min = 0; if(hour == 24 ) { day++; hour = 0; } } } } } ISR(PCINT0_vect) { volatile static uint8_t pcint_temp; uint8_t difference; uint8_t reg; // Get the port byte. reg = PINA; // XOR saved reg with current reg to get difference. difference = reg ^ pcint_temp; // Save the new value of PORTB. pcint_temp = reg; if (difference % (1<>8); volatile static uint8_t pcint_temp; uint8_t difference; uint8_t reg; // Get the port byte. reg = PINC; // XOR saved reg with current reg to get difference. difference = reg ^ pcint_temp; // Save the new value of PORTC. pcint_temp = reg; if (difference % (1<