本帖最后由 Dennis-Zhou 于 2017-5-24 18:45 编辑
使用的液晶屏是2.2英寸横屏,分辨率320*240,驱动芯片是
ILI9342。但无论如何怎么调,
屏幕显示的颜 {MOD}都不正确。
请各位帮我看看,是什么原因造成的。
当0x36寄存器配置为0x00:蓝 {MOD}显示为红 {MOD},绿 {MOD}显示为深绿 {MOD},红 {MOD}则无法显示(红框本来是要显示红 {MOD}的,但没有显示);
当0x36寄存器配置为0x08:蓝 {MOD}显示正常,绿 {MOD}显示为深绿 {MOD},红 {MOD}则无法显示(红框本来是要显示红 {MOD}的,但没有显示);
0x21和0x20寄存器都切换过,反正RGB也无法同时显示。
0x36寄存器:
LCD的初始化程序如下:
////======================================
// //Software Reset
// TFT8K6204_WriteReg(0x0001);
//Backlight Control 2
TFT8K6204_WriteReg(0x00B9);
TFT8K6204_WriteData(0x00FF);
TFT8K6204_WriteData(0x0093);
TFT8K6204_WriteData(0x0042);
//Display Inversion ON
TFT8K6204_WriteReg(0x0021);
// //Display Inversion OFF
// TFT8K6204_WriteReg(0x0020);
//Memory Access Control
TFT8K6204_WriteReg(0x0036);
TFT8K6204_WriteData(0x0008);
// TFT8K6204_WriteData(0x0028); //绿蓝
// TFT8K6204_WriteData(0x0020); //红绿
// TFT8K6204_WriteData(0x0000);
//Pixel Format Set
TFT8K6204_WriteReg(0x003A);
TFT8K6204_WriteData(0x00055);
//Power Control 1
TFT8K6204_WriteReg(0x00C0);
TFT8K6204_WriteData(0x0025);
TFT8K6204_WriteData(0x000A);
//Power Control 2
TFT8K6204_WriteReg(0x00C1);
TFT8K6204_WriteData(0x0001);
//VCOM Control 1
TFT8K6204_WriteReg(0x00C5);
TFT8K6204_WriteData(0x002F);
TFT8K6204_WriteData(0x0027);
//VCOM Control 2
TFT8K6204_WriteReg(0x00C7);
TFT8K6204_WriteData(0x00BE);
//Backlight Control 1
TFT8K6204_WriteReg(0x00B8);
TFT8K6204_WriteData(0x000B);
//Positive Gamma Correction
TFT8K6204_WriteReg(0x00E0);
TFT8K6204_WriteData(0x000F);
TFT8K6204_WriteData(0x002A);
TFT8K6204_WriteData(0x0027);
TFT8K6204_WriteData(0x000C);
TFT8K6204_WriteData(0x000F);
TFT8K6204_WriteData(0x0007);
TFT8K6204_WriteData(0x0058);
TFT8K6204_WriteData(0x0086);
TFT8K6204_WriteData(0x0048);
TFT8K6204_WriteData(0x0009);
TFT8K6204_WriteData(0x0018);
TFT8K6204_WriteData(0x000B);
TFT8K6204_WriteData(0x001B);
TFT8K6204_WriteData(0x000E);
TFT8K6204_WriteData(0x0008);
//Negative Gamma Correction
TFT8K6204_WriteReg(0x00E1);
TFT8K6204_WriteData(0x0008);
TFT8K6204_WriteData(0x0017);
TFT8K6204_WriteData(0x001A);
TFT8K6204_WriteData(0x0002);
TFT8K6204_WriteData(0x000E);
TFT8K6204_WriteData(0x0003);
TFT8K6204_WriteData(0x0029);
TFT8K6204_WriteData(0x0013);
TFT8K6204_WriteData(0x0039);
TFT8K6204_WriteData(0x0001);
TFT8K6204_WriteData(0x0005);
TFT8K6204_WriteData(0x0003);
TFT8K6204_WriteData(0x0026);
TFT8K6204_WriteData(0x0033);
TFT8K6204_WriteData(0x000F);
//Display Function Control
TFT8K6204_WriteReg(0x00B6);
TFT8K6204_WriteData(0x0000);
TFT8K6204_WriteData(0x0060);
TFT8K6204_WriteData(0x0027);
TFT8K6204_WriteData(0x0000);
TFT8K6204_WriteReg(0x0011); //退出睡眠状态
delay_ms(10);
TFT8K6204_WriteReg(0x0011);
delay_ms(10);
TFT8K6204_WriteReg(0x0029); //开启显示
////======================================
(原来的屏幕是分2次写进去的。移植时忽略了这点,搞了好几天才明白)
一周热门 更多>