void SSD1963_initial(void) { u16 i; // Set PLL frequency LCD_WRITE_A0(0xe2); //Set PLL: VCO (> 250MHz) = OSC x (N + 1) LCD_WRITE_A1(MULTIPLIER_N); //Multiplier N, VCO = 360MHz LCD_WRITE_A1(DIVIDER_M); //Divider M, PLL = 120MHz (Standard) LCD_WRITE_A1(0x54); //dummy write, no meaning. PLL = VCO / (M + 1) LCD_WRITE_A0(0xe0); //Command: Set SSD1961 PLL LCD_WRITE_A1(0x01); //Turn on PLL Delay(50); // Delay for PLL stable LCD_WRITE_A0(0xe0); //Command: Set SSD1961 PLL LCD_WRITE_A1(0x03); //Switch the clock source to PLL LCD_WRITE_A0(0x01); //Command: Soft reset SSD1963 Delay(50); // Delay for RESET LCD_WRITE_A0( 0xE6); // pclk = pll freq * (setting + 1) / 0x100000 //Set LSHIFT frequency LCD_WRITE_A1( (LCDC_FPR&0x000F0000)>>16); //Remark: 0x100000 must be divided by (setting+1), otherwise, pclk may oscilate LCD_WRITE_A1( (LCDC_FPR&0x0000FF00)>>8); //pclk = 5MHz LCD_WRITE_A1( (LCDC_FPR&0x000000FF)); //refresh rate = 5MHz / (336 * 244) = 60.98Hz LCD_WRITE_A0( 0xb0); // display period //Set LCD mode / pad strength LCD_WRITE_A1( Polarity); // [B5:0] - 18Bit [B2:1] LSHIFT data latch falling edge [B1:0] LLINE active low [B0:0] - LFRAME active low LCD_WRITE_A1( 0x00); LCD_WRITE_A1( ((Resolution_X-1)&0xFF00)>>8); //0x13F = 320 - 1 (Horizontal) LCD_WRITE_A1( (Resolution_X-1)&0x00FF); LCD_WRITE_A1( ((Resolution_Y-1)&0xFF00)>>8); //0x0ef = 240 - 1 (Vertical) LCD_WRITE_A1( (Resolution_Y-1)&0x00FF); LCD_WRITE_A0( 0xb4); // hsync LCD_WRITE_A1( ((H_Sync_total-1)&0xFF00)>>8); // ht LCD_TOTAL_WIDTH - 1 LCD_WRITE_A1( (H_Sync_total-1)&0x00FF); LCD_WRITE_A1( (H_Sync_to_DE&0x0700)>>8); LCD_WRITE_A1( (H_Sync_to_DE)&0x00FF); // Horizontal Start 8 pclks LCD_WRITE_A1( H_Sync_Pluse_Wide - 1); // pulse width = setting + 1 clock = 2 clock LCD_WRITE_A1( 0x00); LCD_WRITE_A1( 0x00); LCD_WRITE_A0( 0xb6); // vsync LCD_WRITE_A1( ((V_Sync_total-1)&0xFF00)>>8); // vt 244-1 LCD_WRITE_A1( (V_Sync_total-1)&0x00FF); LCD_WRITE_A1( (V_Sync_to_DE&0x0700)>>8); LCD_WRITE_A1( (V_Sync_to_DE)&0x00FF); // Vertical Start Position: 2 line LCD_WRITE_A1( V_Sync_Pluse_Wide - 1); // pulse width = setting + 1 line = 2 line LCD_WRITE_A1( 0x00); LCD_WRITE_A1( 0x00); LCD_WRITE_A0( 0x29); // display on Delay(50); LCD_WRITE_A0( 0xb8); // config gpio LCD_WRITE_A1( 0x0f); LCD_WRITE_A1( 0x01); LCD_WRITE_A0( 0xba); // Set GPIO LCD_WRITE_A1( 0x02); //Set X Address LCD_WRITE_A0( 0x2a); LCD_WRITE_A1( 0x00); LCD_WRITE_A1( 0x00); LCD_WRITE_A1( ((Resolution_X-1) & 0xFF00)>>8); LCD_WRITE_A1( ((Resolution_X-1) & 0x00FF)); //Set Y Address LCD_WRITE_A0( 0x2b); LCD_WRITE_A1( 0x00); LCD_WRITE_A1( 0x00); LCD_WRITE_A1( ((Resolution_Y-1) & 0xFF00)>>8); LCD_WRITE_A1( ((Resolution_Y-1) & 0x00FF)); //Set the read order from frame buffer to the display panel LCD_WRITE_A0( 0x36); LCD_WRITE_A1( 0x00); /* //Set the pwm configuration LCD_WRITE_A0( 0xBE); LCD_WRITE_A1( 0x08); //Set the PWM frequency in system clock 00h = Fastest FFh = Slowest LCD_WRITE_A1( 0xFF); //Set the PWM duty cycle 00h = Always low FFh = Always high LCD_WRITE_A1( 0x01); */ LCD_WRITE_A0( 0xbe);//pwm config LCD_WRITE_A1( 0x03); LCD_WRITE_A1( 0xff); LCD_WRITE_A1( 0x01);//dbc control pwm // LCD_WRITE_A1( 0xFF);//D[7:0] : DBC manual brightness (00 Dimmest FF brightest) // LCD_WRITE_A1( 0x00);//D[7:0] : DBC minimum brightnesss (00 Dimmest FF brightest) // LCD_WRITE_A1( 0x0F);// F[3:0] : Brightness prescaler (0 Dimmest F brightest) LCD_WRITE_A0( 0xd4);//set threshold; LCD_WRITE_A1( 0x00); LCD_WRITE_A1( 0x16); LCD_WRITE_A1( 0x80); LCD_WRITE_A1( 0x00); LCD_WRITE_A1( 0x38); LCD_WRITE_A1( 0x40); LCD_WRITE_A1( 0x00); LCD_WRITE_A1( 0x87); LCD_WRITE_A1( 0x00); LCD_WRITE_A0( 0xd0);//enable dbc LCD_WRITE_A1( 0<<6 | 1<<5 | 1<<2 | 1<<0); // A[6] : ABC bypass 0: ABC is not bypassed 1 ABC is bypassed // A[5] : Transition effect // 0 Transition effect disable 1 Transition effect enable // A[3:2] : Energy saving selection for DBC (POR = 00) // 00 DBC is disable 01 Conservative mode 10 Normal mode 11 Aggressive mode // A[0] : Master enable of ABC and DBC // 0 DBC/ABC is not enabled 1 DBC/ABC is enabled // Set LCD_WRITE_A0( 0xf0); LCD_WRITE_A1( 0x03); /* LCD_WRITE_A0( 0x30); //set_partial_area LCD_WRITE_A1( 000); LCD_WRITE_A1( 100); LCD_WRITE_A1( 000); LCD_WRITE_A1( 200); LCD_WRITE_A0( 0x12); //enter_partial_mode */ }