/* main.c Henriks AVR application Copyright Henrik Björkman www.eit.se/hb 2005 All rights reserved etc etc... For hardware see: H:\d\eget\projects\inteligent_electronic_thermostat\hw\0.1 History 2005-02-14 want to use serial port. Have adapted some code I found at http://www.lka.ch/projects/avr/ Henrik Bjorkman 2005-02-20 Will try to interpret some commands Henrik */ #include #include #include #include #include #include #include #include "avr_cfg.h" #include "avr_misc.h" #include "avr_uart.h" #include "avr_tmr0.h" #include "version.h" int mainTimer; int mainCounter=0; int main( void ) { wdt_enable(WDTO_2S); uart_init(); uart_print_P(PSTR("\r\n" VERSION_STRING "\r\n")); sei(); // enable global interrupts avr_tmr0_init(); mainTimer=avr_tmr0_gettick()+AVR_TMR0_TICKS_PER_SEC(); for(;;) { const int t=avr_tmr0_gettick(); if ((mainTimer-t)<0) { uart_putchar('.'); mainTimer+=AVR_TMR0_TICKS_PER_SEC(); } wdt_reset(); // Set CPU in idle mode to save energy, it will wake up next time there is an interrupt avr_idle(); } return(0); } // end main()