VLSI Solution Oy VS1103 VLSI Solution Karaoke, MIDI and ADPCM Player Source Code Documentation

Main Page | Class List | File List | Class Members | File Members | Related Pages

lcd.h File Reference

LCD functions. More...

#include "console.h"
#include "lcdfonts.h"

Include dependency graph for lcd.h:

Include dependency graph

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

Included by dependency graph

Go to the source code of this file.

Defines

#define ROM_CHAR_PTR   code char*
#define LcdLocateHome()   {LcdPutCommand (128);InitiateDelay(39);}
 Low level: Move LCD Cursor to start of the first line.
#define LcdLocateLine2()   {LcdPutCommand (168);InitiateDelay(39);}
 Low level: Move LCD Cursor to start of the second line.
#define LcdLocateCG()   {LcdPutCommand (64);InitiateDelay(39);}
 Low level: Point to start of LCD Character Generator RAM.

Functions

void LcdSelectFont (ROM_CHAR_PTR font)
void LcdPutChar (char c)
 Low level: Send one data character to LCD.
void LcdPutCommand (char cmd)
 Low level: Send one command octet to LCD.
void LcdReset ()
 Low level: Reset LCD.
void LcdPutString (char *str)
 Low level: Send a zero-terminated string of bytes to lcd from buffer in any memory.
void LcdPutConstantString (char code *str)
 Low level: Send a zero-terminated string of bytes to lcd from buffer in ROM.
void LcdSplashScreen ()
 Splash screen.
void LcdPutHex8 (unsigned char value)
 Print an 8-bit hex value on LCD.
void LcdPutHex16 (unsigned int value)
 Print a 16-bit hex value on LCD.
unsigned char LcdPrintGenericResult (unsigned char errorlevel)
 Print OK or Error (hex8) on LCD.
void LcdPutUInt (unsigned long value)
 Print a 16-bit unsigned integer value on LCD.

Variables

code const unsigned char lcd_hexchars [17]
 hexadecimal character set


Detailed Description

LCD functions.

Definition in file lcd.h.


Define Documentation

 
#define LcdLocateCG  )     {LcdPutCommand (64);InitiateDelay(39);}
 

Low level: Point to start of LCD Character Generator RAM.

Definition at line 23 of file lcd.h.

Referenced by LcdSelectFont().

 
#define LcdLocateHome  )     {LcdPutCommand (128);InitiateDelay(39);}
 

Low level: Move LCD Cursor to start of the first line.

Definition at line 17 of file lcd.h.

Referenced by InitFileSystem(), LcdSelectFont(), LcdSplashScreen(), main(), and UpdateDisplay().

 
#define LcdLocateLine2  )     {LcdPutCommand (168);InitiateDelay(39);}
 

Low level: Move LCD Cursor to start of the second line.

Definition at line 20 of file lcd.h.

Referenced by LcdSplashScreen(), main(), MessageBox(), and UpdateDisplay().

#define ROM_CHAR_PTR   code char*
 

Definition at line 11 of file lcd.h.

Referenced by LcdSelectFont().


Function Documentation

unsigned char LcdPrintGenericResult unsigned char  errorlevel  ) 
 

Print OK or Error (hex8) on LCD.

Definition at line 189 of file lcd.c.

References ConsolePutHex8, ConsoleWrite, Delay(), lcd_hexchars, LcdPutChar(), and LcdPutConstantString().

00189                                                               {
00190   if (!errorlevel){        
00191     LcdPutConstantString ("OK      ");
00192   }else{
00193     LcdPutConstantString ("Error ");
00194     LcdPutChar(lcd_hexchars[(errorlevel>>4)&0xf]);
00195     LcdPutChar(lcd_hexchars[(errorlevel)&0xf]);
00196     ConsoleWrite ("\rSystem error ");
00197     ConsolePutHex8 (errorlevel);
00198     ConsoleWrite (": \"");
00199 
00200     switch (errorlevel){
00201     case 0x01: ConsoleWrite ("No storage"); break;
00202     case 0x02: ConsoleWrite ("Storage powerup"); break;
00203     case 0x03: ConsoleWrite ("Storage init"); break;
00204     case 0x04: ConsoleWrite ("No storage ID"); break;
00205     case 0x05: ConsoleWrite ("Datablock header"); break;
00206     case 0x06: ConsoleWrite ("Storage Data reply failed"); break;
00207     case 0x07: ConsoleWrite ("Generic Storage Command"); break;
00208     case 0x08: ConsoleWrite ("Sector 0 not in recognized format"); break;
00209     case 0x09: ConsoleWrite ("No active partition"); break;
00210     case 0x0a: ConsoleWrite ("Filesystem load"); break;
00211     case 0x0b: ConsoleWrite ("No root directory"); break;
00212     case 0x0c: ConsoleWrite ("File not found"); break;
00213 
00214     };
00215     ConsoleWrite("\" failure.\r");
00216     
00217 
00218     Delay(500);
00219   }
00220   return errorlevel;
00221 }

Here is the call graph for this function:

void LcdPutChar char  c  ) 
 

Low level: Send one data character to LCD.

Parameters:
c Octet to be sent to LCD

Definition at line 17 of file lcd.c.

References InitiateDelay, LCD_DATABUS, LCD_ENABLE, LCD_RS, and WaitOutDelay.

Referenced by LcdPrintGenericResult(), LcdPutConstantString(), LcdPutHex16(), LcdPutHex8(), LcdPutString(), LcdPutUInt(), LcdSplashScreen(), and UpdateDisplay().

00017                         {
00018   //PlayerTaskHandler();
00019   WaitOutDelay();
00020   LCD_RS = LCD_DATA_MODE;
00021   LCD_DATABUS = c;
00022   LCD_ENABLE = 1; /* Rising edge */
00023   LCD_ENABLE = 1; /* Keep high...*/
00024   LCD_ENABLE = 0; /* Falling edge */
00025   InitiateDelay(84);
00026 }

void LcdPutCommand char  cmd  ) 
 

Low level: Send one command octet to LCD.

Parameters:
cmd Command octet to be sent to LCD

Definition at line 34 of file lcd.c.

References InitiateDelay, LCD_DATABUS, LCD_ENABLE, LCD_RS, and WaitOutDelay.

Referenced by LcdFadeIn(), LcdFadeOut(), and LcdReset().

00034                             {
00035   //PlayerTaskHandler();
00036   WaitOutDelay();
00037   LCD_RS = LCD_COMMAND_MODE;
00038   LCD_DATABUS = cmd;
00039   LCD_ENABLE = 1; /* Rising edge */
00040   LCD_ENABLE = 1; /* Keep High */
00041   LCD_ENABLE = 0; /* Falling edge */
00042   InitiateDelay(84);
00043 }

void LcdPutConstantString char code *  str  ) 
 

Low level: Send a zero-terminated string of bytes to lcd from buffer in ROM.

Example: LcdPutConstantString ("Hello!");

Parameters:
*str pointer to a zero-terminated string in code ROM.

Definition at line 106 of file lcd.c.

References LcdPutChar().

Referenced by InitFileSystem(), LcdPrintGenericResult(), LcdSelectFont(), LcdSplashScreen(), main(), MessageBox(), and UpdateDisplay().

00106                                          {
00107   while (*str)
00108     {
00109       LcdPutChar (*str++);
00110     }
00111 }

Here is the call graph for this function:

void LcdPutHex16 unsigned int  value  ) 
 

Print a 16-bit hex value on LCD.

Definition at line 172 of file lcd.c.

References lcd_hexchars, and LcdPutChar().

00172                                      {
00173   LcdPutChar(lcd_hexchars[value>>12]);
00174   LcdPutChar(lcd_hexchars[(value>>8)&0xf]);
00175   LcdPutChar(lcd_hexchars[(value>>4)&0xf]);
00176   LcdPutChar(lcd_hexchars[(value)&0xf]);
00177 }

Here is the call graph for this function:

void LcdPutHex8 unsigned char  value  ) 
 

Print an 8-bit hex value on LCD.

Definition at line 181 of file lcd.c.

References lcd_hexchars, and LcdPutChar().

00181                                      {
00182 
00183   LcdPutChar(lcd_hexchars[(value>>4)&0xf]);
00184   LcdPutChar(lcd_hexchars[(value)&0xf]);
00185 }

Here is the call graph for this function:

void LcdPutString char *  str  ) 
 

Low level: Send a zero-terminated string of bytes to lcd from buffer in any memory.

Example: LcdPutString (s);

Parameters:
*str pointer to a zero-terminated string in idata segment
Warning:
Do not call for const type strings in the ROM!

Definition at line 93 of file lcd.c.

References LcdPutChar().

Referenced by MessageBox().

00093                               {
00094   while (*str) {
00095     LcdPutChar (*str++);
00096   }
00097 }

Here is the call graph for this function:

void LcdPutUInt unsigned long  value  ) 
 

Print a 16-bit unsigned integer value on LCD.

Definition at line 225 of file lcd.c.

References LcdPutChar().

00225                                     {
00226   xdata unsigned char valueString[10];
00227   char c;
00228   for (c=0; c<10; c++){
00229     valueString[c]=value % 10;
00230     value = value / 10;
00231   }
00232   c=9;
00233   while ((valueString[c]==0) && (c!=0))
00234     c--;
00235   for (;c!=0;c--)
00236     LcdPutChar('0'+valueString[c]);
00237   LcdPutChar('0'+valueString[0]);
00238 
00239 }

Here is the call graph for this function:

void LcdReset  ) 
 

Low level: Reset LCD.

Definition at line 60 of file lcd.c.

References InitiateDelay, LCD_ENABLE, lcdFont_barchars, LcdPutCommand(), LcdSelectFont(), and WaitOutDelay.

Referenced by AvailableProcessorTime(), InitFileSystem(), LcdSplashScreen(), main(), and MessageBox().

00060                {
00061 
00062 
00063   LCD_ENABLE = 0;
00064   InitiateDelay(0); /* Initialize the delay system */
00065 
00066   LcdPutCommand(56); /* 8 data bits, 2 lines */
00067   InitiateDelay(139);
00068 
00069   WaitOutDelay();
00070   LcdPutCommand(56); /* Command 2 times "just in case" */
00071   InitiateDelay(139);
00072 
00073   WaitOutDelay();
00074   LcdPutCommand(12); /* Panel on, no cursor */
00075   InitiateDelay(139);
00076 
00077   WaitOutDelay();
00078   LcdPutCommand(1);  /* Clear screen */
00079   InitiateDelay(2530); /* Start a 1.53 ms delay */
00080 
00081   LcdSelectFont(lcdFont_barchars);
00082 
00083 }

Here is the call graph for this function:

void LcdSelectFont ROM_CHAR_PTR  font  ) 
 

Definition at line 47 of file lcd.c.

References LcdLocateCG, LcdLocateHome, LcdPutConstantString(), and ROM_CHAR_PTR.

Referenced by LcdReset(), and LcdSplashScreen().

00047                                      {
00048   static ROM_CHAR_PTR loadedFont = 0;
00049   if (loadedFont != font){
00050     loadedFont=font;
00051     
00052     LcdLocateCG();
00053     LcdPutConstantString(font);  
00054     LcdLocateHome();
00055    
00056   }
00057 }

Here is the call graph for this function:

void LcdSplashScreen  ) 
 

Splash screen.

Definition at line 151 of file lcd.c.

References LcdFadeIn(), LcdFadeOut(), lcdFont_vlsichars, LcdLocateHome, LcdLocateLine2, LcdPutChar(), LcdPutConstantString(), LcdReset(), and LcdSelectFont().

00151                       {
00152     
00153   LcdReset();
00154  
00155   LcdSelectFont(lcdFont_vlsichars);
00156   
00157   LcdLocateHome();
00158   
00159   LcdPutChar(0);
00160   LcdPutConstantString("\1\2\3 Sol");
00161   LcdLocateLine2();
00162   LcdPutConstantString("ution Oy");
00163 
00164  
00165   LcdFadeIn();
00166   LcdFadeOut();
00167  
00168 }

Here is the call graph for this function:


Variable Documentation

code const unsigned char lcd_hexchars[17]
 

hexadecimal character set

Definition at line 11 of file lcd.c.

Referenced by LcdPrintGenericResult(), LcdPutHex16(), and LcdPutHex8().


All software copyright 2000-2004 VLSI Solution OY. Redistribution of these software modules is limited to VLSI Solution Oy chip promotional use only. Free or commercial use of these software modules in MP3 players is ok if the product includes chip(s) from VLSI. You can request the complete (compilable) package from mp3@vlsi.fi. This exampe code is provided with good faith to assist You in code development, but under no circumstances will VLSI offer any guarantees on the usability or functionality of any example software or its fitness for any purpose.