AVR1934: XMEGA-A3BU Xplained Software User Guide Features • LCD with backlight • Sensors readout - Light sensor - Temperature sensor • Menu system • QTouch button demonstration • Date and time functionality using Real Time Counter - Time since production - Current time and date 8-bit Atmel Microcontrollers Application Note 1 Introduction The Atmel® AVR® XMEGA®-A3BU Xplained evaluation kit demo software is created to showcase the XMEGA-A3BU, touch button and LCD, using a simple menu navigation system, and
Modules and services This demo application is available through the Atmel® AVR® Software Framework (ASF), version 2.6.0 or later. It is available at the Atmel.com AVR Software Framework page. The demo application is available as an example project in AVR Studio 5. This can be accessed by clicking File → New → Example Project, and selecting “Demo application for XMEGA-A3BU Xplained”. Table 2-1. List of services and modules Module name Source file Header file LCD panel and controller st7565r.c st7565r.
AVR1934 • SPI clock • SPI data The ST7565R is always initialized by performing a hard reset of the LCD controller to bring it to a known state, as its state cannot be read from the controller. Please refer to the “XMEGA-A3BU Xplained Hardware User’s Guide” for more information about physical pin connections. The ST7565R driver (st7565r.c and st7565r.h) takes care of all low level interfacing with the reset line, register select line, chip select line and the SPI driver.
2.3 NTC temperature sensor An NTC (Negative Temperature Coefficient) resistor is available for measurement of the ambient temperature. The NTC resistor is connected in series with another resistor, creating a voltage across the NTC resistor which varies with the ambient temperature. This voltage can in turn be measured using the Atmel AVR XMEGA ADC. The relationship between the ADC sample values and the actual ambient temperature is a complex equation shown in the plot in Figure 2-1: Figure 2-1.
AVR1934 which has been linearized is fairly complex, the resulting temperature should only be regarded as an approximation to the actual temperature. 2.4 Ambient light sensor An ambient light sensor in available on the Atmel® AVR® XMEGA®-A3BU Xplained, which is sensitive to visible light, much like the human eye. A resistor is connected in series with the light sensor providing a voltage proportional to the current passing through the light sensor.
2.5 Battery backed Real Time Counter The Atmel AVR XMEGA-A3BU features battery backup system support, which can be used to power an ultra low-power 32-bit Real Time Counter (RTC), and a 32.768kHz crystal oscillator, providing a 1Hz clock to the RTC. On the XMEGA A3BU Xplained board the RTC is powered by a button cell battery. The battery is connected to the battery backup systems VBAT pin, ensuring power to the RTC when the main power is disconnected, allowing the storage of current time on the board.
AVR1934 2.6.2 Text drawing with font support Font support is made available through the gfx_mono_text.c and gfx_mono_text.h files, which in turn relies on system font objects from sysfont.c and sysfont.h, allowing printing of text from glyph data stored in program memory using progmem.c and progmem.h. 2.6.3 Usage in demo application The demo application uses the menu system service, which in turn uses gfx_mono, combining primitive drawing and text output to create a simple navigation menu system.
This function will then return a status code and act depending on the given keycode: • • • • MENU_KEYCODE_DOWN: Change selection to next menu item (or first if at bottom) Returns MENU_EVENT_IDLE MENU_KEYCODE_UP: Change selection to previous menu item (or last if at top) Returns MENU_EVENT_IDLE MENU_KEYCODE_ENTER: Nothing changes in menu. Returns the line selected MENU_KEYCODE_BACK: Nothing changes in menu. Returns MENU_EVENT_EXIT 2.7.
AVR1934 2.8.1 Usage in demo application The production time application uses the calendar service to convert the production time timestamp and the current timestamp to a date and calculate the difference between them. The date and time application uses the service to convert the current timestamp into the local time and date. 2.
3 Demo application The demo application consists of different applications selectable from a list when the device is started: Table 3-1. Available applications Application name Source file Header file Time zone application timezone.c timezone.h Date time application date_time.c date_time.h Production date application production_date.c production_date.h Temperature application ntc_sensor.c ntc_sensor.h Light sensor application lightsensor.c lightsensor.h Backlight toggling -- -- 3.
AVR1934 “Set date” and “set time” presents the user with the current date or time and spinner widgets to adjust them. The date widget does not do real-time checking of valid dates, so if the user tries to set an invalid date such as Feb. Figure 5 Set date, month spinner 31th; an error message will be selected presented, and the date will not be stored.
3.5 Light sensor application The light sensor application displays data from the light sensor as a raw ADC value text string, and a graphical bar representing illuminance. This bar increases in length as the ambient illumination increases. In contrast, the Figure 8 Lightsensor application raw ADC value will decrease with screenshot increasing illumination. To avoid flickering, the text string for the raw value is only updated every 20th iteration of the application loop.
AVR1934 4 EVALUATION BOARD/KIT IMPORTANT NOTICE This evaluation board/kit is intended for use for FURTHER ENGINEERING, DEVELOPMENT, DEMONSTRATION, OR EVALUATION PURPOSES ONLY. It is not a finished product and may not (yet) comply with some or any technical or legal requirements that are applicable to finished products, including, without limitation, directives regarding electromagnetic compatibility, recycling (WEEE), FCC, CE or UL (except as may be otherwise noted on the board/kit).
5 Table of Contents Features ............................................................................................... 1 1 Introduction ...................................................................................... 1 2 Modules and services...................................................................... 2 2.1 LCD panel and controller..................................................................................... 2 2.2 QTouch button.....................................................
Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: (+1)(408) 441-0311 Fax: (+1)(408) 487-2600 www.atmel.com Atmel Asia Limited Unit 01-5 & 16, 19F BEA Tower, Milennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon HONG KONG Tel: (+852) 2245-6100 Fax: (+852) 2722-1369 Atmel Munich GmbH Business Campus Parkring 4 D-85748 Garching b. Munich GERMANY Tel: (+49) 89-31970-0 Fax: (+49) 89-3194621 Atmel Japan 9F, Tonetsu Shinkawa Bldg.