main.c File Reference


Detailed Description

Example of how to use the LCD_driver for STK504.

Application note:
AVR063: LCD Driver for the STK504
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.4
RCSfile
main.c,v
Date
2006/02/16 18:04:59

Definition in file main.c.

#include "stk504_lcd.h"
#include "defines.h"
#include <inavr.h>
#include <iom3290.h>

Include dependency graph for main.c:

Go to the source code of this file.

Defines

#define DELAY1   30
#define DELAY2   5

Functions

void LCD_timerDelay (unsigned char delay)
 Generate a delay that depends on the LCD clock rather than the system clock.
void main (void)


Define Documentation

#define DELAY1   30
 

Definition at line 49 of file main.c.

Referenced by main().

#define DELAY2   5
 

Definition at line 50 of file main.c.


Function Documentation

void LCD_timerDelay unsigned char  delay  ) 
 

Generate a delay that depends on the LCD clock rather than the system clock.

Parameters:
delay - number of LCD frames to delay the subsequent code execution.

Definition at line 36 of file main.c.

References FALSE, LCD_status, LCD_timer, TRUE, _LCD_status::updateComplete, and _LCD_status::updateRequired.

Referenced by main().

00040 {
00041   __disable_interrupt();
00042   LCD_timer = delay;                          //Plant LCD_timer seed to generate delay - delay*(1/[LCD frame rate])
00043   LCD_status.updateComplete = FALSE;          //Clear updateComplete to be able to test if LCD interrupt has been served
00044   LCD_status.updateRequired = TRUE;           //Request update of the LCD to let the LCD ISR clear set updateComplete
00045   __enable_interrupt();
00046   while( !LCD_status.updateComplete );        //Don't update the LCD_displayData into LCD has been updated
00047 }

void main void   ) 
 

Definition at line 52 of file main.c.

References DELAY1, FALSE, LCD_BarSeg(), LCD_init(), LCD_PutChar(), LCD_SetSeg(), LCD_status, LCD_timerDelay(), S10, S11, S9, TRUE, _LCD_status::updateComplete, and _LCD_status::updateRequired.

00053 {
00054   unsigned char counter, n;
00055   unsigned char testString[] = "STK504";
00056 
00057   LCD_init();
00058   __enable_interrupt();
00059 
00060   for(;;)
00061   {
00062     //----------------------------------------------------------
00063     // Display the teststring on the LCD display
00064     //----------------------------------------------------------
00065     while( !LCD_status.updateComplete );        //Don't update the LCD_displayData into LCD has been updated
00066     LCD_status.updateRequired = FALSE;          //Block the updating of the LCD while accessing LCD_displayData
00067 
00068     for (counter = 0; counter < 6; counter++ )
00069     {
00070       LCD_PutChar( *(testString + counter), counter + 1 ); //Write new data to LCD_displayData
00071     }
00072     LCD_status.updateComplete = FALSE;          //Clear LCD_updateComplete flag to indicate that LCDdisplayData
00073                                                 // has been updated, but LCD has not been updated yet.
00074     LCD_status.updateRequired = TRUE;           //Request update of the LCD (release LCD update blocking).
00075     while( !LCD_status.updateComplete );
00076 
00077     //----------------------------------------------------------
00078     // Battery charging display test
00079     //----------------------------------------------------------
00080     LCD_SetSeg( S9, 1 );           // Show the Battery Symbol
00081     LCD_SetSeg( S10, 1 );
00082     LCD_SetSeg( S11, 1 );
00083 
00084 
00085     n=1;
00086     for(counter = 0; counter < 8; counter++)
00087     {
00088       LCD_BarSeg(n);
00089       n = (n << 1) + 1;
00090       LCD_status.updateRequired = TRUE;
00091       LCD_timerDelay(DELAY1);
00092     }
00093   }
00094 }

Here is the call graph for this function:


Generated on Fri Feb 17 11:16:39 2006 for AVR063 LCD Driver for the STK504 by  doxygen 1.4.5