你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

stm32+ssd1963驱动LCD时颜色不对

[复制链接]
Billuncle 提问时间:2014-12-7 13:54 /
stm32+ssd1963驱动LCD时颜色不正常,红色显示正常,白色显示为淡黄色,蓝色显示为黑色,测试波形发现蓝色的LDATA没有波形,怀疑是SSD1963没有设置正确,输出的LDATA的数据位不对。
请问一下3Ah指令一定要设置吗,但我看了很多范列都是无需设置的,新人学习中请高手指点。
收藏 评论5 发布时间:2014-12-7 13:54

举报

5个回答
奔跑小蜗牛 回答时间:2014-12-13 14:40:42
定义每个像素点的数据位数,要设置的。 2014-12-13_143841.jpg
沐紫 回答时间:2014-12-15 15:03:17
楼主问题如何了
wamcncn 回答时间:2014-12-16 21:43:25
STM32+SSD1963 驱动 4.3" LCD( 480*272) 初始化代码,已调试通过。


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  
}

找来的,不知道对楼主有用没
小贾-370388 回答时间:2014-12-17 09:15:22
这个真得专家给解决一下 帮顶
whaidong123 回答时间:2019-2-20 15:30:14
WriteData(0x0000); 这个语句对我帮助很大,我的问题是  红色和蓝色刚好对反过来了,改了就正常了。

所属标签

相似问题

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32Cube扩展软件包
意法半导体边缘AI套件
ST - 理想汽车豪华SUV案例
ST意法半导体智能家居案例
STM32 ARM Cortex 32位微控制器
关注我们
st-img 微信公众号
st-img 手机版