Specifications

11
AVR064
2529A–AVR–11/02
Set up the ADC in Single Ended mode. Differential mode can be selected by setting
ADC_init(Differential) instead of ADC_init(SingleEnded) in the source code. Disable dig-
ital input on PORTF and run a dummy ADC conversion.
Enable all segment pins on the ATmega169. Select the 32 kHz as clock source for the
LCD, and set the prescaler bits. Select 1/4 duty cycle and 1/3 bias. Set up
Timer/Counter0 Compare Match interrupt to give the required delays for the scrolling
and blinking speed of the information on the LCD display.
Start scrolling the initial string over the LCD display.
Time and Date Update This routine updates the clock and date according to the variable SECOND that gets
incremented every second in the Timer/Counter2 Overflow interrupt routine. The whole
update routine is self-explaining from the flow-chart.
Figure 10. Time and Date Update
SECOND
Larger than
59?
MINUTE
Larger than
59?
Increment MINUTE
Clear SECOND
Increment HOUR
Clear MINUTE
HOUR
Larger than
23?
Increment DAY
Clear HOUR
Increment MONTH
Set DAY = 1
MONTH
Larger than
12?
DAY
Larger than Number
of Days in Month? (check
if Leap Year)
Increment YEAR_LO
Set MONTH = 1
Increment YEAR_HI
Clear YEAR_LO
YEAR_LO
Larger than
99?
YES
YES
NO
YES
NO
NO
YES
NO
YES
YES
NO
NO
The Variable SECOND is
Incremented in the Timer2
Overflow Interrupt Routine.
Time_update
Return