在线时间9 小时
UID345964
ST金币0
蝴蝶豆0
注册时间2012-3-7
初级会员
- 最后登录
- 2020-9-5
|
a0a.1 0b0c
为什么我的TFT液晶接5V的时候,会亮,但是程序写下去一点反应都没有啊,然后接3.3V会有反应,同学说那是TFT本来的颜色。也就是说颜色出不来,为甚呢?我把初始化程序贴上来,请各位大侠帮帮忙,紧急啊。。。。谢谢各位大虾了
void LCD_Init(void)
{
LCD_REST_H();
delay_ms(10);
LCD_REST_L();
delay_ms(10);
LCD_REST_H();
LCD_CS_H();
LCD_RD_H();
LCD_WR_H();
delay_ms(5);
LCD_CS_L(); //打开片选使能
delay_ms(100);
//************* Start Initial Sequence **********//
LCD_Write_COM(0x00E3);
LCD_Write_DATA(0x3008); // set SRAM internal timing
LCD_Write_COM(0x00E7);
LCD_Write_DATA(0x0012);
LCD_Write_COM(0x00EF);
LCD_Write_DATA(0x1231);
LCD_Write_COM(0x0000);
LCD_Write_DATA(0x0001);
// LCD_Write_COM(0x002b);
// LCD_Write_DATA(0x0010);
LCD_Write_COM(0x0001);
LCD_Write_DATA(0x0100); // set SS and SM bit
LCD_Write_COM(0x0002);
LCD_Write_DATA(0x0700); // set 1 line inversion
LCD_Write_COM(0x0003);
LCD_Write_DATA(0x1008); // set GRAM write direction and BGR=1.
LCD_Write_COM(0x0004);
LCD_Write_DATA(0x0000); // Resize register
LCD_Write_COM(0x0008);
LCD_Write_DATA(0x0404); // set the back porch and front porch
LCD_Write_COM(0x0009);
LCD_Write_DATA(0x0000); // set non-display area refresh cycle ISC[3:0]
LCD_Write_COM(0x000A);
LCD_Write_DATA(0x0000); // FMARK function
LCD_Write_COM(0x000C);
LCD_Write_DATA(0x0000); // RGB interface setting
LCD_Write_COM(0x000D);
LCD_Write_DATA(0x0000); // Frame marker Position
LCD_Write_COM(0x000F);
LCD_Write_DATA(0x0000); // RGB interface polarity
//*************Power On sequence ****************//
LCD_Write_COM(0x0010);
LCD_Write_DATA(0x0080); // SAP, BT[3:0], AP, DSTB, SLP, STB
LCD_Write_COM(0x0011);
LCD_Write_DATA(0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
LCD_Write_COM(0x0012);
LCD_Write_DATA(0x0000); // VREG1OUT voltage
LCD_Write_COM(0x0013);
LCD_Write_DATA(0x0000); // VDV[4:0] for VCOM amplitude
LCD_Write_COM(0x0007);
LCD_Write_DATA(0x0001);
delay_ms(50); // Dis-charge capacitor power voltage
LCD_Write_COM(0x0010);
LCD_Write_DATA(0x1590); // 1490//SAP, BT[3:0], AP, DSTB, SLP, STB
LCD_Write_COM(0x0011);
LCD_Write_DATA(0x0227); // DC1[2:0], DC0[2:0], VC[2:0]
delay_ms(50); // Delay 50ms
LCD_Write_COM(0x0012);
LCD_Write_DATA(0x001f); //001C// Internal reference voltage= Vci;
delay_ms(50); // Delay 50ms
LCD_Write_COM(0x0013);
LCD_Write_DATA(0x1500); //0x1000//1400 Set VDV[4:0] for VCOM amplitude 1A00
LCD_Write_COM(0x0029);
LCD_Write_DATA(0x0022); //0x0012 //001a Set VCM[5:0] for VCOMH //0x0025 0034
LCD_Write_COM(0x002B);
LCD_Write_DATA(0x000f); // Set Frame Rate 000C
delay_ms(50); // Delay 50ms
LCD_Write_COM(0x0020);
LCD_Write_DATA(0x00ef); // GRAM horizontal Address
LCD_Write_COM(0x0021);
LCD_Write_DATA(0x013f); // GRAM Vertical Address
// ----------- Adjust the Gamma Curve ----------//
LCD_Write_COM(0x0030);
LCD_Write_DATA(0x0101);
LCD_Write_COM(0x0031);
LCD_Write_DATA(0x0707);
LCD_Write_COM(0x0032);
LCD_Write_DATA(0x0505);
LCD_Write_COM(0x0035);
LCD_Write_DATA(0x0407);
LCD_Write_COM(0x0036);
LCD_Write_DATA(0x0102);//0207
LCD_Write_COM(0x0037);
LCD_Write_DATA(0x0102);//0306
LCD_Write_COM(0x0038);
LCD_Write_DATA(0x0202);//0102
LCD_Write_COM(0x0039);
LCD_Write_DATA(0x0106);//0707
LCD_Write_COM(0x003C);
LCD_Write_DATA(0x0202);//0702
LCD_Write_COM(0x003D);
LCD_Write_DATA(0x706);//1604
//------------------ Set GRAM area ---------------//
LCD_Write_COM(0x0050);
LCD_Write_DATA(0x0000); // Horizontal GRAM Start Address
LCD_Write_COM(0x0051);
LCD_Write_DATA(0x00EF); // Horizontal GRAM End Address
LCD_Write_COM(0x0052);
LCD_Write_DATA(0x0000); // Vertical GRAM Start Address
LCD_Write_COM(0x0053);
LCD_Write_DATA(0x013F); // Vertical GRAM Start Address
LCD_Write_COM(0x0060);
LCD_Write_DATA(0xA700); // Gate Scan Line
LCD_Write_COM(0x0061);
LCD_Write_DATA(0x0001); // NDL,VLE, REV
LCD_Write_COM(0x006A);
LCD_Write_DATA(0x0000); // set scrolling line
//-------------- Partial Display Control ---------//
LCD_Write_COM(0x0080);
LCD_Write_DATA(0x0000);
LCD_Write_COM(0x0081);
LCD_Write_DATA(0x0000);
LCD_Write_COM(0x0082);
LCD_Write_DATA(0x0000);
LCD_Write_COM(0x0083);
LCD_Write_DATA(0x0000);
LCD_Write_COM(0x0084);
LCD_Write_DATA(0x0000);
LCD_Write_COM(0x0085);
LCD_Write_DATA(0x0000);
//-------------- Panel Control -------------------//
LCD_Write_COM(0x0090);
LCD_Write_DATA(0x0010);
LCD_Write_COM(0x0092);
LCD_Write_DATA(0x0000);
LCD_Write_COM(0x0093);
LCD_Write_DATA(0x0003);
LCD_Write_COM(0x0095);
LCD_Write_DATA(0x0110);
LCD_Write_COM(0x0097);
LCD_Write_DATA(0x0000);
LCD_Write_COM(0x0098);
LCD_Write_DATA(0x0000);
LCD_Write_COM(0x0007);
LCD_Write_DATA(0x0173); // 262K color and display ON
// LCD_Write_COM(0x0022);
// LCD_CS_H(); //关闭片选使能
// LCD_CS_L(); //打开LCD片选使能
} |
|