您现在的位置是:首页 > 单片机

ST7636的驱动程序

2020-01-27 02:15:26

ST7636. 132RGBx132 65K Color CSTN Driver IC. Key Features. n 396 segment outputs / 132 common outputs. n Capacity: 132x132x16 bits=278784 bits.

函数解析:

 void writec(UINT8 cmd) //写CMD

 void writed(UINT8 lcddata) //写DATA

   void lcd_init(void)
{
    
  
               
    api_vLcdInit(LCM_INTERFACE_8080); //选择模式
       XBYTE[0xF400] = 0x88;    //降低频率 因为这是一款低速屏,频率太快电影放不出来
       XBYTE[0xF401] = 0x88;    //降低频率 因为这是一款低速屏,频率太快电影放不出来

     
       api_vLcdPinSelect();

        lcdrest=1;
       delay(10);
       lcdrest=0;
       delay(10);
        lcdrest=1;

         
  
         writec(0x30);    //EXT = 0 
         writec(0x04);    //sleep in/out preparaTIon
         writed(0x3e);    //iniTIalize sleep-out sequencing
         writed(0x31);    //EXT = 1
         writec(0xf4);    //iniTIal preparaTIon
         writed(0x58);    //initialize sequencing
         writec(0x30);    //EXT = 0   
         writec(0x94);    //sleep out
         writec(0xD1);    //OSC on
         writec(0xCA);    //display control
         writed(0x00);    //CL dividing ratio = 0
         writed(0x1F);    //duty
         writed(0x00);    //N-Line Low Byte
         writec(0x31);    //EXT=1
         writec(0xf3);    //N-Line High Byte
         writed(0x01);    //N-Line Value
         writec(0x30);    //EXT=0
         writec(0xBB);    //com scan direc. = 0~65 / 131~66
         writed(0x00);    //
         writec(0x31);    //EXT = 1
         writec(0x32);    //analog
         writed(0x00);    //OSC freq
         writed(0x01);    //0x01   booster effic.
         writed(0x00);    //  0x00  bias***************
         writec(0x30);    //EXT = 0
         writec(0x81);    //EC control
         writed(0x06);    //vop[5:0]// 0x12
         writed(0x04);    //vop[8:6]
         writec(0x20);    //power control
         writed(0x0B);    //D0 = regulator / D1 = follwer / D3 = booster
         writec(0x30);    //EXT = 0
         writec(0x60);    //Close Auto sampling
         writec(0x31);    //EXT = 1
         writec(0xCD);    //
         writed(0x00);    //EEPROM Enable
         delay(50);     //delay 50mS
         writec(0xFD);    //EEPROM read
         delay(50);     //delay 50mS
         writec(0xCC);    //EEPROM disable
         writec(0x30);    //EXT = 0
         writec(0xA7);    //inverse display
         writec(0xBC);    //data scan direc.
         writed(0x02);    //address scan direc.
         writed(0x01);    //BGR
         writed(0x01);    //gray scale
         writec(0xAF);    //display on
         writec(0x15);    //column range
         writed(0x04);    //start
         writed(131);           //end
         writec(0x75);    //page range
         writed(0x04);    //start
         writed(131);            //end
         writec(0x31);    //EXT = 1
        
         writec(0x20);    //gamma
         writed(0x00);    ////********************
         writed(0x02);    //
         writed(0x04);    //
         writed(0x06);    //
         writed(0x08);    //
         writed(0x0a);    //
         writed(0x0c);    //
         writed(0x0e);    //
         writed(0x10);    //
         writed(0x12);    //
         writed(0x14);    //
         writed(0x16);    //
         writed(0x18);    //
         writed(0x1a);    //
         writed(0x1c);    //
         writed(0x1e);    //
                          
         writec(0x21);    //gamma
         writed(0x00);    ////********************
         writed(0x02);    //
         writed(0x04);    //
         writed(0x06);    //
         writed(0x08);    //
         writed(0x0a);    //
         writed(0x0c);    //
         writed(0x0e);    //
         writed(0x10);    //
         writed(0x12);    //
         writed(0x14);    //
         writed(0x16);    //
         writed(0x18);    //
         writed(0x1a);    //
         writed(0x1c);    //
         writed(0x1e);    //
                          
         writec(0x22);    //gamma
         writed(0x00);    ////********************
         writed(0x02);    //
         writed(0x04);    //
         writed(0x06);    //
         writed(0x08);    //
         writed(0x0a);    //
         writed(0x0c);    //
         writed(0x0e);    //
         writed(0x10);    //
         writed(0x12);    //
         writed(0x14);    //
         writed(0x16);    //
         writed(0x18);    //
         writed(0x1a);    //
         writed(0x1c);    //
         writed(0x1e);    //
                          
         writec(0x23);    //gamma
         writed(0x00);    ////********************
         writed(0x02);    //
         writed(0x04);    //
         writed(0x06);    //
         writed(0x08);    //
         writed(0x0a);    //
         writed(0x0c);    //
         writed(0x0e);    //
         writed(0x10);    //
         writed(0x12);    //
         writed(0x14);    //
         writed(0x16);    //
         writed(0x18);    //
         writed(0x1a);    //
         writed(0x1c);    //
         writed(0x1e);    //
          
         writec(0x30);    //ext=0
       api_vLcdPinRecover();
}

void lcd_set_rw_area(UINT8 x, UINT8 y, UINT8 w, UINT8 h)//设置显示区域
{
 api_vLcdPinSelect();
 
    writec(0x15);  //set column start cmd
    writed(x+CSTN_OFFSET);       //set column start address
    writed(x+w+CSTN_OFFSET-1);      //set column end address

    writec(0x75);  //set column start cmd
    writed(y); //set column start address
    writed(y+h-1);      //set column end address
   
    writec(0x5c);  //entry menory write mode
 
 api_vLcdPinRecover();
}

void lcd_set_disply_mode(UINT8 mode) //设置显示模式
{
 api_vLcdPinSelect();
 writec(0xBC);
 writed(mode);
 writed(0x01);
 writed(0x01);
 api_vLcdPinRecover(); 
}