Download: 8-bit Microcontroller Application Note

8-bit Microcontroller Application Note Rev. 2530B–AVR–01/04 AVR065: LCD Driver for the STK502 and AVR Butterfly Features • Software Driver for Alphanumeric Characters • Liquid Crystal Display (LCD) Contrast Control • Interrupt Controlled Updating • Conversion of ASCII to LCD Segment Control Codes (SCC) • Interfacing the STK502 LCD Display Introduction In applications where user interaction is required it is often useful to be able to display information to the user. A simple interface could be status LEDs, whereas more com- plex interaction can benefit from a display capable of displaying lett...
Author: Zoble1980 Shared: 8/19/19
Downloads: 896 Views: 2728

Content

8-bit

Microcontroller Application Note

Rev. 2530B–AVR–01/04

AVR065: LCD Driver for the STK502 and AVR Butterfly Features

• Software Driver for Alphanumeric Characters • Liquid Crystal Display (LCD) Contrast Control • Interrupt Controlled Updating • Conversion of ASCII to LCD Segment Control Codes (SCC) • Interfacing the STK502 LCD Display

Introduction

In applications where user interaction is required it is often useful to be able to display information to the user. A simple interface could be status LEDs, whereas more com- plex interaction can benefit from a display capable of displaying letters, number, words or even sentences. Liquid Crystal Displays (LCD) are often used for displaying mes- sages. LCD modules can either be graphical ones, which can be used to display graphics and text, or alphanumerical ones capable of displaying 10 – 80 characters. The standard alphanumerical LCD modules are easy to interface but are fairly expen- sive. These are expensive because they have built-in drivers/controllers, which handle the generation of the characters/graphics on the LCD glass. The LCD glass is the glass plate in which the liquid crystal is contained. To reduce the cost of an application where a display is required one can choose to use a MCU that have a built-in LCD driver. The MCU can then drive the LCD glass directly, eliminating the need for the driver integrated in the LCD module. The cost of the display can be reduced by as much as a factor 10, since an LCD glass has a much lower cost than an LCD module. The ATmega169 Flash microcontroller from Atmel has an integrated LCD driver capa- ble of controlling up to 100 segments. The highly efficient core and the very low power consumption of this device makes it ideal for battery powered applications requiring a human interface.,

Theory of Operation This section provide a basic overview of common features and a introduction to the ter-

minology used in relation to LCD glass. In Addition a summary of the ATmega169 display driver, and a description of the LCD glass used in the application example is discussed. Further, this section contains a sum- mary of the ATmega169 LCD features and a description of the LCD glass used in the application example.

LCD Glass Explained The Liquid Crystal Display is based on a display technology that uses rod-shaped mole-

cules (liquid crystals) that flow like liquid and bend light. Unenergized, the crystals direct light through two polarizing filters, allowing a natural background color to show. When energized, they redirect the light to be absorbed in one of the polarizers, causing the dark appearance. The more the molecules are twisted(1), the better the contrast and viewing angle. The LCD must be driven by alternating current (AC). Direct current (DC) will cause elec- trophoresis effects in the liquid crystal and will degrade the display. There are two AC driving method: the static driving methods and the multiplex driving method. In the static driving method, the LCD is driven with two square waveforms. The static driving method is the most basic method by which good display quality can be obtained. However, it is not suitable for liquid displays with many segments because one liquid crystal driver circuit is required per segment. In the multiplex (MUX) driving method, there are a wide variety of drive waveforms and bias levels (explained below) depending on the driver manufacturers. The MUX level depends on the number of backplanes (also called common lines or common terminals). For example, a triple display (1/3 MUX) has three backplanes. The two most common types of LCDs are: “Twisted Nematic” (TN) and “Super Twist Nematic” (STN). The TN is used for LCD glass with less than 16 back-planes, while STN LCDs are capable of having as much as 240 back planes. The limitations in number of back planes are caused by a decrease in transparency due to increasing number of back-planes. More details about the differences between TN and STN LCDs can be found in the STK502 User Guide. Note: 1. The LCD crystals are more twisted when more polarized due to higher voltage over the LCD segment. LCD Frame Rate The number of times the LCD segments are energized per second is called the LCD frame rate. The frame rate should be kept above 30 Hz to avoid that the human eye per- ceives the segments as flickering. If a high frame rate is used ghosting can occur. Ghosting is when LCD segments are not properly turned off. Ghosting is also depending on Duty and Bias (explained below) and it may be required to adapt the frame rate to the actual Duty and Bias used. In general ghosting can be avoided by using sufficiently low frame rates; A frame rate of 100 Hz prevents ghosting. Segments Drivers and Each LCD segment has two terminals. One is connected to a segment driver the other is Common Terminals connected to a common terminal. By applying an alternating current across the segment driver and the common terminal the liquid crystal is polarized (energized) and becomes visible. The common terminal is as the term describes common for a group of LCD segments. To be able to activate only one segment though one (common) terminal that is shared between multiple segments, the driving waveforms are encoded in a way so that the segment can be activated individually.. If only one common terminal is used, that is if 2 AVR065,

AVR065

