1AVR064: STK502 – A Temperature Monitoring System with LCD OutputFeatures • Presenting Data on an LCD Display• Temperature Measurement• Real Time Cloc
10AVR064 2529A–AVR–11/02Initialize After a Reset the firmware will initialize the ATmega169 and its integrated peripherals.The initialization runs onl
11AVR0642529A–AVR–11/02Set up the ADC in Single Ended mode. Differential mode can be selected by settingADC_init(Differential) instead of ADC_init(Sin
12AVR064 2529A–AVR–11/02Temperature Calculation In this function the voltage over the NTC thermistor will be measured and the tempera-ture calculated.
13AVR0642529A–AVR–11/02Receive Data from PC These routines take care of data coming from the PC through the UART interface.Figure 12. Receive Packet
14AVR064 2529A–AVR–11/02Store_Rx_data The packet is then converted from ASCII to hexadecimal. One HEX-byte can contain 1 -3 ASCII bytes. ASCII-bytes t
15AVR0642529A–AVR–11/02Transmit Packet to PC These routines transmit the data from ATmega169 to the PC.Figure 13. Transmit Packet to PCA transmit pac
16AVR064 2529A–AVR–11/02Table 2. Transmit Packet to PCPreamble “STK502” 6 byteASCII-space (0x20) 1 byteHOUR 2 byteASCII-space (0x20) 1 byteMINUTE 2 b
17AVR0642529A–AVR–11/02STK500 Switches Figure 14. CheckButtonsThere are three switches that are used as inputs to the application. To do several tas
18AVR064 2529A–AVR–11/02To adjust the variable MINUTE: Press SW7 until “CLOCK” appears in the LCD display,and select this by pressing SW6 to activate
19AVR0642529A–AVR–11/02After the LCD_displayBuffer has been updated, the LCD_updatedComplete will be setto FALSE, and LCD_updateRequired to TRUE. This
2AVR064 2529A–AVR–11/02Application Overview This application note describes how to get started with the ATmega169 microcontroller(MCU), the first AVR
20AVR064 2529A–AVR–11/02LCD Set-up Data Figure 17. LCDsetupDataIf Menu 1 isn’t active the welcome string will scroll over the LCD. If Menu 1 is activ
21AVR0642529A–AVR–11/02Terminal All temperature and time information is transmitted through the UART-interface. A pro-gram on a PC can receive this da
22AVR064 2529A–AVR–11/02Figure 19. HyperTerminalOne can also adjust the variables within the ATmega169 from the terminal. This has tobe done accordin
Printed on recycled paper.© Atmel Corporation 2002.Atmel Corporation makes no warranty for the use of its products, other than those expressly contai
3AVR0642529A–AVR–11/02Figure 2. Menu SystemPlease see section “STK500 Switches” on page 17, for more detailed information onhow to use the menu syste
4AVR064 2529A–AVR–11/02Hardware DescriptionATmega169 ATmega169 is an ultra low power AVR 8-bit RISC microcontroller. It includes 16K byteSelf-programm
5AVR0642529A–AVR–11/02LCD Display Liquid Crystal Displays (LCDs) are categorized as non-emissive display devices. In thatrespect, they do not produce
6AVR064 2529A–AVR–11/02Hardware Configuration In order to make the example code work, it is required to set up the cables and switchesin the correct o
7AVR0642529A–AVR–11/02• Connect the “Segment pins from ATmega169” to the “STK502 LCD pins” with the 34-pin cable. • Place a jumper on the 2-pin header
8AVR064 2529A–AVR–11/02ATmega169 Firmware The firmware that realizes the temperature control application is written in IAR EWAVR2.27b. The timing rela
9AVR0642529A–AVR–11/02Main Loop Figure 8 shows the main loop. Figure 8. Main LoopStore DatafromReceive BufferSend DatafromTransmitBufferTemperatureCa
Kommentare zu diesen Handbüchern