[mw_shl_code=c,true]驱动为RM68042,想要整屏显示红色,现在只有背光可以,没有其他现象,麻烦各位帮忙看下驱动程序有何问题,谢谢!
//整屏显示红色
//3.5寸液晶驱动
void LCD_DATA_OUT(unsigned int data)
{
unsigned char data_bit_cnt = 0;
unsigned long temp1 = 0,temp2 = 0;
for(data_bit_cnt = 0;data_bit_cnt < 16; data_bit_cnt++)
{
if(data_bit_cnt < 8)
{
if(BIT_CHK(data,data_bit_cnt))
temp1 |= (1<<(data_bit_cnt + 2));
}
else
{
if(BIT_CHK(data,data_bit_cnt))
temp2 |= (1<<(data_bit_cnt + 7));
}
}
LPC_GPIO0 -> FIOSET |= temp2;
LPC_GPIO2 -> FIOSET |= temp1;
}
//写寄存器函数
void LCD_Write_Command(unsigned int Command)
{
LCD_CS_L;
LCD_RS_L;//Wirte address
LCD_DATA_OUT(Command);
LCD_WR_L;
LCD_WR_H;
LCD_CS_H;
}
void LCD_Wtire_Data(unsigned int data)
{
LCD_RS_H;//Write data
LCD_CS_L;
LCD_DATA_OUT(data);
LCD_WR_L;
LCD_WR_H;
LCD_CS_H;
}
//清屏函数
//color:要清屏的填充色
void LCD_Clear(unsigned int color)
{
int i = 0;
/*
LCD_Write_Command(0X2A);
LCD_Wtire_Data(0X00);//VCI1 VCL VGH VGL DDVDH VREG1OUT power amplitude setting(0X00);
LCD_Wtire_Data(0X00);//VCI1 VCL VGH VGL DDVDH VREG1OUT power amplitude setting(0X00);
LCD_Wtire_Data(0X01);//VCI1 VCL VGH VGL DDVDH VREG1OUT power amplitude setting(0X01);
LCD_Wtire_Data(0XdF);//VCI1 VCL VGH VGL DDVDH VREG1OUT power amplitude setting(0X3F);
LCD_Write_Command(0X2B);
LCD_Wtire_Data(0X00);//VCI1 VCL VGH VGL DDVDH VREG1OUT power amplitude setting(0X00);
LCD_Wtire_Data(0X00);//VCI1 VCL VGH VGL DDVDH VREG1OUT power amplitude setting(0X00);
LCD_Wtire_Data(0X01);//VCI1 VCL VGH VGL DDVDH VREG1OUT power amplitude setting(0X01);
LCD_Wtire_Data(0X3F);//VCI1 VCL VGH VGL DDVDH VREG1OUT power amplitude setting(0XDF);
*/
LCD_Write_Command(0X2C);
for (i=0; i<153600; i++)
{
LCD_Wtire_Data(color);//VCI1 VCL VGH VGL DDVDH VREG1OUT power amplitude setting(color);
}
}
void LCD_Init(void)
{
LCD_Write_Command(0X11);
delayms(20);
LCD_Write_Command(0XD0);//VCI1 VCL VGH VGL DDVDH VREG1OUT power amplitude setting
LCD_Wtire_Data(0X07);
LCD_Wtire_Data(0X42);
LCD_Wtire_Data(0X1D);
LCD_Write_Command(0XD1);//VCOMH VCOM_AC amplitude setting
LCD_Wtire_Data(0X00);
LCD_Wtire_Data(0X1a);
LCD_Wtire_Data(0X09);
LCD_Write_Command(0XD2);//Operational Amplifier Circuit Constant Current Adjust , charge pump frequency setting
LCD_Wtire_Data(0X01);
LCD_Wtire_Data(0X22);
LCD_Write_Command(0XC0);//REV SM GS
LCD_Wtire_Data(0X10);
LCD_Wtire_Data(0X3B);
LCD_Wtire_Data(0X00);
LCD_Wtire_Data(0X02);
LCD_Wtire_Data(0X11);
LCD_Write_Command(0XC5);// Frame rate setting = 72HZ when setting 0x03
LCD_Wtire_Data(0X03);
LCD_Write_Command(0XC8);//Gamma setting
LCD_Wtire_Data(0X00);
LCD_Wtire_Data(0X25);
LCD_Wtire_Data(0X21);
LCD_Wtire_Data(0X05);
LCD_Wtire_Data(0X00);
LCD_Wtire_Data(0X0a);
LCD_Wtire_Data(0X65);
LCD_Wtire_Data(0X25);
LCD_Wtire_Data(0X77);
LCD_Wtire_Data(0X50);
LCD_Wtire_Data(0X0f);
LCD_Wtire_Data(0X00);
LCD_Write_Command(0XF8);
LCD_Wtire_Data(0X01);
LCD_Write_Command(0XFE);
LCD_Wtire_Data(0X00);
LCD_Wtire_Data(0X02);
LCD_Write_Command(0X20);//Exit invert mode
LCD_Write_Command(0X36);
//LCD_Wtire_Data(0X2b);
LCD_Wtire_Data(0X08);//原来是a
LCD_Write_Command(0X3A);
LCD_Wtire_Data(0X55);//16位模式
LCD_Write_Command(0X2b);
LCD_Wtire_Data(0X00);
LCD_Wtire_Data(0X00);
LCD_Wtire_Data(0X01);
LCD_Wtire_Data(0X3F);
LCD_Write_Command(0X2a);
LCD_Wtire_Data(0X00);
LCD_Wtire_Data(0X00);
LCD_Wtire_Data(0X01);
LCD_Wtire_Data(0XdF);
delayms(120);
LCD_Write_Command(0X29);
delayms(50);
LCD_BACKLIGHT_H; //点亮背光
LCD_Clear(RED);
}
int main(void)
{
SystemInit();
PORT_Init();
LCD_Init();
while(1)
{
}
}
[/mw_shl_code]
|