Hello all I just got a atmega16 board part of my first task is going to make a clock display on my LCD i have a 8Mhz system clock. SO i have 2 questions
1) my question is about how to do this my current process i setup interrupt, my interrupts are 8Mhz/64 = 8us , im using TCNT0 so max count is 255 but im actually counting to 250 boosting my count now to 2us, from there another count of 500 gets my a 1sec count. once i get the 1 sec count im not sure how i should handle the timer update. what im thinking is increment a minutes variable exit the interrupt. and let a task update the LCD. does anyone know a better approach since interrupts are suppose to be short im not sure i can do anything else there.
--below is a sample of my code
ISR(TIMER0_OVF_vect) { /* count of 250 is what is needed to get 1sec delay 255 - 6 = 250 remember 0 is included in the count */ TCNT0 = 6; /* will give a 1sec delay */ if(timecountms++ >= 500) { timecountsecs++; timecountms = 0; } } /* the task is currently just a while(1) in main */ if(timecountsecs >= 60) { //reset timecountsecs timecountsecs = 0; // update time on LCD if((minutes - 60) <= 0 &&(minutes >= 0)) //only update when minutes is 0-59 { if(ledOn == NO) { turnOnLED(LED1); ledOn = YES; }else { turnOffLED(LED1); ledOn = NO; } minutes += 1; // ever 60secs update minutes } else if((hours - 12) <= 0 &&(hours >= 0)) { hours += 1; //every 60 minutes update hours } else if((hours) < 0 &&(hours > 60)) { hours = 0; //reset if hours are invalid } else if((minutes) < 0 &&(minutes > 60)) { minutes = 0; //reset if minutes are invalid } } }
2) does anyone know how to use Eclipse as a debugger i keep getting errors it builds fine in eclipse but i have to port the .elf over to avr studio for debugging also it only shows me the dissembler not the actual c code.
thanks in advance[/code]