Specifications

10
AVR064
2529A–AVR–11/02
Initialize After a Reset the firmware will initialize the ATmega169 and its integrated peripherals.
The initialization runs only one time after a Reset.
Figure 9. Initialize
PORTB is set as output and should be connected to the LEDS on STK500. PB5 (OC1A)
and PB6 (OC1B) shows the offset between measured temperature and selected tem-
perature set point. PB4 and PB7 are heating and cooling pins respectively. Connect a
heating and cooling element to these pins.
DDRE is set as input and should be connected to the SWITCHES on the STK500. PE7,
PE6, and PE5 are used to select what information should be displayed on the LCD and
adjusting Time/Date, temperature set point and the LCD contrast.
Timer/Counter1 is set up with PWM to use on the OC1A/OC1B (PB5/PB6) pins.
Enable Timer/Counter2 with asynchronous operation, for the RTC. By using an external
32 kHz crystal the RTC can run independently of the ATmega169 system clock, and will
also run during sleep.
Set up the UART with both RX and TX enable, baud rate 9600 @ 1 MHz, asynchronous
operation, 8-bit character size, 1 stop bit and Disable Parity mode.
Set PORTB as Output.
Set PORTE as Input.
Set Up Timer1 with PWM.
Phase Correct, 10-bit.
Set Up the Real Time Clock,
using Timer2 in Asynchronous
Mode.
Set Up the UART.
Baudrate = 9600 @ 1Mhz
Set Up the ADC
Set Up the LCD with 1/4 Duty
Cycle and 1/3 Bias.
Enable All Segments.
Set Up Data for the LCD
Display. Scrolling Text.
Initialize
Return