main.c

Go to the documentation of this file.
00001 /* This file has been prepared for Doxygen automatic documentation generation.*/
00025 //  Include files
00026 #include "stk504_lcd.h"
00027 #include "defines.h"
00028 #include <inavr.h>
00029 #include <iom3290.h>
00030 
00031 /******************************************************************************************
00032 *
00033 *   Function name:  LCD_timerDelay( unsigned char delay )
00034 *
00035 ******************************************************************************************/
00036 void LCD_timerDelay( unsigned char delay )
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 }
00048 
00049 #define DELAY1 30
00050 #define DELAY2 5
00051 
00052 void main(void)
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 }
00095 

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