each segment driver is only driving one segment, the segment driver of the segments that should not be energized are of opposite phase of the segment drivers that are ener- gizing segments. This result in that there is a maximal voltage drop over the segment that should be energized, while no or only a small voltage drop over the segments that should not be energized. Figure 1 and Figure 2 shows the energized and the non-ener- gized segment and their driving waveforms, for segments where the LCD drivers are only driving one segment each (static Duty). Figure 1. Two LCD Segments Connected to One Common Terminal Segment Line 1 Segment Line 0 Energized Non-energized LCD Segment LCD Segment Common Terminal 0 Figure 2. Driving Waveforms for Two LCD Segments Connected to the Same Common Terminal VLCD VLCD SEG0 SEG1 GND GND VLCD VLCD COM0 COM0 GND GND

VLCD

GND SEG0 - COM0 GND SEG1 - COM0 -VLCD Frame Frame Frame Frame The left side of Figure 2 shows the active segment’s driving waveforms and the right side of Figure 2 shows the in-active segments driving waveforms. The way of energizing the segments are more complex if each LCD driver is driving more than one segment. This happens when multiple back-planes are present. In this case the so-called Duty Cycle of the driving waveforms is 1/2 or lower. The Duty Cycle is described in more details below. Duty Cycle or Duty Ratio The Duty Cycle or Duty Ratio is a number used to describe how long time each segment is activated during each frame. When each segment driver is only driving one segment the Duty Ratio is “static”. If the drivers are driving more than one segment each the Duty Ratio is given as 1/(segments driven by each LCD driver). The number of segments driven by each LCD driver is equal to the number of common terminals. The Duty Ratio is therefore depending on the number of common terminals in a given LCD glass. Figure 3 illustrate the relation between the number of back-planes and the Duty Ratio used when controlling the LCD. SEG0 SEG1, Figure 3. LCD Segments Controlled by Using One or Three Common Terminals – Using a Static Duty of a Duty of 1/3 Duty = Static (1/1) Duty = 1/3 Segment Line 1 Segment Line 1 Segment Line 0 Common Terminal 0 Common Terminal 0 Common Terminal 1 Common Terminal 2 Drive Bias The Drive Bias (or just Bias) is related to the number of voltage levels used when driving the LCD. The Bias is defined as 1/(number of voltage levels-1). The more segments driven by each driver(1) the higher number of voltage levels are required. As per the def- inition of Duty Ratio, there is a direct relation between the Bias required and the Duty Ratio used. Note: 1. The number of segments driven by a single segment line is depending on the number of back-planes in the LCD glass. Table 1. Display Duty, Bias and Voltage Levels Common Terminals12346711 12 Duty Static 1/2 1/3 1/4 1/6 1/7 1/11 1/12 Bias 1 1/2 1/3 1/3 1/3 1/4 1/4 1/5 Voltage Levels23444556If three common lines are used in an LCD it has 1/3 Duty Ratio (see Figure 3). This means that each segment driver controls up to three segments. To be able to control three segments from one segment driver the Bias needs to be 1/3. In other words it requires four different voltage levels to be able to control three segments using only one driver. Each of the LCD segments connected to a single segment line has different com- mon terminals. Figure 4 shows the driving waveforms of two LCD segments driven by the same seg- ment line and connected to two different back-planes. The illustration shows that the driving waveform has four voltage levels, Bias of 1/3, which is sufficient to drive up to six back-planes. However since the waveform shows three cycles within one frame the Duty is 1/3 and indicating that the glass has three back-planes. SEG0 SEG1 SEG0 SEG1 SEG2 4 AVR065,

AVR065

Figure 4. Driving Waveforms of Two Different LCD Segments VLCD VLCD 2/ V 23 LCD /3VLCD 1/3VLCD SEG0 1/3VLCD SEG0 GND GND VLCD VLCD 2/ 23VLCD /3VLCD 1/ V COM0 1/ V COM13 LCD 3 LCD GND GND VLCD VLCD 2/ V 23 LCD /3VLCD 1/ 13VLCD /3VLCD GND SEG0 - COM0 GND SEG0 - COM1 -1/ 13VLCD - /3VLCD -2/ 23VLCD - /3VLCD -VLCD -VLCD Frame Frame Frame Frame Figure 4 shows driving waveforms of two different LCD segments connected to two dif- ferent common terminals. The segment line is shared. The left side figure is illustrating the active segment, the right side figure is illustrating the inactive segment. The segment represented by the right side figure is inactive because the LCD activation voltage threshold is not passed. LCD Contrast LCD contrast is a function of the RMS value of the back-plane minus segment line waveforms at that segment location. Waveforms can be generated such that, at any point in the LCD structure, the resulting RMS voltage is either above the saturation volt- age(1), or below the visual threshold voltage. Note: 1. Saturation voltage is the voltage level where the crystals are fully polarized.

LCD Features of the The ATmega169 is the first AVR with integrated LCD drivers. The ATmega169 can with ATmega169 its four back-plane lines and 25 segment lines drive up to 100 LCD segments.

To provide high flexibility the LCD driving waveform is selectable. The Duty Ratio and Bias is programmable making it possible to interface LCD glass with one to four back planes and between 13 and 25 segment lines. The lines not used for driving the LCD can be used as general IO. The LCD contrast can be controlled by varying the driver voltage level between 2.6V and 3.35V – independent of VCC. These voltage levels only apply to the LCD pins while used by the LCD interface. To be able to optimize for performance and current consumption the ATmega169 uses programmable frame rates and allow the use of “low power waveforms”. The low power waveform ensures that the switching of the segment and common lines are kept at a minimum frequency. Further, the power saving modes of the ATmega169 allows the MCU to continue driving the LCD glass while reducing its current consumption to a minimum. Due to the built-in LCD interrupt source, the software driver can be fully interrupt driven. This can be used to ensure that the timing related to updating the LCD is correct. It is therefore possible to avoid that partly updated LCD Data Registers are latched to the LCD lines.,

The STK502 LCD Glass The LCD software driver described in this document is made for the STK502, which is

an add-on module for the STK500 development board. A brief description of the LCD on the STK502 is provided here, further details on the STK500 and STK502 can be found in their respective User Guide. The LCD glass mounted on the STK502 is illustrated in Figure 5. It consists of seven alphanumerical symbols and various fixed symbols; Numbers from one to ten, a bell, a low-battery symbol and navigation arrows. Figure 5. Layout of the STK502 LCD Glass12345X1 S1 S2 S3 S4 S5234567COL1 COL2 X2 S6 S7 S8 S9 S10678910 Figure 6. LCD Segments Connect on the STK50212345X1 S1 S2 S3 S4 S5234567COL1 COL2 X2 S6 S7 S8 S9 S10678910 The LCD glass has in total 120 segments – controlled through four back-planes and 30 segment lines. Since the ATmega169 is capable of driving 100 segments some of the segments of the LCD glass is not connected in the standard configuration that the STK502 comes with (see Figure 6). The software driver described in this document assumes that the LCD on the STK502 is connected in accordance with the standard configuration that the STK502 comes with. The STK502 LCD has six similar segment groups, where each segment group is capa- ble of displaying an alphanumerical character. One such group of segments capable of displaying one alphanumerical character is subsequently referred to as a LCD digit. It consists of 14 separate segments. Figure 7 shows an LCD digit and the letter used to refer to each of the segments within a LCD digit. 6 AVR065,

AVR065

Figure 7. Segments and Reference Letters of the LCD Digits

A FHJKB G L EPNMC D

According to the data sheet in the STK502 User Guide, the LCD must be operated at 1/4 Duty and 1/3 Bias. This is to be able to control all four back planes. It is recom- mended to supply the LCD with 3V.,

Implementation This section contains a description of the physical connection between the ATmega169

and the LCD. How to map ASCII characters to the LCD digits is also thoroughly described. The following tools and configurations are needed to use the application note directly on an STK502: • IAR EWAVR 2.27B C-compiler. Other compilers can be used with minor changes. • STK502 Users Guide for connection diagrams. • The TOSC switch of the SSSTK502 must be set to the TOSC position. A description of the LCD driver software is provided in this application note. It describes how to use the driver subroutines, and also how each subroutine is working..

Connections Between The connections between the LCD display and the ATmega169 are described in the

the LCD and the STK502 User Guide. It is important to note that power to the LCD is supplied from the

ATmega169 ATmega169 – it does not have separate supply lines.

LCD Data Registers The LCD segments are individually controlled through the bits of the 20 LCD Data Reg- isters (LCDDR19:0). Not all 20 LCD Data Registers are used – only 16 registers are actually used in the ATmega169. Each segment is uniquely controlled through setting or clearing its corresponding bit in LDDR19:0. The encoding of the physical drive wave- forms to the LCD is handled by the AVR LCD module. Relation Between LCD Data To be able to make an efficient LCD software driver, in terms of code density, the physi- Registers and LCD Segments cal connections between the LCD digits and the segments lines and common lines must be well organized: Each LCD digit must be related in the same/similar way to the LCD Data Registers. This will simplify the translation from an ASCII character to LCD seg- ment control codes described below. The Control Codes can be written to the LCDDR19:0 Registers. The data that is written to the LCDDR19:0 Registers are thus the direct control of the LCD segments through setting and clearing their corresponding bits in the LCD Data Registers. LCD Segment Control Codes The similarities between connections of the six LCD digits available in the STK502 LCD software driver can be seen from bit mapping tables in the STK502 User Guide. The even digits are using the low nibbles of the associated LCD Data Registers and the odd are using the high nibbles. Four different LCD Data Registers are used for each LCD digit; these are all related to different back planes. The relation between the LCD Data Registers and the digits are organized so that the address offset between each LCD Data Register used is fixed; The interspacing between the addressed are in all cases 0x05. Finally, digit 2 and 3, 4 and 5, and 6 and 7 are in pairs respectively starting at LCDDR0, LCDDR1, and LCDDR2. To be able to translate ASCII characters into the LCD segment control codes (SCC) required to set and clear the bits in the LCD Data Registers, the bit mapping tables in the STK502 User Guide are used. Since the tables can be reused for all LCD digits only one bit mapping table needs to be used. To control all segment lines of a LCD digit 16 bits are required. The LCD SCC is thus 16 bit wide, arranged so that each nibble of the LCD SCC is related to one LCD Data Reg- ister. The SCC can therefore be used as follows: SCC = {bit 16:0} = {Nibble4:0} ~ {LCDDRx+15, LCDDRx+10, LCDDRx+5, LCDDRx}; 8 AVR065,

AVR065

The relation between the SCC nibbles and the LCD Data Registers is conditioned by which LCD digit is accessed. Even LCD digits use the low nibble in the LCD Data Regis- ters while the odd numbered LCD digits use the high nibble in the LCD Data Registers. Consider an example where the letter “A” will be shown in an digit . The letter “A” willlook like described in Figure 8. Figure 8. The Letter “A” Displayed in a LCD Digit

A FHJKB G L EPNMC D

As seen the letter “A” require activation of the LCD segments {A, B, C, E, F, G, L}. To describe this in the LCD SCC the bit maps from the STK502 is used. A bit map table as shown in Table 2, represent both even and odd LCD digits. Table 2. LCD digit segment mapping into the LCD Data Registers Register Name Bit7 Bit6 Bit5 Bit4 Bit3 Bit2 Bit1 Bit0 LCDDRx K – – A K - - A LCDDRx+5JFHBJFHBLCDDRx+10LEGCLEGCLCDDRx+15MPNDMPNDTo determine the LCD SCC for the ASCII character “A” consider the following: Nibbles Segments Char “A” SCC = {nibble0} = {{K, -, -, A}, = {{0, 0, 0, 1}, {nibble1} {J, F, H, B}, {0, 1, 0, 1}, {nibble2} {L, E, G, C}, {1, 1, 1, 1}, {nibble3} {M, P, N, D}} {0, 0, 0, 0}} The SCC for character “A” can thus be determined to be: SCC_A = {0x0, 0xF, 0x5, 0x1}=0x0F51, Many standard ASCII characters and symbols are converted to LCD SCC format. The LCD SCC codes are stored in a flash table, which is used when translating the ASCII characters to LCD SCC at run-time. Several legal ASCII symbols are not used in the Flash table, since some of these are not possible to display. These locations in the table can e.g., be used to define customer symbols for the LCD.

AVR Studio® LCD Plug-in To evaluate/test the code described in this application note the LCD plug-in for AVR

Studio 4 can be installed. This makes it possible to see what the LCD on STK502 looks like even without having the STK502. The configuration file for the STK502 LCD is found in the folder C:\Program Files\Atmel\AVR Tools\AvrStudioPlugin\Lcd\Stk500. 10 AVR065,

AVR065 Firmware Description This section contains detailed information about how to use the LCD driver and how it is

implemented. In addition to the descriptions found here, a main.c file is provided along with the LCD driver. The main.c file is an example of how to use the LCD driver and can be studied to understand the driver fully. LCD Driver Functions The functions found in the file LCD_driver.c are listed and commented in Table 3. Table 3. LCD Software Driver Functions Function Name Arguments Return Description LCD_Init (global) void void Initialize the LCD display Data Buffer, which is used to buffer the LCD Data Registers. The LCD frame rate and contrast is selected. The segment lines and common lines are configured. LCD_WriteDigit unsigned char void The ASCII character passed in the “c” (global) c, unsigned argument is converted to a LCD Segment char digit Control Code (SCC). The SCC is the data that maps the ASCII into LCD Segment Symbols. The SCC is copied into the LCD Display Data Buffer. (The actual update is handled by the LCD_SOF_interrupt routine.) Digit is the number of the digit that is desired accessed. The value of digit is in this implementation limited from 2 to 7. LCD_AllSegments unsigned char void Clear or sets all the segments of the LCD (global) input (used as (updating the LCD Display Data Buffer bool) only – the actual update is handled by the LCD_SOF_interrupt routine). LCD_SOF_interrupt void void Latches the LCD Display Data Buffer to (local, interrupt the LCD Data Registers. The latching is service routine) depending on the LCD_timer variable and the LCD_status.updateRequired variable. Macros The macros relevant when using the LCD software driver are listed in Table 4. Table 4. Macros used with the LCD Software Driver Macro Name Arguments Description LCD_CONTRAST_LEVEL level Adjust the LCD contrast. Ranges from 0 to 15, where 15 gives highest contrast level. LCD_SET_COLON active Display or hide the colons in the LCD. Valid input is [TRUE/FALSE], Global Variables The variables listed in Table 5 are the global variables that are required to get control of the communication between the main LCD driver functions and the LCD interrupt func- tion. Details on the functionality of the variables are provided in Table 5. Table 5. Global Variables Required When Using the LCD Software Driver Variable Name Description LCD_status.updateRequired If TRUE the LCD_SOF_interrupt routine will be allowed to (bitfield, bool) latch the LCD Display Data Buffer to the LCD Data Registers. If FALSE the interrupt routine will not latch the LCD display data. This variable can thus be used to request or block the LCD Display Data Buffer latching: While updating the LCD display data buffer the variable should be set to FALSE, so that no latching is performed until the LCD display data buffer is fully updated. LCD_status.updateComplete The variable is set to TRUE when the LCD Display Data Buffer (bitfield, bool) has been latched. This is done in the LCD_SOF_interrupt routine. The variable can thus be used to test if the data written to the LCD display buffer has been latched after accessing the LCD display data buffer. It can be used to handle update timing since the LCD interrupt is occurring with fixed intervals. The variable can be used to control calls to the LCD_WriteDigit function. LCD_timer (Unsigned char) Variable is decremented in the LCD_SOF_interrupt routine. When the value becomes 0, the next latching of the LCD display data buffer will occur. The default timer seed is also reloaded at this time. The variable controls the duration of the interval between LCD updates. The LCD update also depend on the LCD_status.updateRequired variable. If the update cannot be performed because LCD_status.updateRequired is FALSE, the LCD update will be attempted during the next LCD SFO interrupt. The variable can be set to one from the main application if immediate updating of the LCD is desired. 12 AVR065,

AVR065

Performance – Code Size The code size of the LCD software driver is seen from Table 6. Table 6. LCD Software Driver Code Size Performance Code Space (Flash) Data Space (SRAM) No code size optimization 408 bytes 22 bytes (+ 14 bytes shared) (+ 4 bytes shared) Full code size optimization 372 bytes 22 bytes (+ 14 bytes shared) (+ 4 bytes shared)

Function Flowchart The driver consists of the functions described in text and flowchart below.

LCD_Init The function used to initialize the LCD software driver is called LCD_Init. The LCD_Init function first clears the LCDdisplayData buffer. This approach is chosen since it is more code size efficient than initializing it when the LCD_displayData buffer is defined. The AVR LCD module is enabled and configured to match the LCD mounted on the STK502; The contrast level is set, the clock source is set to the external 32 kHz asynchronous Oscillator and the LCD clock prescaler and divider are set to generate a frame rate of 64 Hz. Finally, the LCD Start Of Frame (SOF) interrupt is enabled. The glo- bal interrupt is not enabled – this will be most often handled in the main function., Figure 9. Flowchart of the LCD_Init Function LCD_Init Initialize the LCD_displayData Buffer Enable LCD Interface Set LCD Contrast Level Setup Clock Source, Prescaler and Divider (32 kHz Async Oscillator - Frame Rate 64Hz) Set up Segment and Common Lines Enable LCD Interrupt Return LCD_WriteDigit The purpose of the LCD_WriteDigit function is to convert and copy an ASCII character into the LCD_displayData buffer. Note that the latching of the buffer into the LCD Data Registers is handled in the LCD SOF interrupt. The character passed as a function argument is tested to verify that it is within the char- acter range in the ASCII table. If the character is a lower case character, it is converted to upper case. The character minus the offset from NULL is used as a look up in a Flash table. The data retrieved from the table is the LCD Segment Control Code, which is a two byte value. Each of the four nibbles in the LCD SCC is then merged into the corre- sponding LCD Display Data Buffer elements related to the specific LCD digit that is being updated. Recall that the LCD Display Data Buffer is the information that is latched directly into the LCD Data Registers. The four nibbles of the LCD SCC are therefore merged into the corresponding LCD Data Registers through the buffer. 14 AVR065,

AVR065 Figure 10. Flowchart of the LCD_Write Digit function

LCD_WriteDigit Yes Input Char No Within Range Return Yes (Error)Input Char is Lower Case No Point to the First Relevant Convert to Uppercase LCD Data Register Copy Low Nibble of the SCC Lookup LCD Segment Control Code (SCC) in LCD Character Table Shift the Low Nibble Out of the SCC No Is LCD Digit Even? Is LCD Digit Yes Even? Decoding Mask is 0x0F Yes Swap High and Low Nibble of No SCC Copy Decoding Mask is 0xF0 Store SCC Copy in LCDDR Pointed to; Increment LCDDR Pointer by 5 LCD Digit Yes Within No All Four Range? LCDDR Written? No Yes Return (Error) Return, LCD_AllSegments Depending on the calling argument the LCD_AllSegments clear or set the entire LCD_displayData buffer. This will eventually clear or set the LCD segments. Figure 11. Flowchart of the LCD_AllSegments function LCD_AllSegments Yes Input is No TRUE? Store 0xFF in All LCD Store 0x00 in All LCD Display Data Elements Display Data Elements Return LCD_SOF_interrupt The updating of the LCD is handled by the LCD_SOF_interrupt; It latches the data from the LCD_displayData Buffer to the LCD Data Registers when the interrupt occurs. Two variables are influencing the LCD update – the LCD_status.updateRequired Flag and the LCD_timer variable. Every time the LCD_SOF_interrupt is executed the LCD_timer is decremented. Once it reaches zero the LCD_status.updateRequested Flag is tested. If it tests TRUE the LCD_timer is reloaded with the default timer seed and then the LCD_displayData is latched into the LCD Data Registers. When an LCD update is complete the LCD_status.updateComplete Flag is set to indicate that the LCD_displayData has been latched. If however the LCD_timer has been decremented to zero, but the LCD update is blocked by the LCD_status.updateRequested being FALSE, the LCD_timer is loaded with the smallest possible timer seed (one) and the LCD_status.updateComplete Flag is set to FALSE. This will ensure that a new LCD update is attempted in the first consecu- tive LCD SOF interrupt. The reason that the LCD_status.updateComplete Flag is cleared is that this should be used in the main routine to test if the LCD_displayData Buffer can be updated. If the LCD_status.update Complete Flag is cleared the main rou- tine should not initiate further updating of the LCD_displayData Buffer. Still, ongoing access to the LCD_displayData buffer should not be terminated while the LCD_status.updateComplete Flag is cleared. 16 AVR065,

AVR065

Figure 12. Flowchart of the LCD Start Of Frame Interrupt Service Routine (the LCD_SOF_interrupt Function) LCD_SOF_interrupt Decrement LCD_timingControl No LCD_timer Yes == 0 Yes LCD_update Required ==

TRUE

Replant LCD_timer Seed No Plant Smallest Possible LCD_timer Seed LCD_updateComplete =

TRUE

Block Further Access to the LCD Display Data Buffer Copy LCD Data Struct to LCD IO Registers Return

Literature List 1. STK502 User Guide found at Atmel web site, www.atmel.com.

2. ATmega169 Data Sheet found at Atmel web site, www.atmel.com. 3. LCD, H4042-DL DE5156/L data sheet, included in the STK502 User Guide. 4. LCD technology, http://www.planar.com/technology/lcd.asp,

Atmel Corporation Atmel Operations

2325 Orchard Parkway Memory RF/Automotive San Jose, CA 95131, USA 2325 Orchard Parkway Theresienstrasse 2 Tel: 1(408) 441-0311 San Jose, CA 95131, USA Postfach 3535 Fax: 1(408) 487-2600 Tel: 1(408) 441-0311 74025 Heilbronn, Germany Fax: 1(408) 436-4314 Tel: (49) 71-31-67-0 Fax: (49) 71-31-67-2340

Regional Headquarters Microcontrollers

Europe 2325 Orchard Parkway 1150 East Cheyenne Mtn. Blvd. Atmel Sarl San Jose, CA 95131, USA Colorado Springs, CO 80906, USA Route des Arsenaux 41 Tel: 1(408) 441-0311 Tel: 1(719) 576-3300 Case Postale 80 Fax: 1(408) 436-4314 Fax: 1(719) 540-1759 CH-1705 Fribourg Switzerland La Chantrerie Biometrics/Imaging/Hi-Rel MPU/ Tel: (41) 26-426-5555 BP 70602 High Speed Converters/RF Datacom Fax: (41) 26-426-5500 44306 Nantes Cedex 3, France Avenue de Rochepleine Tel: (33) 2-40-18-18-18 BP 123 Asia Fax: (33) 2-40-18-19-60 38521 Saint-Egreve Cedex, France Room 1219 Tel: (33) 4-76-58-30-00 Chinachem Golden Plaza ASIC/ASSP/Smart Cards Fax: (33) 4-76-58-34-80 77 Mody Road Tsimshatsui Zone Industrielle East Kowloon 13106 Rousset Cedex, France Hong Kong Tel: (33) 4-42-53-60-00 Tel: (852) 2721-9778 Fax: (33) 4-42-53-60-01 Fax: (852) 2722-1369 1150 East Cheyenne Mtn. Blvd. Japan Colorado Springs, CO 80906, USA 9F, Tonetsu Shinkawa Bldg. Tel: 1(719) 576-3300 1-24-8 Shinkawa Fax: 1(719) 540-1759 Chuo-ku, Tokyo 104-0033 Japan Scottish Enterprise Technology Park Tel: (81) 3-3523-3551 Maxwell Building Fax: (81) 3-3523-7581 East Kilbride G75 0QR, Scotland Tel: (44) 1355-803-000 Fax: (44) 1355-242-743 Literature Requests www.atmel.com/literature Disclaimer: Atmel Corporation makes no warranty for the use of its products, other than those expressly contained in the Company’s standard warranty which is detailed in Atmel’s Terms and Conditions located on the Company’s web site. The Company assumes no responsibility for any errors which may appear in this document, reserves the right to change devices or specifications detailed herein at any time without notice, and does not make any commitment to update the information contained herein. No licenses to patents or other intellectual property of Atmel are granted by the Company in connection with the sale of Atmel products, expressly or by implication. Atmel’s products are not authorized for use as critical components in life support devices or systems. © Atmel Corporation 2004. All rights reserved. Atmel® and combinations thereof, AVR®, and AVR Studio® are the registered trademarks of Atmel Corporation or its subsidiaries. Microsoft®, Windows®, Windows NT®, and Windows XP® are the registered trademarks of Microsoft Corpo- ration. Other terms and product names may be the trademarks of others Printed on recycled paper.]
15

Similar documents

8-bit Instruction Set Instruction Set Nomenclature
8-bit Instruction Set Rev. 0856D–AVR–08/02 Instruction Set Nomenclature Status Register (SREG) SREG: Status Register C: Carry Flag Z: Zero Flag N: Negative Flag V: Two’s complement overflow indicator S: N ⊕ V, For signed tests H: Half Carry Flag T: Transfer bit used by BLD and BST instructions I: Gl
8-bit Microcontroller Application Note
8-bit Microcontroller Application Note Rev. 0933B–AVR–05/02 AVR102: Block Copy Routines Features • Program Memory (Flash) to SRAM Copy Routine • SRAM to SRAM Copy Routine • Extremely Code Efficient Routines Flash → SRAM: 6 Words, SRAM → SRAM: 5 Words • Runable Test/Example Program Introduction This
Novice’s Guide to AVR Development intended for
Novice’s Guide to AVR Development Preparing your PC for AVR Development Basic AVR Knowledge An Introduction Let's make an easy start, and download the files that we will need later on. The AVR Microcontroller family is a modern architecture, with all the bells andFirst you should download the files
AVR079: STK600 Communication Protocol
AVR079: STK600 Communication Protocol Features 8-bit • Supported Commands and Command options • Command and Answer package formats Microcontrollers 1 Introduction Application Note This document describes the STK®600 protocol. The firmware is distributed with AVR Studio® 4.14 or later. The definition
8-bit Instruction Set Instruction Set Nomenclature
8-bit Instruction Set Rev. 0856G–AVR–07/08 Instruction Set Nomenclature Status Register (SREG) SREG: Status Register C: Carry Flag Z: Zero Flag N: Negative Flag V: Two’s complement overflow indicator S: N ⊕ V, For signed tests H: Half Carry Flag T: Transfer bit used by BLD and BST instructions I: Gl
Designer’s Designing for Efficient Production Corner with In-System Re-programmable Flash µCs
Designer’s Designing for Efficient Production Corner with In-System Re-programmable Flash µCs By: OJ Svendlsi always the component where the majority of the engi- neering hours are spent. Thus, making sure the micro- For products where time-to-market and efficient pro- controller has what it takes t
AVR069: AVRISP mkII Communication Protocol
AVR069: AVRISP mkII Communication Protocol Features • General commands • ISP commands • Return values • Parameters 1 Introduction This document describes the AVRISP mkII protocol. The firmware is distributed with AVR Studio 4.12 or later. Download the latest AVR Studio from the Atmel web site, http:
Studio® Integrated Development A COMPLETE SOFTWARE ENVIRONMENT TO Environment DEVELOP AVR® APPLICATIONS. IT’S FREE!
MICROCONTROLLERSStudio® Integrated Development A COMPLETE SOFTWARE ENVIRONMENT TO Environment DEVELOP AVR® APPLICATIONS. IT’S FREE! AVR Studio® is an Integrated Development Environment for writing and debugging AVR applications in Windows® 98/XP/ME/2000 and Windows NT® environments. AVR Studio provi
Hexadecimal Object File Format Specification
Hexadecimal Object File Format Specification Revision A January 6, 1988 This specification is provided "as is" with no warranties whatsoever, including any warranty of merchantability, noninfringement, fitness for any particular purpose, or any warranty otherwise arising out of any proposal, specifi
AVR914: CAN & UART based Bootloader for AT90CAN32, AT90CAN64, & AT90CAN128 1. Features
AVR914: CAN & UART based Bootloader for AT90CAN32, AT90CAN64, & AT90CAN128 1. Features • UART Protocol 8-bit – UART used as Physical Layer – Based on the Intel Hex-type records Microcontrollers – Auto-baud • CAN Protocol – CAN used as Physical Layer Application Note – 7 re-programmable ISP CAN ident
AVR Microcontrollers Application Note
AVR Microcontrollers Application Note AVR495: AC Induction Motor Control Using the Constant V/f Principle and a Space-vector PWM Algorithm 1. Features • Cost-effective and energy efficient 3-phase induction motor drive • Interrupt driven • Low memory and computing requirements 2. Introduction In a p
AVR Microcontrollers Application Note AVR494: AC Induction Motor Control Using the constant V/f Principle and a Natural PWM Algorithm
AVR Microcontrollers Application Note AVR494: AC Induction Motor Control Using the constant V/f Principle and a Natural PWM Algorithm 1. Features • Cost-effective and flexible 3-phase induction motor drive • Interrupt driven • Low memory and computing requirements 2. Introduction Electrical power ha
AVR465: Single-Phase Power/Energy Meter with Tamper Detection
AVR465: Single-Phase Power/Energy Meter with Tamper Detection Features • Cost-Effective and Flexible Single-Phase Energy Meter • Fulfills IEC 61036 Accuracy Requirements for Class 1 Meters • Detects, Signals and Continues to Measure Accurately Under At Least 20 Different Tamper Conditions • Design E
AVR453: Smart Battery Reference Design
AVR453: Smart Battery Reference Design Features • Support for up to 4 Li-Ion series-connected battery cells • Battery protection by dedicated Hardware - Deep under voltage protection - Over-current protection during charging - Over-current protection during discharging - Short circuit protection • C
8-bit Microcontroller Application Note AVR450: Battery Charger for SLA, NiCd, NiMH and Li-Ion Batteries Features
8-bit Microcontroller Application Note Rev. 1659B–AVR–11/02 AVR450: Battery Charger for SLA, NiCd, NiMH and Li-Ion Batteries Features • Complete Battery Charger Design • Modular “C” Source Code and Extremely Compact Assembly Code • Low Cost • Supports Most Common Battery Types • Fast Charging Algori
Getting started with the AVR battery charger reference design.
Getting started with the AVR battery charger reference design. The AVR battery charger reference design is designed for use with several types of batteries and various number of battery cells. The AVR battery charger reference design is supplied with resistor values for scaling down the charge volta
8-bit Microcontroller Application Note
8-bit Microcontroller Application Note Rev. 2534A–AVR–05/03 AVR415: RC5 IR Remote Control Transmitter Features • Utilizes ATtiny28 Special HW Modulator and High Current Drive Pin • Size Efficient Code, Leaves Room for Large User Code • Low Power Consumption through Intensive Use of Sleep Modes • Cos
AVR336: ADPCM Decoder
AVR336: ADPCM Decoder Features • AVR Application Decodes ADPCM Signal in Real-Time • Supports Bit Rates of 16, 24, 32 and 40 kbit/s • More Than One Minute Playback Time on ATmega128 (at 16 kbit/s) • Decoded Signal Played Using Timer/Counter in PWM Mode 1 Introduction Adaptive Differential Pulse Code
8-bit Microcontroller Application Note
8-bit Microcontroller Application Note Rev. 1181B–AVR–04/03 AVR360: Step Motor Controller Features • High-speed Step Motor Controller • Interrupt Driven • Compact Code (Only 10 Bytes Interrupt Routine) • Very High Speed • Low Computing Requirement • Supports all AVR Devices Introduction This applica
8-bit RISC Microcontroller Application Note AVR335: Digital Sound Recorder with AVR and Serial DataFlash Features
8-bit RISC Microcontroller Application Note Rev. 1456B–01/04 AVR335: Digital Sound Recorder with AVR and Serial DataFlash Features • Digital Voice Recorder • 8-bit Sound Recording • 8 KHz Sampling Rate • Sound Frequency up to 4000 Hz • Maximum Recording Time 2 1/4 Minutes • Very Small Board Size • O
USB in a Nutshell. Making Sense of the USB Standard.
USB in a Nutshell. Making Sense of the USB Standard. Starting out new with USB can be quite daunting. With the USB 2.0 specification at 650 pages one could easily be put off just by the sheer size of the standard. This is only the beginning of a long list of associated standards for USB. There are U
What is USB Enumeration? What does enumeration look like?
What is USB Enumeration? Enumeration is the process by which a USB device is attached to a system and is assigned a specific numerical address that will be used to access that particular device. It is also the time at which the USB host controller queries the device in order to decide what type of d
Draft
CYCLIC REDUNDANCY CHECKS IN USB Introduction The USB specification calls for the use of Cyclic Redundancy Checksums (CRC) to protect all non-PID fields in token and data packets from errors during transmission. This paper describes the mathematical basis behind CRC in an intuitive fashion and then e
File: X:\USERS\IGOR\DOC\WORD\Atmel\USB to RS232 Application Note\Firmware\USBtoRS232_ATmega8\AVR Studio 4 project\USBtoRS232.asm 1.2.2004
1 ;*************************************************************************** 2 ;* USBSTACKFORTHEAVRFAMILY3;* 4 ;* File Name :"USBtoRS232.asm" 5 ;* Title :AVR309:USB to UART protocol converter 6 ;* Date :01.02.2004 7 ;* Version :2.8 8 ;* Target MCU :ATmega8 9 ;* AUTHOR :Ing. Igor Cesko 10 ;* Slovak
File: X:\USERS\IGOR\DOC\WORD\Atmel\USB to RS232 Application Note\Firmware\USBtoRS232_AT90S2313\AVR Studio 4 project\USB90S2313.asm 26.1.2004
1 ;*************************************************************************** 2 ;* USBSTACKFORTHEAVRFAMILY3;* 4 ;* File Name :"USB90S2313.asm" 5 ;* Title :AVR309:USB to UART protocol converter (simple - small FIFO) 6 ;* Date :26.01.2004 7 ;* Version :2.2 8 ;* Target MCU :AT90S2313-10 9 ;* AUTHOR :I
AVR309: Software Universal Serial Bus (USB)
AVR309: Software Universal Serial Bus (USB) Features • USB (Universal Serial Bus) protocol implemented in firmware • Supports Low Speed USB (1.5Mbit/s) in accordance with USB2.0 • Implementation runs on very small AVR devices, from 2kBytes and up • Few external components required - One resistor for
Application Note
8-bit Microcontrollers Application Note AVR270: USB Mouse Demonstration Features • Runs with AT90USB Microcontrollers at 8MHz • USB Low Power Bus Powered Device (less then 100mA) • Supported by any PC running Windows® (98SE or later), Linux® or Mac OS®. • 3Kbytes of Code Required • X, Y Movement, Le
8-bit Microcontroller Application Note
8-bit Microcontroller Application Note Rev. 2547A–AVR–11/03 AVR244: AVR UART as ANSI Terminal Interface Features • Make use of standard terminal software as user interface to your application. • Enables use of a PC keyboard as input and ascii graphic to display status and control information. • Driv
MPASM USER'S GUIDE with MPLINK and MPLIB MPASM USER'S GUIDE with MPLINK and MPLIB
Adjust Spine to fit MPASM USER'S GUIDE with MPLINK and MPLIB Microchip Technology Inc. 2355 West Chandler Blvd. Chandler, AZ 85224-6199 Tel: 602.786.7200 Fax: 602.899.9210 © 1999 Microchip Technology Inc., Printed in the U.S.A. 3/99 DS33014 MPASM USER'S GUIDE with MPLINK and MPLIB Information only.
Microcontroller Core Features: RA5/SS/AN4 7 34 RB1RE0/RD/AN5 8 33 RB0/INT
Device Pins A/D PSP Pin Diagram PIC16C63A 28 NO NO PDIP, Windowed CERDIP PIC16C73B 28 YES NO MCLR/VPP 1 40 RB7 PIC16C65B 40 NO YES RA0/AN0 2 39 RB6 RA1/AN1 3 38 RB5 PIC16C74B 40 YES YES RA2/AN2 4 37 RB4 RA3/AN3/VREF 5 36 RB3 RA4/T0CKI 6 35 RB2 Microcontroller Core Features: RA5/SS/AN4 7 34 RB1RE0/RD