这是时序,从上到下,分别是CS、SLK 、DC、 SDI
从上到下是CS SLK RESET
硬件也检查了,数据都输入到了屏幕里。但是屏幕一直只是亮屏,不能刷屏,感觉是没有初始化成功。但是找不到原因了,求助大神帮帮忙!!
程序是从STM32移植到dsp28335的
以下是程序
#define LCD_SDI GpioDataRegs.GPADAT.bit.GPIO16
#define LCD_SCK GpioDataRegs.GPADAT.bit.GPIO18
#define LCD_CS GpioDataRegs.GPADAT.bit.GPIO19
#define LCD_REST GpioDataRegs.GPADAT.bit.GPIO2
#define LCD_DC GpioDataRegs.GPADAT.bit.GPIO3
main()
{
InitSysCtrl();
DINT;//禁止CPU中断
InitPieCtrl();//初始化PIE控制寄存器
IER = 0x0000;//清除所有中断标志位
IFR = 0x0000;
InitPieVectTable();//初始化中断向量表
EALLOW;
GpioCtrlRegs.GPAMUX1.all = 0x00000000; // All GPIO
GpioCtrlRegs.GPAMUX2.all = 0x00000000; // All GPIO
GpioCtrlRegs.GPADIR.bit.GPIO2=1;
GpioCtrlRegs.GPADIR.bit.GPIO3=1;
GpioCtrlRegs.GPADIR.bit.GPIO16=1;
GpioCtrlRegs.GPADIR.bit.GPIO18=1;
GpioCtrlRegs.GPADIR.bit.GPIO19=1;
EDIS;
Lcd_Init();
LCD_Clear(WHITE);
BACK_COLOR=BLACK;;POINT_COLOR=WHITE;
while(1)
{
Lcd_Init();
LCD_Clear(RED);
delay_ms(1000);
LCD_Clear(GREEN);
delay_ms(1000);
LCD_Clear(BLUE);
delay_ms(1000);
showhanzi32(0,0,0);
showhanzi32(40,0,1);
showhanzi32(80,0,2);
delay_ms(1000);
}
}
void Lcd_Init(void)
{
LCD_CS =1;
LCD_REST=1;
delay_ms(300);
LCD_REST=0;
delay_ms(500); // delay 20 ms
LCD_REST=1;
delay_ms(300); // delay 20 ms
LCD_CS=0;
LCD_WR_REG(0xCF);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0xD9);
LCD_WR_DATA8(0X30);
LCD_WR_REG(0xED);
LCD_WR_DATA8(0x64);
LCD_WR_DATA8(0x03);
LCD_WR_DATA8(0X12);
LCD_WR_DATA8(0X81);
LCD_WR_REG(0xE8);
LCD_WR_DATA8(0x85);
LCD_WR_DATA8(0x10);
LCD_WR_DATA8(0x78);
LCD_WR_REG(0xCB);
LCD_WR_DATA8(0x39);
LCD_WR_DATA8(0x2C);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x34);
LCD_WR_DATA8(0x02);
LCD_WR_REG(0xF7);
LCD_WR_DATA8(0x20);
LCD_WR_REG(0xEA);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x00);
LCD_WR_REG(0xC0); //Power control
LCD_WR_DATA8(0x21); //VRH[5:0]
LCD_WR_REG(0xC1); //Power control
LCD_WR_DATA8(0x12); //SAP[2:0];BT[3:0]
LCD_WR_REG(0xC5); //VCM control
LCD_WR_DATA8(0x32);
LCD_WR_DATA8(0x3C);
LCD_WR_REG(0xC7); //VCM control2
LCD_WR_DATA8(0XC1);
LCD_WR_REG(0x36); // Memory Access Control
LCD_WR_DATA8(0x08);
LCD_WR_REG(0x3A);
LCD_WR_DATA8(0x55);
LCD_WR_REG(0xB1);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x18);
LCD_WR_REG(0xB6); // Display Function Control
LCD_WR_DATA8(0x0A);
LCD_WR_DATA8(0xA2);
LCD_WR_REG(0xF2); // 3Gamma Function Disable
LCD_WR_DATA8(0x00);
LCD_WR_REG(0x26); //Gamma curve selected
LCD_WR_DATA8(0x01);
LCD_WR_REG(0xE0); //Set Gamma
LCD_WR_DATA8(0x0F);
LCD_WR_DATA8(0x20);
LCD_WR_DATA8(0x1E);
LCD_WR_DATA8(0x09);
LCD_WR_DATA8(0x12);
LCD_WR_DATA8(0x0B);
LCD_WR_DATA8(0x50);
LCD_WR_DATA8(0XBA);
LCD_WR_DATA8(0x44);
LCD_WR_DATA8(0x09);
LCD_WR_DATA8(0x14);
LCD_WR_DATA8(0x05);
LCD_WR_DATA8(0x23);
LCD_WR_DATA8(0x21);
LCD_WR_DATA8(0x00);
LCD_WR_REG(0XE1); //Set Gamma
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x19);
LCD_WR_DATA8(0x19);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x12);
LCD_WR_DATA8(0x07);
LCD_WR_DATA8(0x2D);
LCD_WR_DATA8(0x28);
LCD_WR_DATA8(0x3F);
LCD_WR_DATA8(0x02);
LCD_WR_DATA8(0x0A);
LCD_WR_DATA8(0x08);
LCD_WR_DATA8(0x25);
LCD_WR_DATA8(0x2D);
LCD_WR_DATA8(0x0F);
LCD_WR_REG(0x11); //Exit Sleep
delay_ms(120);
LCD_WR_REG(0x29); //Display on
LCD_Clear(WHITE);
}
void LCD_WR_DATA8(char da)
{
int i;
LCD_DC=1;
LCD_CS=0;
for (i = 0; i < 8; i++) {
if (da & 0x80) {
LCD_SDI=1;
} else
LCD_SDI=0;
LCD_SCK=0;
LCD_SCK=1;
da <<= 1;
}
LCD_CS=1;
}
void LCD_WR_DATA(int da)
{
LCD_WR_DATA8(da >> 8);
LCD_WR_DATA8(da);
}
void LCD_WR_REG(char da)
{
int i;
LCD_DC=0;
LCD_CS=0;
for (i = 0; i < 8; i++) {
if (da & 0x80) {
LCD_SDI=1;
} else
LCD_SDI=0;
LCD_SCK=0;
LCD_SCK=1;
da <<= 1;
}
LCD_CS=1;
}
void LCD_WR_REG_DATA(int reg,int da)
{
LCD_WR_REG(reg);
LCD_WR_DATA(da);
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
请问会不会是波形的问题?我觉得波形有点丑,不知道有没有影响呢?
一周热门 更多>