最近在做的一个TFT屏总是点不亮,请高手指点一下。
贴出初始化代码,请帮忙挑挑毛病
void TFT_Init(void)
{
u16 DeviceCode;
Set_CS;
Set_RD;
Set_WR;
Set_RST;
Delayms(20);
Clr_RST;
Delayms(20);
Set_RST;
Delayms(20);
// Clr_CS;
// TFT_Write_com(0x0000); TFT_Write_dat(0x0001);
// Set_CS;
DeviceCode = TFT_ReadReg(0x0000); // 读出ID号为9325
send_data(DeviceCode>>8);
send_data(DeviceCode&0xFF);
Delayms(50);
Clr_CS; // 打开片选使能
//************* Start Initial Sequence **********//
TFT_Write_com(0x00E5); TFT_Write_dat(0x78F0); // set SRAM internal timing
TFT_Write_com(0x00E3); TFT_Write_dat(0x3008); // set SRAM internal timing
TFT_Write_com(0x00E7); TFT_Write_dat(0x0012); // set SRAM internal timing
TFT_Write_com(0x00EF); TFT_Write_dat(0x1231); // set SRAM internal timing
// TFT_Write_com(0x0000); TFT_Write_dat(0x0001); // start Ocillation 开启内部时钟
TFT_Write_com(0x0001); TFT_Write_dat(0x1000); // set SS and SM bit (S720 -> S1)
TFT_Write_com(0x0002); TFT_Write_dat(0x0700); // set 1 line inversion 电源开启
TFT_Write_com(0x0003); TFT_Write_dat(0x1030); // set GRAM write direction and BGR=1. 、、65K
TFT_Write_com(0x0004); TFT_Write_dat(0x0000); // Resize register
TFT_Write_com(0x0008); TFT_Write_dat(0x0207); // set the back porch and front porch
TFT_Write_com(0x0009); TFT_Write_dat(0x0000); // set non-display area refresh cycle ISC[3:0]
TFT_Write_com(0x000A); TFT_Write_dat(0x0000); // FMARK function
TFT_Write_com(0x000C); TFT_Write_dat(0x0000); // RGB interface setting
TFT_Write_com(0x000D); TFT_Write_dat(0x0000); // Frame marker Position
TFT_Write_com(0x000F); TFT_Write_dat(0x0000); // RGB interface polarity
//*************Power On sequence ****************//
TFT_Write_com(0x0010); TFT_Write_dat(0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB
TFT_Write_com(0x0011); TFT_Write_dat(0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
TFT_Write_com(0x0012); TFT_Write_dat(0x0000); // VREG1OUT voltage
TFT_Write_com(0x0013); TFT_Write_dat(0x0000); // VDV[4:0] for VCOM amplitude
// TFT_Write_com(0x0007); TFT_Write_dat(0x0001);
Delayms(200); // Dis-charge capacitor power voltage
TFT_Write_com(0x0010); TFT_Write_dat(0x1090); // 1490//SAP, BT[3:0], AP, DSTB, SLP, STB
TFT_Write_com(0x0011); TFT_Write_dat(0x0227); // DC1[2:0], DC0[2:0], VC[2:0]
Delayms(50);
TFT_Write_com(0x0012); TFT_Write_dat(0x001F); //001C// Internal reference voltage= Vci;
Delayms(50);
TFT_Write_com(0x0013); TFT_Write_dat(0x1500); //0x1000//1400 Set VDV[4:0] for VCOM amplitude 1A00
TFT_Write_com(0x0029); TFT_Write_dat(0x0027); //0x0012 //001a Set VCM[5:0] for VCOMH //0x0025 0034 电压
Delayms(50);
TFT_Write_com(0x002B); TFT_Write_dat(0x000D); // Set Frame Rate 000C 帧频
Delayms(50);
TFT_Write_com(0x0020); TFT_Write_dat(0x0000); // GRAM horizontal Address
TFT_Write_com(0x0021); TFT_Write_dat(0x0000); // GRAM Vertical Address
// ----------- Adjust the Gamma Curve ----------//
TFT_Write_com(0x0030); TFT_Write_dat(0x0000);
TFT_Write_com(0x0031); TFT_Write_dat(0x0707);
TFT_Write_com(0x0032); TFT_Write_dat(0x0307);
TFT_Write_com(0x0035); TFT_Write_dat(0x0200);
TFT_Write_com(0x0036); TFT_Write_dat(0x0008);
TFT_Write_com(0x0037); TFT_Write_dat(0x0004);
TFT_Write_com(0x0038); TFT_Write_dat(0x0000);
TFT_Write_com(0x0039); TFT_Write_dat(0x0707);
TFT_Write_com(0x003C); TFT_Write_dat(0x0002);
TFT_Write_com(0x003D); TFT_Write_dat(0x1D04);
//------------------ Set GRAM area ---------------//
TFT_Write_com(0x0050); TFT_Write_dat(0x0000); // Horizontal GRAM Start Address
TFT_Write_com(0x0051); TFT_Write_dat(0x00EF); // Horizontal GRAM End Address
TFT_Write_com(0x0052); TFT_Write_dat(0x0000); // Vertical GRAM Start Address
TFT_Write_com(0x0053); TFT_Write_dat(0x013F); // Vertical GRAM Start Address
TFT_Write_com(0x0060); TFT_Write_dat(0xA700); // Gate Scan Line
TFT_Write_com(0x0061); TFT_Write_dat(0x0001); // NDL,VLE, REV
TFT_Write_com(0x006A); TFT_Write_dat(0x0000); // set scrolling line
//-------------- Partial Display Control ---------//
TFT_Write_com(0x0080); TFT_Write_dat(0x0000);
TFT_Write_com(0x0081); TFT_Write_dat(0x0000);
TFT_Write_com(0x0082); TFT_Write_dat(0x0000);
TFT_Write_com(0x0083); TFT_Write_dat(0x0000);
TFT_Write_com(0x0084); TFT_Write_dat(0x0000);
TFT_Write_com(0x0085); TFT_Write_dat(0x0000);
//-------------- Panel Control -------------------//
TFT_Write_com(0x0090); TFT_Write_dat(0x0010);
TFT_Write_com(0x0092); TFT_Write_dat(0x0600);
TFT_Write_com(0x0007); TFT_Write_dat(0x0133); // 262K color and display ON
Set_CS; //关闭片选使能
} |