!memo
起動のコード
http://arduino.densikit.com/jikken-shitsu/lcd/yhy024006a
この辺を見て作った記憶
>> code cpp
#define red 0xf800
#define green 0x07e0
#define blue 0x001f
#define black 0x0000
#define white 0xffff
#define gray 0x8c51
#define yellow 0xFFE0
#define cyan 0x07FF
#define purple 0xF81F
void init_LCD(){
digitalWrite(RD,HIGH);
//digitalWrite(RESET,HIGH);
//delay(1);
//digitalWrite(RESET,LOW);
//delay(5);
//digitalWrite(RESET,HIGH);
delay(10);
Trans_Dat(0x00E3,0x3008); // Set internal timing
Trans_Dat(0x00E7,0x0012);
Trans_Dat(0x00EF,0x1231);
Trans_Dat(0x0001,0x0100); // set SS and SM bit
Trans_Dat(0x0002, 0x0700); // set line inversion
Trans_Dat(0x0003, 0x1030); // set GRAM write direction and BGR=1.
Trans_Dat(0x0004, 0x0000); // Resize register
Trans_Dat(0x0008, 0x0207); // set the back porch and front porch
Trans_Dat(0x0009, 0x0000); // set non-display area refresh cycle ISC[3:0]
Trans_Dat(0x000A, 0x0000); // FMARK function
Trans_Dat(0x000C, 0x0000); // RGB interface setting
Trans_Dat(0x000D, 0x0000); // Frame marker Position
Trans_Dat(0x000F, 0x0000); // RGB interface polarity
//--------------Power On sequence --------------//
Trans_Dat(0x0010, 0x0000); // SAP, BT[3:0], AP[2:0], DSTB, SLP, STB
Trans_Dat(0x0011, 0x0007); // DC1[2:0], DC0[2:0], VC[2:0]
Trans_Dat(0x0012, 0x0000); // VREG1OUT voltage
Trans_Dat(0x0013, 0x0000); // VDV[4:0] for VCOM amplitude
delay(200); // Dis-charge capacitor power voltage
Trans_Dat(0x0010, 0x1490); // SAP, BT[3:0], AP[2:0], DSTB, SLP, STB
Trans_Dat(0x0011, 0x0227); // R11h=0x0221 at VCI=3.3V ,DC1[2:0], DC0[2:0], VC[2:0]
delay(50); // Delayms 50ms
Trans_Dat(0x0012, 0x001c); // External reference voltage= Vci;
delay(50); // Delayms 50ms
Trans_Dat(0x0013, 0x0A00); // R13=0F00 when R12=009E;VDV[4:0] for VCOM amplitude
Trans_Dat(0x0029, 0x000F); // R29=0019 when R12=009E;VCM[5:0] for VCOMH//0012//
Trans_Dat(0x002B, 0x000D); // Frame Rate = 91Hz
delay(50); // Delayms 50ms
Trans_Dat(0x0020, 0x0000); // GRAM horizontal Address
Trans_Dat(0x0021, 0x0000); // GRAM Vertical Address
// ----------- Adjust the Gamma Curve ----------//
Trans_Dat(0x0030, 0x0000);
Trans_Dat(0x0031, 0x0203);
Trans_Dat(0x0032, 0x0001);
Trans_Dat(0x0035, 0x0205);
Trans_Dat(0x0036, 0x030C);
Trans_Dat(0x0037, 0x0607);
Trans_Dat(0x0038, 0x0405);
Trans_Dat(0x0039, 0x0707);
Trans_Dat(0x003C, 0x0502);
Trans_Dat(0x003D, 0x1008);
//------------------ Set GRAM area ---------------//
Trans_Dat(0x0050, 0x0000); // Horizontal GRAM Start Address
Trans_Dat(0x0051, 0x00EF); // Horizontal GRAM End Address
Trans_Dat(0x0052, 0x0000); // Vertical GRAM Start Address
Trans_Dat(0x0053, 0x013F); // Vertical GRAM Start Address
Trans_Dat(0x0060, 0xA700); // Gate Scan Line
Trans_Dat(0x0061, 0x0001); // NDL,VLE, REV
Trans_Dat(0x006A, 0x0000); // set scrolling line
//-------------- Partial Display Control ---------//
Trans_Dat(0x0080, 0x0000);
Trans_Dat(0x0081, 0x0000);
Trans_Dat(0x0082, 0x0000);
Trans_Dat(0x0083, 0x0000);
Trans_Dat(0x0084, 0x0000);
Trans_Dat(0x0085, 0x0000);
//-------------- Panel Control -------------------//
Trans_Dat(0x0090, 0x0010);
Trans_Dat(0x0092, 0x0600); //0x0000
Trans_Dat(0x0093, 0x0003);
Trans_Dat(0x0095, 0x0110);
Trans_Dat(0x0097, 0x0000);
Trans_Dat(0x0098, 0x0000);
Trans_Dat(0x0007, 0x0133); // 262K color and display ON
//Trans_Dat(0x0020, 0);
//Trans_Dat(0x0021, 0);
Trans_Dat_A(0x0022);
Display(red,320,240);
//lcd_Str(0,0,"YHY024006A",cyan,black);
//lcd_Str(1,2,"TEST PROGRAM",white,red);
}
void Display(unsigned int color,int x,int y){
int i,j;
for(i=0;i<y;i++){
for(j = 0; j < x; j++){
//Trans_Dat(0x0022, color);
Trans_Dat_B(color);
}
}
}
<<5643382
wiki
1405178385