⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lpc_lib_lcd.c~

📁 使用embest IDE开发工具开发的基于LPC2294 的触摸屏开发
💻 C~
📖 第 1 页 / 共 2 页
字号:
/*
**********************************************************************************************
*
*     		  Embest Info&Tech Co., Ltd.  All rights reserved.
*                   		  www.embedinfo.com
*			
*file:     		lpc_lib_LCD.c 
*author:   		z.x.q. embest 
*establish: 	2006.xx.xx
*modify:		xx
*notes:			xx
**********************************************************************************************
*/

/*
**********************************************************************************************
*                                       include files
**********************************************************************************************
*/
#include 	"..\..\com\lpc_lib_LCD\lpc_lib_LCD.h"
/*
**********************************************************************************************
*                               extern function/variable declare
**********************************************************************************************
*/

/*
**********************************************************************************************
*                                  global variable define 
**********************************************************************************************
*/


/*改过
INT8U glineth=0;		//line number	
INT8U gcolth=0;			//column number
INT16U gfore_clr=0x0;	//fore color
INT16U gback_clr=0x07ff;//back color
*/

INT16U front=0x0;	//fore color
INT16U back=0x07ff;//back color


/*
**********************************************************************************************
* name:		function name
* func:		effect
* para:		form parameter
* ret:		return value description
* modify:
* comment:		
**********************************************************************************************
*/	
/*
**********************************************************************************************
* name:		LCD_init
* func:		initialize LCD screen
* para:		none
* ret:		none
* modify:
* comment:		
**********************************************************************************************
*/	






/*	改过
void LCD_init(void)
{	      
/*------standby_off -------------- */
//	LCD_wrcom(0x2C);
//	Delayms(1);

/*------set OTP mode off---------*/
//	LCD_wrcom(0xEA);
//	Delayms(1);
	
/*------set internal osc on---------*/
//	LCD_wrcom(0x02);
//	LCD_wrcom(0x01);
//	Delayms(20);
	
/*------booster1 on---------------*/
//	LCD_wrcom(0x20);
//	LCD_wrcom(0x08);      //DC-DC step-up: *2.0
//        Delayms(30);   
         
/*------booster1 on---------------*/
//	LCD_wrcom(0x26);
//	LCD_wrcom(0x01);
 //       Delayms(30);    

/*------booster1 on and amp on---------*/
//	LCD_wrcom(0x26);
//	LCD_wrcom(0x09);
//	Delayms(30);  

/*------booster2 on-------------*/
//	LCD_wrcom(0x26);
//	LCD_wrcom(0x0b);
//	Delayms(30);         

/*------booster3 on-------------*/
//	LCD_wrcom(0x26);
//	LCD_wrcom(0x0f);
//	Delayms(30);

/*------temp compsation ratio -0.05%------*/
//	LCD_wrcom(0x28);
//	LCD_wrcom(0x01);
	
/*------ram skip area set no skip------*/
//	LCD_wrcom(0x45);
//	LCD_wrcom(0x00);

/*------normal display---------*/
//	LCD_wrcom(0x53);
//	LCD_wrcom(0x00);

/*------set sdir=0,duty=1/132 swap=0-----*/
//	LCD_wrcom(0x10);
//    LCD_wrcom(0x03);		//Duty=1/132,RGB

/*------set clock fpck=fose/32(Normal)-------*/
//	LCD_wrcom(0x24);
//	LCD_wrcom(0x03);

/*------GSM=0:65K color,DSG=0,SGF=1,SGP=00,SGM=1-----*/
//	LCD_wrcom(0x30);
//	LCD_wrcom(0x09);//09

/*------row vector type=Diagonal ,INC=111-----*/
//	LCD_wrcom(0x32);
//	LCD_wrcom(0x0E);//0e

/*------entry mode set : x addr increce, read modify write off--*/
//	LCD_wrcom(0x40);
//	LCD_wrcom(0x00);

/*------x address set from 00 to 127--------*/
//	LCD_wrcom(0x43);
//	LCD_wrcom(0x00);
//	LCD_wrcom(0x7F);		

/*------y address set from 00 to 127--------*/
//	LCD_wrcom(0x42);
//	LCD_wrcom(0x00);
//	LCD_wrcom(0x7F);		

/*------frame set FIM=ON,FIP=1FRAME,N-BLOCK=9-F-----*/
//	LCD_wrcom(0x34);
//	LCD_wrcom(0xCd);

