LCD_driver.h File Reference


Detailed Description

Defines and prototypes for LCD_driver.c.

Application note:
AVR065: LCD Driver for the STK502
Documentation:
For comprehensive code documentation, supported compilers, compiler settings and supported devices see readme.html
Author:
Atmel Corporation: http://www.atmel.com
Support email: avr@atmel.com
Name
RELEASE_1_1
Revision
1.3
RCSfile
LCD_driver.h,v
Date
2006/02/16 18:14:01

Definition in file LCD_driver.h.

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  _LCD_status

Defines

#define LCD_CONTRAST_LEVEL(level)   LCDCCR=(0x0F & level);
#define LCD_INITIAL_CONTRAST   0x0F
#define LCD_REGISTER_COUNT   20
#define LCD_SET_COLON(active)   LCD_displayData[8]=active;
 active =[TRUE;FALSE]
#define LCD_TIMER_SEED   15
#define pLCDREG   (*(unsigned char *)(0xEC))

Functions

void LCD_AllSegments (unsigned char)
 display all or hide all LCD segments on the STK502 LCD.
void LCD_Init (void)
 Initialize LCD_displayData buffer. Set up the LCD (timing, contrast, etc.).
void LCD_WriteDigit (unsigned char input, unsigned char digit)
 Stores LCD control data in the LCD_displayData buffer. (The LCD_displayData is latched in the LCD_SOF interrupt).

Variables

unsigned char LCD_displayData [LCD_REGISTER_COUNT]
 LCD display buffer (for double buffering).
_LCD_status LCD_status
 LCD_status = {0, 0, 0, 0, 0, 0, FALSE, TRUE};.
unsigned char LCD_timer
 Determine the delay to next LCD update.


Define Documentation

#define LCD_CONTRAST_LEVEL level   )     LCDCCR=(0x0F & level);
 

Definition at line 36 of file LCD_driver.h.

Referenced by LCD_Init(), and main().

#define LCD_INITIAL_CONTRAST   0x0F
 

Definition at line 27 of file LCD_driver.h.

Referenced by LCD_Init().

#define LCD_REGISTER_COUNT   20
 

Definition at line 29 of file LCD_driver.h.

#define LCD_SET_COLON active   )     LCD_displayData[8]=active;
 

active =[TRUE;FALSE]

Definition at line 34 of file LCD_driver.h.

Referenced by main().

#define LCD_TIMER_SEED   15
 

Definition at line 28 of file LCD_driver.h.

Referenced by LCD_SOF_interrupt().

#define pLCDREG   (*(unsigned char *)(0xEC))
 

Definition at line 35 of file LCD_driver.h.

Referenced by LCD_SOF_interrupt().


Function Documentation

void LCD_AllSegments unsigned char  input  ) 
 

display all or hide all LCD segments on the STK502 LCD.

Parameters:
input - [TRUE;FALSE]=[DISPLAY;HIDE].

Definition at line 176 of file LCD_driver.c.

References LCD_displayData.

Referenced by LCD_Init().

00177 {
00178         unsigned char i;
00179         unsigned char *ptr;
00180 
00181         if( input )                                 // if input == TRUE
00182                 input = 0xFF;                   // set setgemts to 0xFF
00183                                                                 // (else set segments to 0x00)
00184         
00185         ptr = LCD_displayData;
00186         i = 20;
00187         do                                                      // Set all LCD segment register to the variable ucSegments
00188         {
00189                 *ptr++ = input;         // Set/clear the bits in all LCD registers
00190         } while ( --i );
00191 }

void LCD_Init void   ) 
 

Initialize LCD_displayData buffer. Set up the LCD (timing, contrast, etc.).

Definition at line 98 of file LCD_driver.c.

References FALSE, LCD_AllSegments(), LCD_CONTRAST_LEVEL, and LCD_INITIAL_CONTRAST.

Referenced by main().

00099 {
00100         LCD_AllSegments( FALSE );       // Clear segment buffer.
00101         LCDCRA = (1<<LCDEN);            // Enable LCD.
00102 
00103     LCD_CONTRAST_LEVEL(LCD_INITIAL_CONTRAST);    //Set the LCD contrast level
00104 
00105         // Select asynchronous clock source, enable all COM pins and enable all segment pins.
00106         LCDCRB = (1<<LCDCS) | (1<<LCDMUX1) | (1<<LCDMUX0) | (1<<LCDPM2) | (1<<LCDPM1)| (1<<LCDPM0);
00107         LCDFRR = (1<<LCDPS0);                       // Set LCD prescaler to CLK(lcd)/64 = 64Hz.
00108 
00109         LCDCRA |= (1<<LCDIE);                       //Enable LCD_Start_frame interrupt
00110 }

Here is the call graph for this function:

void LCD_WriteDigit unsigned char  c,
unsigned char  digit
 

Stores LCD control data in the LCD_displayData buffer. (The LCD_displayData is latched in the LCD_SOF interrupt).

Parameters:
c - The symbol to be displayed in a LCD digit.
digit - The LCD digit that the symbol should be displayed in.

Definition at line 119 of file LCD_driver.c.

References LCD_character_table, and LCD_displayData.

Referenced by main().

00120 {
00121 
00122         unsigned int seg;
00123         unsigned char i;
00124         unsigned char mask, nibble;
00125         unsigned char *ptr;
00126 
00127         //Lookup character table for segmet data
00128         seg = 0x0000;
00129         if ( (c >= '*') && (c <= 'z') )
00130         {
00131                 // c is in character_table.
00132                 // Convert to upper if necessarry.
00133                 if ( c >= 'a' ) c &= ~0x20;
00134                 c -= '*';
00135                 seg = LCD_character_table[c];
00136         }
00137         else
00138         {
00139                 return;         //ASCII code out of range
00140         }
00141 
00142         // Adjust mask according to digit
00143         mask = 0x0F;            // (1), 3, 5, 7
00144         if ( digit & 0x01 )
00145         {
00146                 //left empty to optimize code size
00147         }
00148         else
00149         {
00150                 mask = 0xF0;            // (0), 2, 4, 6
00151         }
00152 
00153         i = digit-2;            //i used as pointer offset
00154         if ( i >= 6 )           //Test if LCD digit is out of range
00155                 return;
00156         i >>= 1;
00157         ptr = LCD_displayData + i;      // Point to the first relevant LCDDR; i = {0,0,1,1,2,2}
00158 
00159         i = 4;                  //i used as loop counter
00160         do
00161         {
00162                 nibble = seg & 0x000F;
00163                 seg >>= 4;
00164                 if ( digit & 0x01 )
00165                         nibble <<= 4;
00166                 *ptr = (*ptr & mask) | nibble;
00167                 ptr += 5;
00168         } while ( --i );
00169 }


Variable Documentation

unsigned char LCD_displayData[LCD_REGISTER_COUNT]
 

LCD display buffer (for double buffering).

Definition at line 34 of file LCD_driver.c.

Referenced by LCD_AllSegments(), LCD_SOF_interrupt(), and LCD_WriteDigit().

union _LCD_status LCD_status
 

LCD_status = {0, 0, 0, 0, 0, 0, FALSE, TRUE};.

Definition at line 31 of file LCD_driver.c.

Referenced by LCD_timerDelay(), and main().

unsigned char LCD_timer
 

Determine the delay to next LCD update.

Definition at line 32 of file LCD_driver.c.

Referenced by LCD_SOF_interrupt(), and LCD_timerDelay().


Generated on Fri Feb 17 12:31:58 2006 for AVR065: LCD Driver for the STK502 by  doxygen 1.4.5