WriteCommand(0xE0); // Start PLL command again
WriteData(0x03); // now, use PLL output as system clock
DelayMs(5);
//WriteCommand(0xE4); // Start PLL command again
WriteCommand(0x01); //软复位
DelayMs(10);
//Set LSHIFT freq, i.e. the DCLK with PLL freq 120MHz set previously
//Typical DCLK for TY700TFT800480 is 33.3MHz(datasheet), experiment shows 30MHz gives a stable result
//30MHz = 120MHz*(LCDC_FPR+1)/2^20
//LCDC_FPR = 262143 (0x3FFFF)
//Time per line = (DISP_HOR_RESOLUTION+DISP_HOR_PULSE_WIDTH+DISP_HOR_BACK_PORCH+DISP_HOR_FRONT_PORCH)/30 us = 1056/30 = 35.2us
//9MHz = 120MHz*(LCDC_FPR+1)/2^20
//LCDC_FPR = 78642 (0x13332)
WriteCommand(0xE6);
WriteData(0x01);//0x03
WriteData(0x33);
WriteData(0x32);
//Set LCD mode, varies from individual manufacturer
WriteCommand(0xB0);
//WriteData(0x10);//0x10 // set 18-bit for 7" panel TY700TFT800480
//WriteData(0x80); // set TTL mode
WriteData(0x20);//0x10 // set 18-bit for 7" panel TY700TFT800480
WriteData(0x00); // set TTL mode
WriteData(((DISP_HOR_RESOLUTION-1)>>8)&0X00FF); // Set LCD panel size(DISP_HOR_RESOLUTION = 800) H
WriteData((DISP_HOR_RESOLUTION-1)&0X00FF); // Set LCD panel size(DISP_HOR_RESOLUTION = 800) L
WriteData(((DISP_VER_RESOLUTION-1)>>8)&0X00FF); // Set LCD panel size(DISP_VER_RESOLUTION = 480) H
WriteData((DISP_VER_RESOLUTION-1)&0X00FF); // Set LCD panel size(DISP_VER_RESOLUTION = 480) L
WriteData(0x00);//0x00 // RGB sequence
WriteCommand(0xB8); //设置GPIO配置
WriteData(0x0F); //GPIO3=output, GPIO[2:0]=output//GPIO is controlled by host; 4个IO设置成输出
WriteData(0x01); //GPIO0 使用正常的IO功能
//WriteCommand(0xB7);
WriteCommand(0xBA); //设置GPIO配置
WriteData(0x000F); //GPIO[3:0] out 1
WriteCommand(0x0036); //rotation
WriteData(0x0000);
//WriteCommand(0x3A); //Set pixel format, i.e. the bpp
//WriteData(0x55); //set 16bpp
WriteCommand(0xF0); //设置SSD1963同CPU接口为16bit Set pixel data interface
WriteData(0x03); //16-bit(565 format) data for 16bpp PIC32MX only
//WriteCommand(0xF1);
WriteCommand(0x21); //进入图形颜色翻转模式
WriteCommand(0xBC);//重要
WriteData(brightness);//亮度值
WriteData(contrast);//对比度值
WriteData(saturation);//饱和度值
WriteData(0x01);//处理机允许
DelayMs(10);
LCDClear(SysSetting.BackColor);
WriteCommand(0x29); // Turn on display; show the image on display
void InitSSD1963(void)
{
u8 brightness = 0x80;//0x40;//亮度
u8 contrast = 0x80;//0x70;//对比度
u8 saturation = 0x80;//0x40;//饱和度
unsigned int HT=525;
unsigned int HPS=43;
unsigned int LPS=1;
unsigned char HPW=42;
unsigned int VDP=271;
unsigned int VT=288;
unsigned int VPS=12;
unsigned int FPS=1;
unsigned char VPW=11;
WriteCommand(0xE2); //Set PLL with OSC = 10MHz (hardware), Multiplier N = 35, 250MHz < VCO < 800MHz = OSC*(N+1), VCO = 360MHz
// WriteData(0x23); //OSC = 10MHz (hardware),//参数1
WriteData(0x2C); //OSC = 8MHz (hardware),///参数1
WriteData(0x02); //参数2 Divider M = 2, PLL = 360/(M+1) = 120MHz
//WriteData(0x54); //参数3 Validate M and N values
WriteData(0x04);
//WriteCommand(0xE3);
WriteCommand(0xE0); // Start PLL command
WriteData(0x01); // enable PLL
DelayMs(1);
WriteCommand(0xE0); // Start PLL command again
WriteData(0x03); // now, use PLL output as system clock
DelayMs(5);
//WriteCommand(0xE4); // Start PLL command again
WriteCommand(0x01); //软复位
DelayMs(10);
//Set LSHIFT freq, i.e. the DCLK with PLL freq 120MHz set previously
//Typical DCLK for TY700TFT800480 is 33.3MHz(datasheet), experiment shows 30MHz gives a stable result
//30MHz = 120MHz*(LCDC_FPR+1)/2^20
//LCDC_FPR = 262143 (0x3FFFF)
//Time per line = (DISP_HOR_RESOLUTION+DISP_HOR_PULSE_WIDTH+DISP_HOR_BACK_PORCH+DISP_HOR_FRONT_PORCH)/30 us = 1056/30 = 35.2us
//9MHz = 120MHz*(LCDC_FPR+1)/2^20
//LCDC_FPR = 78642 (0x13332)
WriteCommand(0xE6);
WriteData(0x01);//0x03
WriteData(0x33);
WriteData(0x32);
//Set LCD mode, varies from individual manufacturer
WriteCommand(0xB0);
//WriteData(0x10);//0x10 // set 18-bit for 7" panel TY700TFT800480
//WriteData(0x80); // set TTL mode
WriteData(0x20);//0x10 // set 18-bit for 7" panel TY700TFT800480
WriteData(0x00); // set TTL mode
WriteData(((DISP_HOR_RESOLUTION-1)>>8)&0X00FF); // Set LCD panel size(DISP_HOR_RESOLUTION = 800) H
WriteData((DISP_HOR_RESOLUTION-1)&0X00FF); // Set LCD panel size(DISP_HOR_RESOLUTION = 800) L
WriteData(((DISP_VER_RESOLUTION-1)>>8)&0X00FF); // Set LCD panel size(DISP_VER_RESOLUTION = 480) H
WriteData((DISP_VER_RESOLUTION-1)&0X00FF); // Set LCD panel size(DISP_VER_RESOLUTION = 480) L
WriteData(0x00);//0x00 // RGB sequence
//WriteCommand(0xB1);
//Set horizontal period
WriteCommand(0xB4);
WriteData((HT>>8)&0X00FF); //Set HT
WriteData(HT&0X00FF);
WriteData((HPS>>8)&0X00FF); //Set HPS
WriteData(HPS&0X00FF);
WriteData(HPW); //Set HPW
WriteData((LPS>>8)&0X00FF); //Set HPS
WriteData(LPS&0X00FF);
WriteData(0x0000);
//WriteCommand(0xB5);
//Set vertical period
WriteCommand(0xB6);
WriteData((VT>>8)&0X00FF); //Set VT
WriteData(VT&0X00FF);
WriteData((VPS>>8)&0X00FF); //Set VPS
WriteData(VPS&0X00FF);
WriteData(VPW); //Set VPW
WriteData((FPS>>8)&0X00FF); //Set FPS
WriteData(FPS&0X00FF);
WriteCommand(0xB8); //设置GPIO配置
WriteData(0x0F); //GPIO3=output, GPIO[2:0]=output//GPIO is controlled by host; 4个IO设置成输出
WriteData(0x01); //GPIO0 使用正常的IO功能
//WriteCommand(0xB7);
WriteCommand(0xBA); //设置GPIO配置
WriteData(0x000F); //GPIO[3:0] out 1
WriteCommand(0x0036); //rotation
WriteData(0x0000);
//WriteCommand(0x3A); //Set pixel format, i.e. the bpp
//WriteData(0x55); //set 16bpp
WriteCommand(0xF0); //设置SSD1963同CPU接口为16bit Set pixel data interface
WriteData(0x03); //16-bit(565 format) data for 16bpp PIC32MX only
//WriteCommand(0xF1);
WriteCommand(0x21); //进入图形颜色翻转模式
WriteCommand(0xBC);//重要
WriteData(brightness);//亮度值
WriteData(contrast);//对比度值
WriteData(saturation);//饱和度值
WriteData(0x01);//处理机允许
DelayMs(10);
LCDClear(SysSetting.BackColor);
WriteCommand(0x29); // Turn on display; show the image on display
//set PWM
WriteCommand(0xBE); //
WriteData(0x0E); //PLL(120M)/(256*Value)/256=120Hz
WriteData(0xFF); //duty=X/256
WriteData(0x09); //DBC enable PWM enable
WriteData(0xFF); //DBC manual brightness
WriteData(0x00); //DBC minimum brightness
WriteData(0x00); //Brightness prescaler ff(system frequency / Divcode / 32768)
WriteCommand(0xD4); //
//TH1 = display width * display height * 3 * 0.1 /16
//480*272 * 3 * 0.1 /16 =990H
WriteData(0x00); //
WriteData(0x09); //
WriteData(0x90); //
//TH2 = display width * display height * 3 * 0.25 /16
//480*272 * 3 * 0.25 /16 =17E8H
WriteData(0x00); //
WriteData(0x17); //
WriteData(0xE8); //
//TH3 = display width * display height * 3 * 0.6 /16
//480*272 * 3 * 0.6 /16 =3960H
WriteData(0x00); //
WriteData(0x39); //
WriteData(0x60); //
WriteCommand(0xD0); //
WriteData(0x0D); //PLL(120M)/(256*Value)/256=120Hz
//end of PWM
}
找来的,不知道对楼主有用没