/*------contrast1 set,Range:2.8--4v*/
//	LCD_wrcom(0x2a);
//	LCD_wrcom(0x48);		/*partial display mode 0*/

	
/*------contrast2 set --------*/
//	LCD_wrcom(0x2b);
//	LCD_wrcom(0x48);		/*partial display mode 1*/


/*------partial display mode off-------*/
//	LCD_wrcom(0x55);
//	LCD_wrcom(0x00);
	
/*------Low frequency set off-------*/
//	LCD_wrcom(0x36);
//	LCD_wrcom(0x00);

/*------display on set--------*/
 //   Delayms(10);
//	LCD_wrcom(0x51);	
	
//	Delayms(30);
	
//	cls();	

//}

//清屏函数  
void cls(void)
{
unsigned char y;
unsigned int x;   
  for ( y=0;y<240;y++ )
    {x=0;
    Y_ADDR = y;
    X_ADDR = x;
    CMD = 0x00;
    for (x=0;x<320;x++)  DAT = 0xff;
    }
}



 //显示图片
void wrpic(void)
{ 
unsigned char y;
unsigned int x,cnt;
  cnt=0;  
  for ( y=0;y<64;y++ )
    {x=0;
    Y_ADDR = y;
    X_ADDR = x;
    CMD = ( x/256)<<2;       /*TFT板为CMD = ( x/256)<<2;  if(x>256)then{X[8]=1;}CSTN板为CMD = (( x/256)<<6)|0x04;*/
    for (x=0;x<128;x++)  DAT = picture[cnt++];
    } 
}

//单色汉字扩展成彩色显示
void to_color(void)
{ 
unsigned char y,k;
unsigned int x;
  k=0;  
  for( y=64;y<64+16;y++ )  
     {x=0;
     Y_ADDR = y;
     X_ADDR = x;	
     CMD = ( x/256)<<2;//TFT板为CMD = ( x/256)<<2;,CSTN板为CMD = (( x/256)<<6)|0x04;
     bytekzh( zk[k++], 0xe0, 0xff );//左边字节
     bytekzh( zk[k++], 0xe0, 0xff );/*右边字节;y from 64 to 64+16 and zk[32],so two times*/      
     }
  while(1);    
}


//单色字节扩展函数
void bytekzh( unsigned char datain, front, back )
{
unsigned char i,j;
for( i=0,j=0x80; i<8; i++,j=(j>>1))
DAT=datain&j ? front: back; 
}

/*
**********************************************************************************************
* name:		LCD_wrcom
* func:		write command
* para:		command data
* ret:		none
* modify:
* comment:		
**********************************************************************************************
*/	



/*改过	
void LCD_wrcom(INT16U comd)
{
	ADDR_COM=comd;

}
*/


/*
**********************************************************************************************
* name:		wrdata
* func:		effect
* para:		form parameter
* ret:		return value description
* modify:
* comment:		
**********************************************************************************************
*/	



/*改过	
void LCD_wrdata(INT16U data)
{
	ADDR_DATA=data;
}
*/



/*
**********************************************************************************************
* name:		LCD_BL_cn
* func:		back light onoff control
* para:		onoff: 0: on  1:off
* ret:		none
* modify:
* comment:		
**********************************************************************************************
*/




/*改过
void LCD_BL_con(INT8U onoff)
{
	if(onoff==0)
		spi_extend_set(0,module_c_LCM_EN);
	else
		spi_extend_set(1,module_c_LCM_EN);		
}
*/




/*
**********************************************************************************************
* name:		LCD_reset
* func:		reset LCD 
* para:		none
* ret:		none
* modify:
* comment:		
**********************************************************************************************
*/




/*改过
void LCD_reset(void)
{
	spi_extend_set(0,module_c_LCM_RESET_EN);
	time_dly(50);
	spi_extend_set(1,module_c_LCM_RESET_EN);

}
*/




/*
**********************************************************************************************
* name:		Delayms
* func:		delay time in ms 
* para:		value: delayed value ,unit:ms
* ret:		none
* modify:
* comment:		
**********************************************************************************************
*/




/*改过
void Delayms(INT32U value)
{
	INT32U i;
	for(;value>0;value--)
		for(i=0;i<500;i++);
}
//set x address
void LCD_Xaddr(INT8U startx,INT8U endx)
{
	LCD_wrcom(0x43);
	LCD_wrcom(startx);
	LCD_wrcom(endx); 
}
//set y address
void LCD_Yaddr(INT8U starty,INT8U endy)
{
	LCD_wrcom(0x42);
	LCD_wrcom(starty);
	LCD_wrcom(endy); 
}
*/



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -