ILI9325的初始化参数如下:
/**********************************************
函数名:Lcd初始化函数
功能:初始化Lcd
入口参数:无
返回值:无
***********************************************/
void Lcd_Initialize(void)
{
Lcd_Light_ON;
DataToWrite(0xffff);//数据线全高
Set_nWr;
Set_Cs;
Set_Rs;
Set_nRd;
Set_Rst;
Set_Rst;
Delay_nms(1);
Clr_Rst;
Delay_nms(1);
Set_Rst;
Delay_nms(1);
#ifdef ILI9325
LCD_WR_REG(0x00e3,0x3008);
LCD_WR_REG(0x00e7,0x0012);
LCD_WR_REG(0x00ef,0x1231);//Set the internal vcore voltage
LCD_WR_REG(0x0001,0x0100);//S
#endif
#ifdef ILI9320
LCD_WR_REG(0x00e5,0x8000);
LCD_WR_REG(0x0000,0x0001);
LCD_WR_REG(0x0001,0x0100);//S
Delay_nms(10);
#endif
LCD_WR_REG(0x0002,0x0700);//Line inversion
#if ID_AM==000
LCD_WR_REG(0x0003,0x0000);//屏幕旋转控制 TFM=0,TRI=0,SWAP=1,16 bits system interface swap RGB to BRG,此处ORG和HWM 为0
#elif ID_AM==001
LCD_WR_REG(0x0003,0x0008);
#elif ID_AM==010
LCD_WR_REG(0x0003,0x0010);
#elif ID_AM==011
LCD_WR_REG(0x0003,0x0018);
#elif ID_AM==100
LCD_WR_REG(0x0003,0x0020);
#elif ID_AM==101
LCD_WR_REG(0x0003,0x0028);
#elif ID_AM==110
LCD_WR_REG(0x0003,0x0030);
#elif ID_AM==111
LCD_WR_REG(0x0003,0x0038);
#endif
LCD_WR_REG(0x0004,0x0000);
LCD_WR_REG(0x0008,0x0207);
LCD_WR_REG(0x0009,0x0000);
LCD_WR_REG(0x000a,0x0000);
LCD_WR_REG(0x000c,0x0001);//此处配置接口类型 16位 system接口
LCD_WR_REG(0x000d,0x0000);
LCD_WR_REG(0x000f,0x0000);
//电源配置
LCD_WR_REG(0x0010,0x0000);
LCD_WR_REG(0x0011,0x0000);
LCD_WR_REG(0x0012,0x0000);
LCD_WR_REG(0x0013,0x0000);
Delay_nms(200);
LCD_WR_REG(0x0010,0x17b0);
LCD_WR_REG(0x0011,0x0137);
Delay_nms(50);
LCD_WR_REG(0x0012,0x0139); /////从此处开始********************
Delay_nms(50);
LCD_WR_REG(0x0013,0x1700);
LCD_WR_REG(0x0029,0x000c);
//LCD_WR_REG(0x002b,0x000d);
Delay_nms(50);
#if ID_AM==000
LCD_WR_REG(0x0020,0x00ef);//GRAM水平起始位置
LCD_WR_REG(0x0021,0x013f);
#elif ID_AM==001
LCD_WR_REG(0x0020,0x00ef);
LCD_WR_REG(0x0021,0x013f);
#elif ID_AM==010
LCD_WR_REG(0x0020,0x0000);
LCD_WR_REG(0x0021,0x013f);
#elif ID_AM==011
LCD_WR_REG(0x0020,0x0000);
LCD_WR_REG(0x0021,0x013f);
#elif ID_AM==100
LCD_WR_REG(0x0020,0x00ef);
LCD_WR_REG(0x0021,0x0000);
#elif ID_AM==101
LCD_WR_REG(0x0020,0x00ef);
LCD_WR_REG(0x0021,0x0000);
#elif ID_AM==110
LCD_WR_REG(0x0020,0x0000);
LCD_WR_REG(0x0021,0x0000);
#elif ID_AM==111
LCD_WR_REG(0x0020,0x0000);
LCD_WR_REG(0x0021,0x0000);
#endif
LCD_WR_REG(0x0030,0x0000);
LCD_WR_REG(0x0031,0x0507);
LCD_WR_REG(0x0032,0x0104);
LCD_WR_REG(0x0035,0x0105);
LCD_WR_REG(0x0036,0x0404);
LCD_WR_REG(0x0037,0x0603);
LCD_WR_REG(0x0038,0x0004);
LCD_WR_REG(0x0039,0x0007);
LCD_WR_REG(0x003c,0x0501);
LCD_WR_REG(0x003d,0x0404);
LCD_WR_REG(0x0050,0x0000);//水平 GRAM起始位置
LCD_WR_REG(0x0051,0x00ef);//水平GRAM终止位置
LCD_WR_REG(0x0052,0x0000);//垂直GRAM起始位置
LCD_WR_REG(0x0053,0x013f);//垂直GRAM终止位置
#ifdef ILI9325
LCD_WR_REG(0x0060,0xa700);//G
#endif
#ifdef ILI9320
LCD_WR_REG(0x0060,0x2700);//G
#endif
LCD_WR_REG(0x0061,0x0001);//Enables the grayscale inversion of the image by setting REV=1.??????????????????????????????
LCD_WR_REG(0x006a,0x0000);//不使用卷曲功能
LCD_WR_REG(0x0080,0x0000);
LCD_WR_REG(0x0081,0x0000);
LCD_WR_REG(0x0082,0x0000);
LCD_WR_REG(0x0083,0x0000);
LCD_WR_REG(0x0084,0x0000);
LCD_WR_REG(0x0085,0x0000);
LCD_WR_REG(0x0090,0x0010);
LCD_WR_REG(0x0092,0x0000);
LCD_WR_REG(0x0093,0x0003);
LCD_WR_REG(0x0095,0x0110);
LCD_WR_REG(0x0097,0x0000);
LCD_WR_REG(0x0098,0x0000);
//显示画面写入 0x0130是不显示当前画面
//0x0173是显示当前画面
LCD_WR_REG(0x0007,0x0130);
#ifdef Immediately
LCD_WR_REG(0x0007,0x0173);
#endif
//第一个像素的读取数据是无效值,这里事先读取一次,舍去无效值
}