Ejemplo n.º 1
0
/*******************************************************************************
 LCD_WR_REG: Set LCD Register  Input: Register addr., Data
*******************************************************************************/
void LCD_WR_REG(unsigned short Reg, unsigned short Data) 
{
  LDC_DATA_OUT=Reg;     //Reg. Addr.
  LCD_RS_LOW();         //RS=0,Piont to Index Reg.
  LCD_nWR_ACT();        //WR Cycle from 1 -> 0 -> 1
  LCD_RS_HIGH();        //RS=1,Piont to object Reg.
  LDC_DATA_OUT=Data;    //Reg. Data 
  LCD_nWR_ACT();        //WR Cycle from 1 -> 0 -> 1
}
Ejemplo n.º 2
0
/*******************************************************************************
Point_SCR: Set display position   Input: X, Y 
*******************************************************************************/
void Point_SCR(unsigned short x0, unsigned short y0) 
{
  LCD_WR_REG(0x0020,y0);
  LCD_WR_REG(0x0021,x0);
  LDC_DATA_OUT=0x0022;  //DRAM Reg.      
  LCD_RS_LOW();             
  LCD_nWR_ACT();        //WR Cycle from 1 -> 0 -> 1
  LCD_nWR_ACT();        //WR Cycle from 1 -> 0 -> 1
  LCD_RS_HIGH();            
}
Ejemplo n.º 3
0
/*******************************************************************************
 LCD_SET_WINDOW: 设置LCD模块上指定的窗口位置。 输入: x0、x1、y0、y1
*******************************************************************************/
void LCD_SET_WINDOW(short x1, short x2,short y1, short y2) 
{
  __LCD_WR_REG(0x0050, y1);
  __LCD_WR_REG(0x0051, y2);
  __LCD_WR_REG(0x0052, x1);
  __LCD_WR_REG(0x0053, x2);
  
  __LCD_WR_REG(0x0020, y1);
  __LCD_WR_REG(0x0021, x1);
  
  LDC_DATA_OUT=0x0022;      //Reg. Addr.
  LCD_RS_LOW();             //RS=0,Piont to Index Reg.
  LCD_nWR_ACT();            //WR Cycle from 1 -> 0 -> 1
  LCD_nWR_ACT();            //WR Cycle from 1 -> 0 -> 1
  LCD_RS_HIGH();            //RS=1,Piont to object Reg.
}
Ejemplo n.º 4
0
/*******************************************************************************
 Set_Pixel: Set a Pixel  Input: Color
*******************************************************************************/
void Set_Pixel(unsigned short Color) 
{
  LDC_DATA_OUT=Color;   //Color Data
  LCD_nWR_ACT();        //WR Cycle from 1 -> 0 -> 1
}
Ejemplo n.º 5
0
/*******************************************************************************
 LCD  initializtion 
*******************************************************************************/
void LCD_Initial(void)
{   
  //------------------------- Reset LCD Driver ---------------------//
  LCD_DATA_BUS_OUT();   //Set LCD Data Bus as Output Mode
  LCD_nWR_HIGH();
  LCD_nRD_HIGH();       
  LCD_RS_HIGH();        //RS=1        
  LCD_nRST_HIGH(); 
  Delayms(1);           //RST=1£¬Delay 1ms      
  LCD_nRST_LOW(); 
  Delayms(1);          //RST=0 Reset LCD£¬Delay 1ms      
  LCD_nRST_HIGH(); 
  Delayms(5);          //RST=1£¬Delay 5 ms  
 //----------------ST7781 Internal Register Initial------------//         
  LCD_WR_REG(0x00FF, 0x0001);  
  LCD_WR_REG(0x00F3, 0x0008);  
  LDC_DATA_OUT=0x00F3;     
  LCD_RS_LOW();         
  LCD_nWR_ACT();       //Read Parameter      
  LCD_RS_HIGH();        
 //-------------------Display Control Setting-----------------//
  LCD_WR_REG(0x0001, 0x0100);    //Output Direct 
  LCD_WR_REG(0x0002, 0x0700);    //Line Inversion
  LCD_WR_REG(0x0003, 0x0030);    //BGR=0,ID=11
  LCD_WR_REG(0x0008, 0x0302);    //Porch Setting
  LCD_WR_REG(0x0009, 0x0000);    //Scan Cycle
  LCD_WR_REG(0x000A, 0x0000);    //FMARK off
 //----------------power Control Register Initial------------//
  LCD_WR_REG(0x0010, 0x0790);    //Power Control1
  LCD_WR_REG(0x0011, 0x0005);    //Power Control2
  LCD_WR_REG(0x0012, 0x0000);    //Power Control3
  LCD_WR_REG(0x0013, 0x0000);    //Power Control4
  Delayms(100);                  //Delay 100ms   
  LCD_WR_REG(0x0010, 0x12B0);    //Power Control1
  Delayms(50);                   //delay 50ms
  LCD_WR_REG(0x0011, 0x0007);    //Power Control2
  Delayms(50);                   //delay 50ms
  LCD_WR_REG(0x0012, 0x008C);    //Power Control3
  LCD_WR_REG(0x0013, 0x1700);    //Power Control4
  LCD_WR_REG(0x0029, 0x001A);    //VCOMH Setting
  Delayms(50);                   //delay 50ms
 //------------------GAMMA Cluster Setting-------------------//
  LCD_WR_REG(0x0030, 0x0000);
  LCD_WR_REG(0x0031, 0x0507);
  LCD_WR_REG(0x0032, 0x0003);
  LCD_WR_REG(0x0035, 0x0200);
  LCD_WR_REG(0x0036, 0x0106);
  LCD_WR_REG(0x0037, 0x0000);
  LCD_WR_REG(0x0038, 0x0507);
  LCD_WR_REG(0x0039, 0x0104);
  LCD_WR_REG(0x003C, 0x0200);
  LCD_WR_REG(0x003D, 0x0005);
 //------------------Display Windows 240*320-----------------//
  LCD_WR_REG(0x0050, 0x0000);
  LCD_WR_REG(0x0051, 0x00EF);
  LCD_WR_REG(0x0052, 0x0000);
  LCD_WR_REG(0x0053, 0x013F);
 //--------------------Frame Rate Setting--------------------//
  LCD_WR_REG(0x0060, 0xA700);
  LCD_WR_REG(0x0061, 0x0001);
  LCD_WR_REG(0x0090, 0x0033);
  LCD_WR_REG(0x0007, 0x0133);
  Delayms(50);                   //delay 50ms
}