微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > TFT液晶屏C51控制

TFT液晶屏C51控制

时间:11-18 来源:互联网 点击:

//LCD_Write_REG(0x0001); LCD_Write_DATA(0x0100); // set SS and SM bit
LCD_Write_REG(0x0001); LCD_Write_DATA(0x0000); // set SS and SM bit //镜像 摄像头应用的时候要用到

LCD_Write_REG(0x0002); LCD_Write_DATA(0x0700); // set 1 line inversion

//LCD_Write_REG(0x0003); LCD_Write_DATA(0x1030); // set GRAM write direction and BGR=1. 影响显示模式nnnnnnn
LCD_Write_REG(0x0003); LCD_Write_DATA(0x1018); // set GRAM write direction and BGR=1.

LCD_Write_REG(0x0004); LCD_Write_DATA(0x0000); // LCD_RSTize register
LCD_Write_REG(0x0008); LCD_Write_DATA(0x0207); // set the back porch and front porch
LCD_Write_REG(0x0009); LCD_Write_DATA(0x0000); // set non-display area refLCD_RSTh cycle ISC[3:0]
LCD_Write_REG(0x000A); LCD_Write_DATA(0x0000); // FMARK function
LCD_Write_REG(0x000C); LCD_Write_DATA(0x0000); // RGB interface setting
LCD_Write_REG(0x000D); LCD_Write_DATA(0x0000); // Frame marker Position
LCD_Write_REG(0x000F); LCD_Write_DATA(0x0000); // RGB interface polarity
//*************Power On sequence ****************//
//LCD_Write_REG(0x0010); LCD_Write_DATA(0x0000); // SAP, BT[3:0], AP, DSTB, SLP, STB
LCD_Write_REG(0x0010); LCD_Write_DATA(0x0080); // SAP, BT[3:0], AP, DSTB, SLP, STB nnnnnnnnnnn

LCD_Write_REG(0x0011); LCD_Write_DATA(0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
LCD_Write_REG(0x0012); LCD_Write_DATA(0x0000); // VREG1OUT voltage
LCD_Write_REG(0x0013); LCD_Write_DATA(0x0000); // VDV[4:0] for VCOM amplitude
LCD_Write_REG(0x0007); LCD_Write_DATA(0x0001);
delayms(200); // Dis-charge capacitor power voltage

//LCD_Write_REG(0x0010); LCD_Write_DATA(0x1090); // 1490//SAP, BT[3:0], AP, DSTB, SLP, STB //对屏闪有点影响
LCD_Write_REG(0x0010); LCD_Write_DATA(0x1590); // 1490//SAP, BT[3:0], AP, DSTB, SLP, STB nnnnnnnnnn

LCD_Write_REG(0x0011); LCD_Write_DATA(0x0227); // DC1[2:0], DC0[2:0], VC[2:0]
delayms(50); // Delay 50ms
LCD_Write_REG(0x0012); LCD_Write_DATA(0x001F); //001C// Internal reference voltage= Vci;
delayms(50); // Delay 50ms
//LCD_Write_REG(0x0013); LCD_Write_DATA(0x1500); //0x1000//1400 Set VDV[4:0] for VCOM amplitude 1LCD_RS0
LCD_Write_REG(0x0013); LCD_Write_DATA(0x1000); //0x1000//1400 Set VDV[4:0] for VCOM amplitude 1LCD_RS0 nnnnnnnnnnn

//LCD_Write_REG(0x0029); LCD_Write_DATA(0x0027); //0x0012 //001a Set VCM[5:0] for VCOMH //0x0025 0034
//LCD_Write_REG(0x002B); LCD_Write_DATA(0x000D); // Set Frame Rate 000C
LCD_Write_REG(0x0029); LCD_Write_DATA(0x0015); //0x0012 //001a Set VCM[5:0] for VCOMH //0x0025 0034 nnnnnnnnnnn
LCD_Write_REG(0x002B); LCD_Write_DATA(0x000c); // Set Frame Rate 000C nnnnnnnnnnn

delayms(50); // Delay 50ms
LCD_Write_REG(0x0020); LCD_Write_DATA(0x0000); // GRAM horizontal AddLCD_RSTs

//LCD_Write_REG(0x0021); LCD_Write_DATA(0x0000); // GRAM Vertical AddLCD_RSTs
LCD_Write_REG(0x0021); LCD_Write_DATA(0x013f); // GRAM Vertical AddLCD_RSTs nnnnnnnnnnnnnn

// ----------- Adjust the Gamma Curve ----------//
LCD_Write_REG(0x0030); LCD_Write_DATA(0x0000);
LCD_Write_REG(0x0031); LCD_Write_DATA(0x0707);

//LCD_Write_REG(0x0032); LCD_Write_DATA(0x0307);
LCD_Write_REG(0x0032); LCD_Write_DATA(0x0505); // nnnnnnnnnnn

//LCD_Write_REG(0x0035); LCD_Write_DATA(0x0200);
LCD_Write_REG(0x0035); LCD_Write_DATA(0x0107); // nnnnnnnnnnn

LCD_Write_REG(0x0036); LCD_Write_DATA(0x0008);//0207
LCD_Write_REG(0x0037); LCD_Write_DATA(0x0004);//0306

//LCD_Write_REG(0x0038); LCD_Write_DATA(0x0000);//0102
//LCD_Write_REG(0x0039); LCD_Write_DATA(0x0707);//0707
//LCD_Write_REG(0x003C); LCD_Write_DATA(0x0002);//0702
//LCD_Write_REG(0x003D); LCD_Write_DATA(0x1D04);//1604
LCD_Write_REG(0x0038); LCD_Write_DATA(0x0202);//0102 nnnnnnnnnn
LCD_Write_REG(0x0039); LCD_Write_DATA(0x0106);//0707 nnnnnnnnnnn
LCD_Write_REG(0x003C); LCD_Write_DATA(0x0202);//0702 nnnnnnnnnnnn
LCD_Write_REG(0x003D); LCD_Write_DATA(0x0408);//1604 nnnnnnnnnnnnn

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top