求大神帮帮忙。。。
初始化代码
void LCD_WR_REG(unsigned char Data)
{
OLED_CS_RESET;
OLED_RD_SET;
OLED_RS_RESET;
DATAOUT(Data);
OLED_WR_RESET;
OLED_WR_SET;
OLED_CS_SET;
}
void LCD_WR_DATA (unsigned char Data)
{
OLED_CS_RESET;
OLED_RS_SET;
OLED_RD_SET;
DATAOUT(Data);
OLED_WR_RESET;
OLED_WR_SET;
OLED_CS_SET;
}
void LCD_Init()
{
//LCD RESET
OLED_RST_SET;
delay_ms(1);
OLED_RST_RESET;
delay_ms(20);
OLED_RST_SET;
delay_ms(120);
//LCD Initiate
LCD_WR_REG(0xCF);
LCD_WR_DATA (0x00);
LCD_WR_DATA (0x81);
LCD_WR_DATA (0X30);
LCD_WR_REG(0xED);
LCD_WR_DATA (0x64);
LCD_WR_DATA (0x03);
LCD_WR_DATA (0X12);
LCD_WR_DATA (0X81);
LCD_WR_REG(0xE8);
LCD_WR_DATA (0x85);
LCD_WR_DATA (0x10);
LCD_WR_DATA (0x7A);
LCD_WR_REG(0xCB);
LCD_WR_DATA (0x39);
LCD_WR_DATA (0x2C);
LCD_WR_DATA (0x00);
LCD_WR_DATA (0x34);
LCD_WR_DATA (0x02);
LCD_WR_REG(0xF7);
LCD_WR_DATA (0x20);
LCD_WR_REG(0xEA);
LCD_WR_DATA (0x00);
LCD_WR_DATA (0x00);
LCD_WR_REG(0xC0); //Power control
LCD_WR_DATA (0x21); //VRH[5:0]
LCD_WR_REG(0xC1); //Power control
LCD_WR_DATA (0x11); //SAP[2:0];BT[3:0]
LCD_WR_REG(0xC5); //VCM control
LCD_WR_DATA (0x3F);
LCD_WR_DATA (0x3C);
LCD_WR_REG(0xC7); //VCM control
LCD_WR_DATA (0x9E);
LCD_WR_REG(0x3A); // Memory Access Control
LCD_WR_DATA (0x55);
LCD_WR_REG(0x36); // Memory Access Control
LCD_WR_DATA (0x48);
LCD_WR_REG(0xB1);
LCD_WR_DATA (0x00);
LCD_WR_DATA (0x1B);
LCD_WR_REG(0xB6); // Display Function Control
LCD_WR_DATA (0x0A);
LCD_WR_DATA (0xA2);
LCD_WR_REG(0xF2); // 3Gamma Function Disable
LCD_WR_DATA (0x00);
LCD_WR_REG(0x26); //Gamma curve selected
LCD_WR_DATA (0x01);
LCD_WR_REG(0xE0); //Set Gamma
LCD_WR_DATA (0x0F);
LCD_WR_DATA (0x22);
LCD_WR_DATA (0x1C);
LCD_WR_DATA (0x1B);
LCD_WR_DATA (0x08);
LCD_WR_DATA (0x0F);
LCD_WR_DATA (0x48);
LCD_WR_DATA (0xB8);
LCD_WR_DATA (0x34);
LCD_WR_DATA (0x05);
LCD_WR_DATA (0x0C);
LCD_WR_DATA (0x09);
LCD_WR_DATA (0x0F);
LCD_WR_DATA (0x07);
LCD_WR_DATA (0x00);
LCD_WR_REG(0XE1); //Set Gamma
LCD_WR_DATA (0x00);
LCD_WR_DATA (0x23);
LCD_WR_DATA (0x24);
LCD_WR_DATA (0x07);
LCD_WR_DATA (0x10);
LCD_WR_DATA (0x07);
LCD_WR_DATA (0x38);
LCD_WR_DATA (0x47);
LCD_WR_DATA (0x4B);
LCD_WR_DATA (0x0A);
LCD_WR_DATA (0x13);
LCD_WR_DATA (0x06);
LCD_WR_DATA (0x30);
LCD_WR_DATA (0x38);
LCD_WR_DATA (0x0F);
LCD_WR_REG(0x11); //Exit Sleep
delay_ms(120);;
LCD_WR_REG(0x29); //Display on
}
void LCD_DrawPoint(u16 x,u16 y,u16 color)
{
LCD_WR_REG(0x2A);
LCD_WR_DATA(x>>8);
LCD_WR_DATA(x&0xFF);
LCD_WR_DATA(x>>8);
LCD_WR_DATA(x&0xFF);
LCD_WR_REG(0x2B);
LCD_WR_DATA(y>>8);
LCD_WR_DATA(y&0xFF);
LCD_WR_DATA(y>>8);
LCD_WR_DATA(y&0xFF);
LCD_WR_REG(0x2C);
LCD_WR_DATA(color>>8);
LCD_WR_DATA(color);
}
void LCD_SetArea(u16 stx,u16 sty,u16 endx,u16 endy)
{
LCD_WR_REG(0x2A);
LCD_WR_DATA(stx >> 8);
LCD_WR_DATA(stx & 0xff);
LCD_WR_DATA(endx >> 8);
LCD_WR_DATA(endx & 0xff);
LCD_WR_REG(0x2B);
LCD_WR_DATA(sty >> 8);
LCD_WR_DATA(sty & 0xff);
LCD_WR_DATA(endy >> 8);
LCD_WR_DATA(endy & 0xff);
}
|