📄 drv_l1f90009.c
字号:
/************************************************************************
* *
* Copyright (C) SEIKO EPSON CORP. 2002 *
* *
* File name: Drv_L1F90009.c *
* This is Epson L1F90009 LCD driver for Epson E0C33000 platform.*
* *
* *
* Revision history *
* 2002-8-6 Andrew Yin Start. *
* *
************************************************************************/
#include "main.h"
unsigned char ASCIIchar[ ] = /* 8*8 dot matrix ASCII Character (Rotate 90 degree)*/
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* ASCII "SPACE" Decimal:32 Hexadecimal:20 */
0x00,0x00,0x00,0x5f,0x00,0x00,0x00,0x00,
0x00,0x00,0x07,0x00,0x07,0x00,0x00,0x00,
0x00,0x14,0x7f,0x14,0x7f,0x14,0x00,0x00,
0x00,0x24,0x2a,0x7f,0x2a,0x12,0x00,0x00,
0x00,0x23,0x13,0x08,0x64,0x62,0x00,0x00,
0x00,0x36,0x49,0x55,0x22,0x50,0x00,0x00,
0x00,0x00,0x05,0x03,0x00,0x00,0x00,0x00,
0x00,0x00,0x1c,0x22,0x41,0x00,0x00,0x00,
0x00,0x00,0x41,0x22,0x1c,0x00,0x00,0x00,
0x00,0x14,0x08,0x3e,0x08,0x14,0x00,0x00,
0x00,0x08,0x08,0x3e,0x08,0x08,0x00,0x00,
0x00,0x00,0x50,0x30,0x00,0x00,0x00,0x00,
0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00,
0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,
0x00,0x20,0x10,0x08,0x04,0x02,0x00,0x00,
0x00,0x3E,0x51,0x49,0x45,0x3E,0x00,0x00, /* 0 */
0x00,0x00,0x42,0x7f,0x40,0x00,0x00,0x00,
0x00,0x42,0x61,0x51,0x49,0x46,0x00,0x00,
0x00,0x21,0x41,0x45,0x4b,0x31,0x00,0x00,
0x00,0x18,0x14,0x12,0x7f,0x10,0x00,0x00,
0x00,0x27,0x45,0x45,0x45,0x39,0x00,0x00,
0x00,0x3C,0x4A,0x49,0x49,0x30,0x00,0x00,
0x00,0x01,0x01,0x79,0x05,0x03,0x00,0x00,
0x00,0x36,0x49,0x49,0x49,0x36,0x00,0x00,
0x00,0x06,0x49,0x49,0x29,0x1e,0x00,0x00, /* 9 */
0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00,
0x00,0x00,0x56,0x36,0x00,0x00,0x00,0x00,
0x00,0x08,0x14,0x22,0x41,0x00,0x00,0x00,
0x00,0x14,0x14,0x14,0x14,0x14,0x00,0x00,
0x00,0x00,0x41,0x22,0x14,0x08,0x00,0x00,
0x00,0x02,0x01,0x51,0x09,0x06,0x00,0x00,
0x00,0x32,0x49,0x79,0x41,0x3e,0x00,0x00,
0x00,0x7e,0x11,0x11,0x11,0x7e,0x00,0x00, /* A */
0x00,0x41,0x7f,0x49,0x49,0x36,0x00,0x00,
0x00,0x3e,0x41,0x41,0x41,0x22,0x00,0x00,
0x00,0x41,0x7f,0x41,0x41,0x3e,0x00,0x00,
0x00,0x7f,0x49,0x49,0x49,0x49,0x00,0x00,
0x00,0x7f,0x09,0x09,0x09,0x01,0x00,0x00,
0x00,0x3e,0x41,0x41,0x49,0x7a,0x00,0x00,
0x00,0x7f,0x08,0x08,0x08,0x7f,0x00,0x00,
0x00,0x00,0x41,0x7f,0x41,0x00,0x00,0x00,////////////////////////////////I
0x00,0x20,0x40,0x41,0x3f,0x01,0x00,0x00,
0x00,0x7f,0x08,0x14,0x22,0x41,0x00,0x00,
0x00,0x7f,0x40,0x40,0x40,0x40,0x00,0x00,
0x00,0x7f,0x02,0x0c,0x02,0x7f,0x00,0x00,
0x00,0x7f,0x06,0x08,0x30,0x7f,0x00,0x00,
0x00,0x3e,0x41,0x41,0x41,0x3e,0x00,0x00,
0x00,0x7f,0x09,0x09,0x09,0x06,0x00,0x00,
0x00,0x3e,0x41,0x51,0x21,0x5e,0x00,0x00,
0x00,0x7f,0x09,0x19,0x29,0x46,0x00,0x00,
0x00,0x26,0x49,0x49,0x49,0x32,0x00,0x00,
0x00,0x01,0x01,0x7f,0x01,0x01,0x00,0x00,
0x00,0x3f,0x40,0x40,0x40,0x3f,0x00,0x00,
0x00,0x1f,0x20,0x40,0x20,0x1f,0x00,0x00,
0x00,0x7f,0x20,0x18,0x20,0x7f,0x00,0x00,
0x00,0x63,0x14,0x08,0x14,0x63,0x00,0x00,
0x00,0x07,0x08,0x70,0x08,0x07,0x00,0x00,
0x00,0x61,0x51,0x49,0x45,0x43,0x00,0x00, /* Z */
0x00,0x00,0x7f,0x41,0x41,0x00,0x00,0x00,
0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x00,
0x00,0x00,0x41,0x41,0x7f,0x00,0x00,0x00,
0x00,0x04,0x02,0x01,0x02,0x04,0x00,0x00,
0x00,0x40,0x40,0x40,0x40,0x40,0x00,0x00,
0x00,0x01,0x02,0x04,0x00,0x00,0x00,0x00,
0x00,0x20,0x54,0x54,0x54,0x78,0x00,0x00, /* a */
0x00,0x7f,0x48,0x44,0x44,0x38,0x00,0x00,
0x00,0x38,0x44,0x44,0x44,0x20,0x00,0x00,
0x00,0x38,0x44,0x44,0x48,0x7f,0x00,0x00,
0x00,0x38,0x54,0x54,0x54,0x18,0x00,0x00,//e
0x00,0x00,0x08,0x7e,0x09,0x02,0x00,0x00,
0x00,0x0c,0x52,0x52,0x4c,0x3e,0x00,0x00,//g
0x00,0x7f,0x08,0x04,0x04,0x78,0x00,0x00,
0x00,0x00,0x44,0x7d,0x40,0x00,0x00,0x00,
0x00,0x20,0x40,0x44,0x3d,0x00,0x00,0x00,
0x00,0x00,0x7f,0x10,0x28,0x44,0x00,0x00,
0x00,0x00,0x41,0x7f,0x40,0x00,0x00,0x00,//l
0x00,0x7c,0x04,0x78,0x04,0x78,0x00,0x00,
0x00,0x7c,0x08,0x04,0x04,0x78,0x00,0x00,
0x00,0x38,0x44,0x44,0x44,0x38,0x00,0x00,
0x00,0x7e,0x0c,0x12,0x12,0x0c,0x00,0x00,
0x00,0x0c,0x12,0x12,0x0c,0x7e,0x00,0x00,
0x00,0x7c,0x08,0x04,0x04,0x08,0x00,0x00,
0x00,0x48,0x54,0x54,0x54,0x20,0x00,0x00,
0x00,0x04,0x3f,0x44,0x40,0x20,0x00,0x00,
0x00,0x3c,0x40,0x40,0x3c,0x40,0x00,0x00,
0x00,0x1c,0x20,0x40,0x20,0x1c,0x00,0x00,
0x00,0x3c,0x40,0x30,0x40,0x3c,0x00,0x00,
0x00,0x44,0x28,0x10,0x28,0x44,0x00,0x00,
0x00,0x0c,0x50,0x50,0x50,0x3c,0x00,0x00,
0x00,0x44,0x64,0x54,0x4c,0x44,0x00,0x00, /* z */
0x00,0x00,0x08,0x36,0x41,0x00,0x00,0x00,
0x00,0x00,0x00,0x77,0x00,0x00,0x00,0x00,
0x00,0x00,0x41,0x36,0x08,0x00,0x00,0x00,
0x00,0x02,0x01,0x02,0x04,0x02,0x00,0x00,
0x00,0xff,0xff,0xff,0xff,0xff,0x00,0x00
};
void vInitLCDL1F90009( void );
void vL1F90009Clr( void );
void vL1F90009DrawHrzntlLine( unsigned char ucY, unsigned char ucStartPoint,
unsigned char ucLength ); //display a horizontal line
void vL1F90009DrawVrtclLine( unsigned char ucX, unsigned char ucStartPoint,
unsigned char ucLength ); //display a vertical line
void vL1F90009DrawASCII( unsigned char ucASCIIX, unsigned char ucASCIIY, unsigned char ASCII );
void vL1F90009DrawString( unsigned char ucASCIIX, unsigned char ucASCIIY, unsigned char *string );
static void vPageSet( unsigned char ucPage );
static void vColumnSet( unsigned char ucColumn );
void vDrawCheckPatten( void );
void vDemo( void );
void delay( void );
/***********************************************************************************************
* vInitLCDL1F90009
* Type : void
* Ret val : none
* Argument : void
* Function : L1F90009 LCD initial routine
***********************************************************************************************/
void vInitLCDL1F90009( void )
{
*( volatile unsigned char *)LCDCOMMAND = 0x0E1; // POWER SAVE OFF
*( volatile unsigned char *)LCDCOMMAND = 0x0A1; // ADC = 1
*( volatile unsigned char *)LCDCOMMAND = 0x0C8; // COM Reverse
*( volatile unsigned char *)LCDCOMMAND = 0x0A6; // Display normal
*( volatile unsigned char *)LCDCOMMAND = 0x0A4; // Turn off the lit up all dot off
*( volatile unsigned char *)LCDCOMMAND = 0x078; // Duty = 100
*( volatile unsigned char *)LCDCOMMAND = 0x00; // Start block = 0
*( volatile unsigned char *)LCDCOMMAND = 0x81; // Electronic volume mode set
*( volatile unsigned char *)LCDCOMMAND = 0x41; // SET ELECTRONIC VOLUME REGISTER to middle level
*( volatile unsigned char *)LCDCOMMAND = 0x40; // Set temperature gradient
*( volatile unsigned char *)LCDCOMMAND = 0x32; // n line invert = 16 line invert
*( volatile unsigned char *)LCDCOMMAND = 0x54; // set frame frequency to middle level:40KHZ
*( volatile unsigned char *)LCDCOMMAND = 0x0AB; // turn on internal CR
*( volatile unsigned char *)LCDCOMMAND = 0x27; // Turn on all the power device
*( volatile unsigned char *)LCDCOMMAND = 0x8A; // Set the display start line
*( volatile unsigned char *)LCDCOMMAND = 0x00; // Start line=00
*( volatile unsigned char *)LCDCOMMAND = 0x0AF; // Display ON
*( volatile unsigned char *)LCDCOMMAND = 0x0E6; // n line polarity = b mode
*( volatile unsigned char *)LCDCOMMAND = 0x27; // power control set
vDemo( );
loop:
goto loop;
}
/*******************************************************************************************
* vL1F90009DrawASCII
* Type: void
* Ret val:none
* Argument:unsigned char ucASCIIX: the No. of LCD's column ( ucASCIIX:0~15 )
* unsigned char ucASCIIY: the No. of LCD's line ( ucASCIIY:0~11 )
* unsigned char ASCII: the ASCII table lib
* the LCD is 128 * 96
* Function: Draw a ASCII on the LCD.
*******************************************************************************************/
void vL1F90009DrawASCII( unsigned char ucASCIIX, unsigned char ucASCIIY, unsigned char ASCII )
{
unsigned char i, ucPage;
vPageSet( ucASCIIY );
vColumnSet( ucASCIIX * 8 );
for( i = 0; i < 8; i++ )
*( volatile unsigned char *)LCDDATA = *( ASCIIchar + ( ASCII - 0x20 ) * 8 + i );
}
/*******************************************************************************************
* vL1F90009DrawString
* Type: void
* Ret val:none
* Argument:unsigned char ucASCIIX: the No. of LCD's column ( ucASCIIX:0~15 )
* unsigned char ucASCIIY: the No. of LCD's line ( ucASCIIY:0~11 )
* unsigned char *string: the point to the string that want to be display
* the LCD is 128 * 96
* Function: Draw a string on the LCD.
*******************************************************************************************/
void vL1F90009DrawString( unsigned char ucASCIIX, unsigned char ucASCIIY, unsigned char *string )
{
unsigned char i, j;
for( i = 0; *string != '\0'; i++ )
{
vL1F90009DrawASCII( ucASCIIX, ucASCIIY, *string++ );
if( ucASCIIX != 15 )
ucASCIIX++;
else
{
ucASCIIX = 0;
ucASCIIY++;
}
}
}
/***********************************************************************************************
* vL1F90009DrawHrzntlLine
* Type : void
* Ret val : none
* Argument : unsigned char ucY: range:0~95
* unsigned char ucStartPoint: range:0~127
* unsigned char ucLength: range:8~128
* Function : Draw a Horizontal line
***********************************************************************************************/
void vL1F90009DrawHrzntlLine( unsigned char ucY, unsigned char ucStartPoint, unsigned char ucLength )
{
unsigned char i, ucPage;
vPageSet( ucY / 8 );
vColumnSet( ucStartPoint );
for( i = 0; i < ucLength; i++ )
*( volatile unsigned char *)LCDDATA = 0x01 << ( ucY - ( ucY / 8 ) * 8 );
}
/***********************************************************************************************
* vL1F90009DrawVrtclLine
* Type : void
* Ret val : none
* Argument : unsigned char ucX: range:0~127
* unsigned char ucStartPoint: range:0~95
* unsigned char ucLength: range:8~96
* Function : Draw a vertical line
***********************************************************************************************/
void vL1F90009DrawVrtclLine( unsigned char ucX, unsigned char ucStartPoint, unsigned char ucLength )
{
unsigned char i, ucPage;
for( ucPage = ucStartPoint / 8; ucPage < ( ucStartPoint + ucLength ) / 8; ucPage++ )
{
vPageSet( ucPage );
vColumnSet( ucX );
*( volatile unsigned char *)LCDDATA = 0x0FF;
}
}
/***********************************************************************************************
* vL1F90009Clr
* Type : void
* Ret val : none
* Argument : void
* Function : Clear the L1F90009 LCD screen
***********************************************************************************************/
void vL1F90009Clr( void )
{
unsigned char i, ucPage;
for( ucPage = 0; ucPage < 13; ucPage++ )
{
vPageSet( ucPage );
vColumnSet( 0 );
for( i = 0; i < 128; i++ )
*( volatile unsigned char *)LCDDATA = 0x00;
}
}
/***********************************************************************************************
* vPageSet
* Type : void
* Ret val : none
* Argument : unsigned char ucPage ucPage range: 0x00~0x12
* Function : Set page address
***********************************************************************************************/
static void vPageSet( unsigned char ucPage )
{
*( volatile unsigned char *)LCDCOMMAND = 0x0B0 + ucPage; // PAGE ADDRESS
}
/***********************************************************************************************
* vColumnSet
* Type : void
* Ret val : none
* Argument : unsigned char ucColumn ucColumn range: 0~127
* Function : Set page address
***********************************************************************************************/
static void vColumnSet( unsigned char ucColumn )
{
unsigned char ucColumnH, ucColumnL;
ucColumnL = 0x0F & ucColumn;
ucColumnH = 0x10 | ( 0x0F & ( ucColumn >> 4 ));
*( volatile unsigned char *)LCDCOMMAND = ucColumnH; // COLUMN START ADDRESS MSB
asm("nop");
*( volatile unsigned char *)LCDCOMMAND = ucColumnL; // COLUMN START ADDRESS LSB
}
/***********************************************************************************************
* vDrawCheckPatten
* Type : void
* Ret val : none
* Argument : void
* Function : Draw a check patten on LCD
***********************************************************************************************/
void vDrawCheckPatten( void )
{
unsigned char i, ucPage;
for( ucPage = 0; ucPage < 13; ucPage++ )
{
vPageSet( ucPage );
vColumnSet( 0 );
for( i = 0; i < 64; i++ )
{
*( volatile unsigned char *)LCDDATA = 0x55;
*( volatile unsigned char *)LCDDATA = 0x0AA;
}
}
}
void vDemo( void )
{
vDrawCheckPatten( );
vL1F90009Clr( );
vL1F90009DrawVrtclLine( 50, 8, 50 );
vL1F90009DrawHrzntlLine( 1, 10, 70 );
vL1F90009DrawHrzntlLine( 6, 10, 70 );
vL1F90009DrawHrzntlLine( 7, 10, 70 );
vL1F90009DrawHrzntlLine( 8, 10, 70 );
vL1F90009DrawHrzntlLine( 50, 10, 70 );
vL1F90009DrawHrzntlLine( 95, 10, 70 );
vL1F90009DrawASCII( 1, 1, 'a' );
vL1F90009DrawASCII( 2, 2, 'b' );
vL1F90009DrawASCII( 3, 3, 'c' );
vL1F90009DrawASCII( 4, 4, 'd' );
vL1F90009DrawASCII( 5, 5, 'a' );
vL1F90009DrawASCII( 6, 6, '2' );
vL1F90009DrawASCII( 7, 7, 'A' );
vL1F90009DrawASCII( 8, 8, '-' );
vL1F90009DrawASCII( 15, 11, 'e' );
vL1F90009DrawString( 3, 4, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=_+|/?;:~!@#$%^&*().,<>" );
}
void delay( void )
{
unsigned char i;
for(i = 0; i < 200; i++ )
asm("nop");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -