int LCD_RD_DATA(void)
{
int i,data=0;
LCD_DC=1;
LCD_CS=0;
for (i = 7; i >= 0; i--) {
data+=LCD_SDO<
LCD_SCK=0;
LCD_SCK=1;
}
LCD_CS=1;
return data;
}
void Lcd_Init(void)
{
int ID;
LCD_CS =1;
LCD_REST=1;
delay_ms(300);
LCD_REST=0;
delay_ms(500); // delay 20 ms
LCD_REST=1;
delay_ms(300); // delay 20 ms
//读取41
LCD_WR_REG(0XD3);
ID = LCD_RD_DATA(); //dummy read
ID= LCD_RD_DATA(); //读到0X00
ID=LCD_RD_DATA(); //读取93
ID<<=8;
ID|=LCD_RD_DATA();
LCD_CS=0;
LCD_WR_REG(0xCF);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0xD9);
LCD_WR_DATA8(0X30);
LCD_WR_REG(0xED);
LCD_WR_DATA8(0x64);
LCD_WR_DATA8(0x03);
LCD_WR_DATA8(0X12);
LCD_WR_DATA8(0X81);
LCD_WR_REG(0xE8);
LCD_WR_DATA8(0x85);
LCD_WR_DATA8(0x10);
LCD_WR_DATA8(0x78);
LCD_WR_REG(0xCB);
LCD_WR_DATA8(0x39);
LCD_WR_DATA8(0x2C);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x34);
LCD_WR_DATA8(0x02);
LCD_WR_REG(0xF7);
LCD_WR_DATA8(0x20);
LCD_WR_REG(0xEA);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x00);
LCD_WR_REG(0xC0); //Power control
LCD_WR_DATA8(0x21); //VRH[5:0]
LCD_WR_REG(0xC1); //Power control
LCD_WR_DATA8(0x12); //SAP[2:0];BT[3:0]
LCD_WR_REG(0xC5); //VCM control
LCD_WR_DATA8(0x32);
LCD_WR_DATA8(0x3C);
LCD_WR_REG(0xC7); //VCM control2
LCD_WR_DATA8(0XC1);
LCD_WR_REG(0x36); // Memory Access Control
LCD_WR_DATA8(0x08);
LCD_WR_REG(0x3A);
LCD_WR_DATA8(0x55);
LCD_WR_REG(0xB1);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x18);
LCD_WR_REG(0xB6); // Display Function Control
LCD_WR_DATA8(0x0A);
LCD_WR_DATA8(0xA2);
LCD_WR_REG(0xF2); // 3Gamma Function Disable
LCD_WR_DATA8(0x00);
LCD_WR_REG(0x26); //Gamma curve selected
LCD_WR_DATA8(0x01);
LCD_WR_REG(0xE0); //Set Gamma
LCD_WR_DATA8(0x0F);
LCD_WR_DATA8(0x20);
LCD_WR_DATA8(0x1E);
LCD_WR_DATA8(0x09);
LCD_WR_DATA8(0x12);
LCD_WR_DATA8(0x0B);
LCD_WR_DATA8(0x50);
LCD_WR_DATA8(0XBA);
LCD_WR_DATA8(0x44);
LCD_WR_DATA8(0x09);
LCD_WR_DATA8(0x14);
LCD_WR_DATA8(0x05);
LCD_WR_DATA8(0x23);
LCD_WR_DATA8(0x21);
LCD_WR_DATA8(0x00);
LCD_WR_REG(0XE1); //Set Gamma
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x19);
LCD_WR_DATA8(0x19);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x12);
LCD_WR_DATA8(0x07);
LCD_WR_DATA8(0x2D);
LCD_WR_DATA8(0x28);
LCD_WR_DATA8(0x3F);
LCD_WR_DATA8(0x02);
LCD_WR_DATA8(0x0A);
LCD_WR_DATA8(0x08);
LCD_WR_DATA8(0x25);
LCD_WR_DATA8(0x2D);
LCD_WR_DATA8(0x0F);
LCD_WR_REG(0x11); //Exit Sleep
delay_ms(120);
LCD_WR_REG(0x29); //Display on
LCD_Clear(WHITE);
}
没有找到读ID的程序,这是我自己写的读取ID的程序,现在读到的都是0。
int LCD_RD_DATA(void)
{
int i,data=0;
LCD_DC=1;
LCD_CS=0;
for (i = 7; i >= 0; i--) {
data+=LCD_SDO<
LCD_SCK=0;
LCD_SCK=1;
}
LCD_CS=1;
return data;
}
void Lcd_Init(void)
{
int ID;
LCD_CS =1;
LCD_REST=1;
delay_ms(300);
LCD_REST=0;
delay_ms(500); // delay 20 ms
LCD_REST=1;
delay_ms(300); // delay 20 ms
//读取41
LCD_WR_REG(0XD3);
ID = LCD_RD_DATA(); //dummy read
ID= LCD_RD_DATA(); //读到0X00
ID=LCD_RD_DATA(); //读取93
ID<<=8;
ID|=LCD_RD_DATA();
LCD_CS=0;
LCD_WR_REG(0xCF);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0xD9);
LCD_WR_DATA8(0X30);
LCD_WR_REG(0xED);
LCD_WR_DATA8(0x64);
LCD_WR_DATA8(0x03);
LCD_WR_DATA8(0X12);
LCD_WR_DATA8(0X81);
LCD_WR_REG(0xE8);
LCD_WR_DATA8(0x85);
LCD_WR_DATA8(0x10);
LCD_WR_DATA8(0x78);
LCD_WR_REG(0xCB);
LCD_WR_DATA8(0x39);
LCD_WR_DATA8(0x2C);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x34);
LCD_WR_DATA8(0x02);
LCD_WR_REG(0xF7);
LCD_WR_DATA8(0x20);
LCD_WR_REG(0xEA);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x00);
LCD_WR_REG(0xC0); //Power control
LCD_WR_DATA8(0x21); //VRH[5:0]
LCD_WR_REG(0xC1); //Power control
LCD_WR_DATA8(0x12); //SAP[2:0];BT[3:0]
LCD_WR_REG(0xC5); //VCM control
LCD_WR_DATA8(0x32);
LCD_WR_DATA8(0x3C);
LCD_WR_REG(0xC7); //VCM control2
LCD_WR_DATA8(0XC1);
LCD_WR_REG(0x36); // Memory Access Control
LCD_WR_DATA8(0x08);
LCD_WR_REG(0x3A);
LCD_WR_DATA8(0x55);
LCD_WR_REG(0xB1);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x18);
LCD_WR_REG(0xB6); // Display Function Control
LCD_WR_DATA8(0x0A);
LCD_WR_DATA8(0xA2);
LCD_WR_REG(0xF2); // 3Gamma Function Disable
LCD_WR_DATA8(0x00);
LCD_WR_REG(0x26); //Gamma curve selected
LCD_WR_DATA8(0x01);
LCD_WR_REG(0xE0); //Set Gamma
LCD_WR_DATA8(0x0F);
LCD_WR_DATA8(0x20);
LCD_WR_DATA8(0x1E);
LCD_WR_DATA8(0x09);
LCD_WR_DATA8(0x12);
LCD_WR_DATA8(0x0B);
LCD_WR_DATA8(0x50);
LCD_WR_DATA8(0XBA);
LCD_WR_DATA8(0x44);
LCD_WR_DATA8(0x09);
LCD_WR_DATA8(0x14);
LCD_WR_DATA8(0x05);
LCD_WR_DATA8(0x23);
LCD_WR_DATA8(0x21);
LCD_WR_DATA8(0x00);
LCD_WR_REG(0XE1); //Set Gamma
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x19);
LCD_WR_DATA8(0x19);
LCD_WR_DATA8(0x00);
LCD_WR_DATA8(0x12);
LCD_WR_DATA8(0x07);
LCD_WR_DATA8(0x2D);
LCD_WR_DATA8(0x28);
LCD_WR_DATA8(0x3F);
LCD_WR_DATA8(0x02);
LCD_WR_DATA8(0x0A);
LCD_WR_DATA8(0x08);
LCD_WR_DATA8(0x25);
LCD_WR_DATA8(0x2D);
LCD_WR_DATA8(0x0F);
LCD_WR_REG(0x11); //Exit Sleep
delay_ms(120);
LCD_WR_REG(0x29); //Display on
LCD_Clear(WHITE);
}
没有找到读ID的程序,这是我自己写的读取ID的程序,现在读到的都是0。
举报