?? drvlcd_driver.cqm.c
字號:
*LCD_CONTROL = lcdcontrolreg;
return (timeoutchk);
}
void SingleCmd(unsigned char i) //WSK, TEST2
/* send the value in the accumulator to LCD driver as a command*/
{
if (LcdDrv_HalfFullChk() == 0)
*LCD_INST_BYTE=i;
}
void SingleData(unsigned char i)
/* send the value in the accumulator to LCD driver as a command*/
{
if (LcdDrv_HalfFullChk() == 0)
*LCD_DATA_BYTE=i;
}
void SetContrast (unsigned char Step) //WSK, TEST2
{
// SingleCmd(LCD_INTREG_RATIO | (0x0f & Gain)); //set internal resistor ratio
SingleCmd(0x25); //set Contrast Control Register
SingleData(Step);
}
/************************************************************************
* function void drvLcd_WriteInstruct(U8 kInstruct)
* input kInstruct : the LCD instruction, it should change value according
* different LCD and different instruction
* this function will make the LCD_RS=0,write a instruction to LCD
* follow use 51 MCU to control LCD,when use ARM.it should change
****************************************************************************/
void drvLcd_WriteInstruct(U8 kInstruct)
{
SingleCmd(kInstruct);
}
/************************************************************************
* function drvLcd_WriteData(U8 kShowData)
* input kShowData : the LCD data, it should change value according
* different LCD and different instruction
* this function will make the LCD_RS=10,write a instruction to LCD
* follow use 51 MCU to control LCD,when use ARM.it should change
****************************************************************************/
void drvLcd_WriteData(U8 kShowData)
{
SingleData(kShowData);
}
/************************************************************************
* function drvLcd_SetPageColumn(U8 kPage,U8 kColumn)
* it will fix the display at kPage and the kColumn of the LCD
* input kPage : the value should be 0-7,select the LCD page
* kColumn:the value should be 0-128,select the LCD column
****************************************************************************/
void drvLcd_SetPageColumn(U8 Sx,U8 Sy)
{
/*kColumn += 4; // adjusted for different LCD modules.
drvLcd_WriteInstruct(kPage+0xb0);
drvLcd_WriteInstruct((kColumn>>4)&0x0f|0x10);
drvLcd_WriteInstruct(kColumn&0x0f);*/
Coladd_master(Sx,Sx+8);
Pagadd_master(Sy,Sy+16);
}
//**********cqm add driver *************
//*********pcf8833 *********************
void InitLCD(void)
{
//lcd_main_contrast=0x1c;
//LCD_HardwareReset();
//PmuDrv_SetLcdClk(PMU_LCDCLOCK_4M );//
LcdDrv_Initialise( 0 );
InitLCD_MASTER();
}
//inttial the pcf8833//
void InitLCD_MASTER(void) /*Initialize 65k color LCD;Driver IC:Philips pcf8833U*/
{
#ifdef arimalcd
GpioDrv_SetOut(GPIO_nRESET_LCD);
GpioDrv_SetHigh(GPIO_nRESET_LCD);
//Delayus(10);
GpioDrv_SetLow(GPIO_nRESET_LCD);
//Delayus(10);
GpioDrv_SetHigh(GPIO_nRESET_LCD);
/*-------turn on Backlight Voltage-------------*/
drvLcd_Backlight(0);
/*---------MAKE BACKLIGHT ON ------------------ */
GpioDrv_SetOut(GPIO_BACKLIGHT);
GpioDrv_SetHigh(GPIO_BACKLIGHT);
/*---------Disable Factory Defaults---------*/
drvLcd_WriteInstruct(0xee);
/*---------Display off------------------*/
drvLcd_WriteInstruct(0x28);
/*---------Booster Voltage off------------------*/
drvLcd_WriteInstruct(0x02);
/*---------Set Multiplication = 3X----------*/
drvLcd_WriteInstruct(0xc2);
drvLcd_WriteData(0x01);
/*---------------Set VOP-------------------*/
drvLcd_WriteInstruct(0xb0);
drvLcd_WriteData(0x06);
drvLcd_WriteData(0x10);
/*---------------Set Bias----------------*/
drvLcd_WriteInstruct(0xc7);
drvLcd_WriteData(0x05);
/*---------Set Frame Frequency-----------*/
drvLcd_WriteInstruct(0xc5);
drvLcd_WriteData(0x15);
drvLcd_WriteData(0x15);
drvLcd_WriteData(0x15);
drvLcd_WriteData(0x15);
/*-----Temperature Compensation Set------*/
drvLcd_WriteInstruct(0xc3);
drvLcd_WriteData(0x00);
drvLcd_WriteInstruct(0xc4);
drvLcd_WriteData(0x00);
/*-----------Set Contrast-----------------*/
drvLcd_WriteInstruct(0x25);
drvLcd_WriteData(00);
/*---------------Sleep Out--------------*/
drvLcd_WriteInstruct(0x11);
/*-----Color Interface Pixel Format 16bit/pixel------*/
drvLcd_WriteInstruct(0x3a);
#ifdef color16bit
drvLcd_WriteData(0x05);
#endif
#ifdef color12bit
drvLcd_WriteData(0x03);
#endif
/*----------Booster Voltage ON---------*/
drvLcd_WriteInstruct(0x03);
/*----------Temperature ON---------*/
drvLcd_WriteInstruct(0xBF);
/*------------Display ON-------------*/
drvLcd_WriteInstruct(0x29);
/*------Normal Display Mode ON-------*/
drvLcd_WriteInstruct(0x13);
/*----------Display Inversion ON----------*/
drvLcd_WriteInstruct(0x21);
/*-----------N_line Inversion------------*/
drvLcd_WriteInstruct(0xc9);
drvLcd_WriteData(0x25);
/*--------Super Frame Inversion ON--------*/
drvLcd_WriteInstruct(0xb9);
/*-------Memory Data Access Control--------*/
drvLcd_WriteInstruct(0x36);
drvLcd_WriteData(0x00); //Delayus(1); /* MY=0;MX=0;V=0;LAO=0 RGB=0*/
/*---------------BRS = 0-----------------*/
drvLcd_WriteInstruct(0xb4);
/*---------------TRS = 0-----------------*/
drvLcd_WriteInstruct(0xb6);
#endif
#ifdef Nanyalcd
GpioDrv_SetOut(GPIO_nRESET_LCD);
GpioDrv_SetHigh(GPIO_nRESET_LCD);
//Delayus(10);
GpioDrv_SetLow(GPIO_nRESET_LCD);
//Delayus(10);
GpioDrv_SetHigh(GPIO_nRESET_LCD);
/*-------turn on Backlight Voltage-------------*/
//drvLcd_Backlight(0);
/*---------MAKE BACKLIGHT ON ------------------ */
// GpioDrv_SetOut(GPIO_BACKLIGHT);
//GpioDrv_SetHigh(GPIO_BACKLIGHT);
/*---------Software restart---------*/
// drvLcd_WriteInstruct(0x01);
/*---------Disable Factory Defaults---------*/
drvLcd_WriteInstruct(0xee); //
/*---------Display off------------------*/
drvLcd_WriteInstruct(0x28);
/*---------Booster Voltage off------------------*/
drvLcd_WriteInstruct(0x02);
/*---------Set Multiplication = 3X----------*/
drvLcd_WriteInstruct(0xc2); //
drvLcd_WriteData(0x00);
/*---------------Set VOP-------------------*/
drvLcd_WriteInstruct(0xb0); //
drvLcd_WriteData(0x03);
drvLcd_WriteData(0x05);
/*---------------Set Bias----------------*/
drvLcd_WriteInstruct(0xc7); //
drvLcd_WriteData(0x01);
/*---------Set Frame Frequency-----------*/
drvLcd_WriteInstruct(0xc5); //
drvLcd_WriteData(0x16);
drvLcd_WriteData(0x16);
drvLcd_WriteData(0x16);
drvLcd_WriteData(0x16);
/*-----Temperature Compensation Set------*/
drvLcd_WriteInstruct(0xc3); //
drvLcd_WriteData(0x00);
drvLcd_WriteInstruct(0xc4);
drvLcd_WriteData(0x01);
/*-----------Set Contrast-----------------*/
drvLcd_WriteInstruct(0x25); //
drvLcd_WriteData(gfmAPP_Nvdata_Local.LCD_Contrast);//martin modify
/*---------------Sleep Out--------------*/
drvLcd_WriteInstruct(0x11); //
/*-----Color Interface Pixel Format 16bit/pixel------*/
drvLcd_WriteInstruct(0x3a);
#ifdef color16bit
drvLcd_WriteData(0x05);
#endif
#ifdef color12bit
drvLcd_WriteData(0x03);
#endif
/*----------Booster Voltage ON---------*/
drvLcd_WriteInstruct(0x03);
/*----------Temperature ON---------*/
drvLcd_WriteInstruct(0xBF);
/*------------Display ON-------------*/
drvLcd_WriteInstruct(0x29);
/*------Normal Display Mode ON-------*/
drvLcd_WriteInstruct(0x13);
/*----------Display Inversion ON----------*/
drvLcd_WriteInstruct(0x21); //
/*-----------N_line Inversion------------*/
drvLcd_WriteInstruct(0xc9);
drvLcd_WriteData(0x0d);
/*--------Super Frame Inversion ON--------*/
drvLcd_WriteInstruct(0xb9); //
/*-------Memory Data Access Control--------*/
drvLcd_WriteInstruct(0x36); //
drvLcd_WriteData(0x00); //Delayus(1); /* MY=0;MX=0;V=0;LAO=0 RGB=0*/
/*---------------BRS = 0-----------------*/
drvLcd_WriteInstruct(0xb4);
/*---------------TRS = 0-----------------*/
drvLcd_WriteInstruct(0xb6);
#endif
#ifdef huarilcd
/*-------turn on Backlight Voltage-------------*/
drvLcd_Backlight(0);
/*---------MAKE BACKLIGHT ON ------------------ */
GpioDrv_SetOut(GPIO_BACKLIGHT);
GpioDrv_SetHigh(GPIO_BACKLIGHT);
/*----------- Software Reset -------------- */
drvLcd_WriteInstruct(0x01);
/*---------Disable Factory Defaults---------*/
drvLcd_WriteInstruct(0xee);
/*---------Set Multiplication = 5X----------*/
drvLcd_WriteInstruct(0xc2);
drvLcd_WriteData(0x03);
/*---------------Set VOP-------------------*/
drvLcd_WriteInstruct( 0xb0);
drvLcd_WriteData(0x02);
drvLcd_WriteData(0x1f);
/*---------------Set Bias----------------*/
drvLcd_WriteInstruct(0xc7);
drvLcd_WriteData(0x03);
/*---------Set Frame Frequency-----------*/
drvLcd_WriteInstruct(0xc5);
drvLcd_WriteData(0x38);
drvLcd_WriteData(0x20);
drvLcd_WriteData(0x25);
drvLcd_WriteData(0x23);
/*-----Temperature Compensation Set------*/
drvLcd_WriteInstruct(0xc3);
drvLcd_WriteData(0x34);
drvLcd_WriteInstruct(0xc4);
drvLcd_WriteData(0x75);
/*-----------Set Contrast-----------------*/
drvLcd_WriteInstruct(0x25);
drvLcd_WriteData(0x1c) ; //lcd_main_contrast
/*---------------Sleep Out--------------*/
drvLcd_WriteInstruct(0x11);
/*-----Color Interface Pixel Format 16bit/pixel------*/
drvLcd_WriteInstruct(0x3a);
#ifdef color16bit
drvLcd_WriteData(0x05);
#endif
#ifdef color12bit
drvLcd_WriteData(0x03);
#endif
/*----------Booster Voltage ON---------*/
drvLcd_WriteInstruct(0x03);
/*------------Display ON-------------*/
drvLcd_WriteInstruct(0x29);
/*------Normal Display Mode ON-------*/
drvLcd_WriteInstruct(0x13);
/*----------Display Inversion ON----------*/
drvLcd_WriteInstruct(0x21);
/*-----------N_line Inversion------------*/
drvLcd_WriteInstruct(0xc9);
drvLcd_WriteData(0x25);
/*--------Super Frame Inversion ON--------*/
drvLcd_WriteInstruct(0xb9);
/*-------Memory Data Access Control--------*/
drvLcd_WriteInstruct(0x36);
drvLcd_WriteData(0x48); /* MY=0;MX=1;V=0;LAO=0 */
/*---------------BRS = 0-----------------*/
drvLcd_WriteInstruct(0xb4);
/*---------------TRS = 0-----------------*/
drvLcd_WriteInstruct(0xb8);
#endif
void Writeram_master(void)
{
drvLcd_WriteInstruct(0x2c);
}
void Coladd_master(int start,int end)
{
/* Column Address--X axial:4 to 131; start <= end */
drvLcd_WriteInstruct(0x2a);
drvLcd_WriteData((U8)(start));
drvLcd_WriteData((U8)(end));
}
//set Y cordinate
void Pagadd_master(int sta, int end)
{
/* Page Address--Y axial: 0 to 127; sta <= en */
drvLcd_WriteInstruct(0x2b);
drvLcd_WriteData((U8)(sta));
drvLcd_WriteData((U8)(end));
}
void drawhline(int startx,int starty,int endx,int endy,char R,char G,char B)
{ int i;
Coladd_master(startx,endx);
Pagadd_master(starty,endy);
drvLcd_WriteInstruct(0x2c); //write lcd data ram command
for(i=0;i<(endx-startx);i++)
{
Dispcolor_master(R,G,B,1);
}
}
void drawvline(int startx,int starty,int endx,int endy,char R,char G,char B)
{ int i;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -