LCD_driver.h File Reference


Detailed Description

Defines and prototypes for LCD_driver.c.

Application note:
AVR064: A Temperature Monitoring System with LCD Output
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:11:22

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;
#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_status LCD_status


Define Documentation

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

Definition at line 37 of file LCD_driver.h.

Referenced by LCD_Init().

#define LCD_INITIAL_CONTRAST   0x0F
 

Definition at line 28 of file LCD_driver.h.

Referenced by LCD_Init().

#define LCD_REGISTER_COUNT   20
 

Definition at line 30 of file LCD_driver.h.

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

Definition at line 35 of file LCD_driver.h.

Referenced by LCD_update().

#define LCD_TIMER_SEED   15
 

Definition at line 29 of file LCD_driver.h.

Referenced by LCD_SOF_interrupt().

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

Definition at line 36 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 167 of file LCD_driver.c.

References LCD_displayData.

Referenced by LCD_Init(), and LCD_update().

00168 {
00169         unsigned char i;
00170         unsigned char *ptr;
00171 
00172         if( input )                                 // if input == TRUE
00173                 input = 0xFF;                   // set setgemts to 0xFF
00174                                                                 // (else set segments to 0x00)
00175         
00176         ptr = LCD_displayData;
00177         i = 20;
00178         do                                                      // Set all LCD segment register to the variable Segments
00179         {
00180                 *ptr++ = input;         // Set/clear the bits in all LCD registers
00181         } while ( --i );
00182 }

void LCD_Init void   ) 
 

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

Definition at line 96 of file LCD_driver.c.

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

Referenced by Initialization().

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

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 116 of file LCD_driver.c.

References LCD_character_table, and LCD_displayData.

Referenced by LCDscrollMsg(), and LCDwriteData().

00117 {
00118 
00119         unsigned int seg;
00120         unsigned char i;
00121         unsigned char mask, nibble;
00122         unsigned char *ptr;
00123 
00124         //Lookup character table for segmet data
00125         seg = 0x0000;
00126         if ( (c >= '*') && (c <= 'z') )
00127         {
00128                 // c is in character_table.
00129                 // Convert to upper if necessarry.
00130                 if ( c >= 'a' ) c &= ~0x20;
00131                 c -= '*';
00132                 seg = LCD_character_table[c];
00133         }
00134 
00135         // Adjust mask according to digit
00136         mask = 0x0F;            // (1), 3, 5, 7
00137         if ( digit & 0x01 )
00138         {
00139         }
00140         else
00141         {
00142                 mask = 0xF0;            // (0), 2, 4, 6
00143         }
00144 
00145         i = digit-2;
00146         if ( i >= 6 )
00147                 return;
00148         i >>= 1;
00149         ptr = LCD_displayData + i;              // i = {0,0,1,1,2,2}
00150 
00151         i = 4;
00152         do
00153         {
00154                 nibble = seg & 0x000F;
00155                 seg >>= 4;
00156                 if ( digit & 0x01 )
00157                         nibble <<= 4;
00158                 *ptr = (*ptr & mask) | nibble;
00159                 ptr += 5;
00160         } while ( --i );
00161 }


Variable Documentation

unsigned char LCD_displayData[LCD_REGISTER_COUNT]
 

Definition at line 32 of file LCD_driver.c.

union _LCD_status LCD_status
 

Definition at line 29 of file LCD_driver.c.

Referenced by LCD_update().


Generated on Fri Feb 17 12:28:30 2006 for AVR064: A Temperature Monitoring System with LCD Output by  doxygen 1.4.5