电路设计,软件开发,专业项目团队承接电子产品开发!


ISPRO下载型编程器
火爆销售中

RS232/TTL转换器
全IC串口窃电

RS232/TTL转换线
全IC串口窃电

ByteBlasterMV Cable
CPLD/FPGA并口下载线

ByteBlaster II Cable ISPRO下载型编程器
支持S51/AVR/PIC
超级51开发板套件
前卫实用超值

PC/MCU/CPLD
三合一学习套件

全新万年历方案
AVR单片机开发板
 

Min51单片机仿真机
迷你型

ARM7开发板
仅售260元!
 

RS-232/RS-485双向接口电平转换器  

51单片机升级STM32
火爆销售中
MPLAB-ICD2
火爆销售中
LED51开发板
玩具又名图文显示棒

面板模块/开发板
经济危机明智决择

       

GSM MODEM GSM猫

SMS短信模块 工业级/全自动
火爆销售中

大功率数传电台

高速数传电台

您当前位置:电子技术资料 -> 外围驱动 -> LCD液晶显示 ->

祝您阅读愉快!

ISPRO下载型编程器

RS232 TO TTL转换器
↑↑本文相关产品介绍↑↑

STM32+SSD1963驱动


类别:技术文章
来源:未知
作者:未知
关键字:SSD1963
加入日期:2013-3-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 :off(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
}

您可能还会关注的相关技术资料:

中国电子网
www.EC66.com
QQ:34740080 EMAIL:iloveaoe@163.com
最佳浏览:1024*768
Copyright (C) 2001-2010 EC66.COM All Rights Reserved
Aoe/帝国 制作维护
粤ICP备11071661号