網頁

2016年6月19日 星期日

DIY - PIC24:PIC24FJ64GA008 ILI9341 LCD 液晶屏初始化(二十)

DIY - PIC24PIC24FJ64GA008 ILI9341 LCD 液晶屏初始化(二十):

LCD 液晶屏的驅動蕊片都需要初始化(Initialization),ILI9341 驅動蕊片都不會例外,初始化(Initization)主要是作驅動蕊片內部參數設定 / 配置(Parameter Setting),其實 LCD 液晶屏驅動蕊片的內部是非常複雜,祇是廠家已經簡化驅動蕊片的設定,看看 ILI9341 的規格書(Specification V1.05 版本)有 239頁,便知道驅動蕊片並不簡單!

Microchip PIC24 LCD 主程序初始化流程
Microchip PIC24FJ64GA008 2.8TFT LCD 液晶屏初始化(Initialization
// Initialize ILI9341 LCD Device
        ILI9341_WR_REG(0xCF);                  //Power Control B
                        ILI9341_WR_DATA(0x00); //Always 0x
                        ILI9341_WR_DATA(0xDB); //PCEQ Off
                        ILI9341_WR_DATA(0X30); //ESD protection

        ILI9341_WR_REG(0xB1);                  //Frame rate control
                        ILI9341_WR_DATA(0x00);
                        ILI9341_WR_DATA(0x18);

        ILI9341_WR_REG(0xED);                  //PowerOn sequence control
                        ILI9341_WR_DATA(0x64); //Soft start
                        ILI9341_WR_DATA(0x03); //Power on sequence
                        ILI9341_WR_DATA(0X12); //Power on sequence
                        ILI9341_WR_DATA(0x81); //DDVDH enhance on

        ILI9341_WR_REG(0xE8);                  //Driver timing control A
                        ILI9341_WR_DATA(0x85); //nonoverlap
                        ILI9341_WR_DATA(0x00); //EQ timing
                        ILI9341_WR_DATA(0x70); //Precharge timing

        ILI9341_WR_REG(0xCB);                  //Power Control A
                        ILI9341_WR_DATA(0x39); //Always 0x39
                        ILI9341_WR_DATA(0x2C); //Always 0x2C
                        ILI9341_WR_DATA(0x00); //Always 0x
                        ILI9341_WR_DATA(0x34); //Vcore = 1.6V
                        ILI9341_WR_DATA(0x02); //DDVDH = 5.6V
        ILI9341_WR_REG(0xF7);                  //Pump ratio control
                        ILI9341_WR_DATA(0x20); //DDVDH=2xVCI

        ILI9341_WR_REG(0xEA);                  //Driver timing control B
                        ILI9341_WR_DATA(0x00); //Gate driver timing
                        ILI9341_WR_DATA(0x00); //Always 0x

        ILI9341_WR_REG(0xC0);                  //Power control 1
                        ILI9341_WR_DATA(0x22); //VRH

        ILI9341_WR_REG(0xC1);                  //Power control 2
                        ILI9341_WR_DATA(0x12); //SAP[2:0];BT[3:0]

        ILI9341_WR_REG(0xC5);                  //VCOM control 1
                        ILI9341_WR_DATA(0x5C);
                        ILI9341_WR_DATA(0x4C);

        ILI9341_WR_REG(0xC7);                  //VCOM control 2
                        ILI9341_WR_DATA(0x8F);

        ILI9341_WR_REG(0x36);                  //Memory access control = BGR
                        ILI9341_WR_DATA(0x48);

        ILI9341_WR_REG(0x3A);                  //Pixel format = 16 bit per pixel
                       ILI9341_WR_DATA(0x55);

        ILI9341_WR_REG(0xF2);                  //3G Gamma control
                       ILI9341_WR_DATA(0x02);

        ILI9341_WR_REG(0x26);                  //Gamma Curve Select 3
                        ILI9341_WR_DATA(0x01);

        ILI9341_WR_REG(0xE0);                  //Set Gamma
                        ILI9341_WR_DATA(0x0F);
                        ILI9341_WR_DATA(0x20);
                        ILI9341_WR_DATA(0x19);
                        ILI9341_WR_DATA(0x0F);
                        ILI9341_WR_DATA(0x10);
                        ILI9341_WR_DATA(0x08);
                        ILI9341_WR_DATA(0x4A);
                        ILI9341_WR_DATA(0xF6);
                        ILI9341_WR_DATA(0x3A);
                        ILI9341_WR_DATA(0x0F);
                        ILI9341_WR_DATA(0x14);
                        ILI9341_WR_DATA(0x09);
                        ILI9341_WR_DATA(0x18);
                        ILI9341_WR_DATA(0x0B);
                        ILI9341_WR_DATA(0x08);

        ILI9341_WR_REG(0xE1);                  //Set Gamma
                        ILI9341_WR_DATA(0x00);
                        ILI9341_WR_DATA(0x1E);
                        ILI9341_WR_DATA(0x1E);
                        ILI9341_WR_DATA(0x05);
                        ILI9341_WR_DATA(0x0F);
                        ILI9341_WR_DATA(0x04);
                        ILI9341_WR_DATA(0x31);
                        ILI9341_WR_DATA(0x33);
                        ILI9341_WR_DATA(0x43);
                        ILI9341_WR_DATA(0x04);
                        ILI9341_WR_DATA(0x0B);
                        ILI9341_WR_DATA(0x06);
                        ILI9341_WR_DATA(0x27);
                        ILI9341_WR_DATA(0x34);
                        ILI9341_WR_DATA(0x0F);

        ILI9341_WR_REG(0x11);                  //Exit SLEEP mode
        DelayMs(120);

        ILI9341_WR_REG(0x29);                  //Display ON

2016年 6月 19日 天氣報告
氣溫:30.4@ 19:30
相對濕度:百分之 80%
天氣:天色大致良好

沒有留言:

張貼留言