大家好,我的LCD目前显示是320*240的,我想更改为240*320,初始代码如下:
void STM3210E_LCD_Init(void)
{
/* Configure the LCD Control pins --------------------------------------------*/
LCD_CtrlLinesConfig();
/* Configure the FSMC Parallel interface -------------------------------------*/
LCD_FSMCConfig();
Delay(5); /* delay 50 ms */
/* Start Initial Sequence ----------------------------------------------------*/
LCD_WriteReg(R229,0x8000); /* Set the internal vcore voltage */
LCD_WriteReg(R0, 0x0001); /* Start internal OSC. */
LCD_WriteReg(R1, 0x0100); /* set SS and SM bit */
LCD_WriteReg(R2, 0x0700); /* set 1 line inversion */
LCD_WriteReg(R3, 0x1030); /* set GRAM write direction and BGR=1. */
LCD_WriteReg(R4, 0x0000); /* Resize register */
LCD_WriteReg(R8, 0x0202); /* set the back porch and front porch */
LCD_WriteReg(R9, 0x0000); /* set non-display area refresh cycle ISC[3:0] */
LCD_WriteReg(R10, 0x0000); /* FMARK function */
LCD_WriteReg(R12, 0x0000); /* RGB interface setting */
LCD_WriteReg(R13, 0x0000); /* Frame marker Position */
LCD_WriteReg(R15, 0x0000); /* RGB interface polarity */
/* Power On sequence ---------------------------------------------------------*/
LCD_WriteReg(R16, 0x0000); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
LCD_WriteReg(R17, 0x0000); /* DC1[2:0], DC0[2:0], VC[2:0] */
LCD_WriteReg(R18, 0x0000); /* VREG1OUT voltage */
LCD_WriteReg(R19, 0x0000); /* VDV[4:0] for VCOM amplitude */
Delay(20); /* Dis-charge capacitor power voltage (200ms) */
LCD_WriteReg(R16, 0x17B0); /* SAP, BT[3:0], AP, DSTB, SLP, STB */
LCD_WriteReg(R17, 0x0137); /* DC1[2:0], DC0[2:0], VC[2:0] */
Delay(5); /* Delay 50 ms */
LCD_WriteReg(R18, 0x0139); /* VREG1OUT voltage */
Delay(5); /* Delay 50 ms */
LCD_WriteReg(R19, 0x1d00); /* VDV[4:0] for VCOM amplitude */
LCD_WriteReg(R41, 0x0013); /* VCM[4:0] for VCOMH */
Delay(5); /* Delay 50 ms */
LCD_WriteReg(R32, 0x0000); /* GRAM horizontal Address */
LCD_WriteReg(R33, 0x0000); /* GRAM Vertical Address */
/* Adjust the Gamma Curve ----------------------------------------------------*/
LCD_WriteReg(R48, 0x0006);
LCD_WriteReg(R49, 0x0101);
LCD_WriteReg(R50, 0x0003);
LCD_WriteReg(R53, 0x0106);
LCD_WriteReg(R54, 0x0b02);
LCD_WriteReg(R55, 0x0302);
LCD_WriteReg(R56, 0x0707);
LCD_WriteReg(R57, 0x0007);
LCD_WriteReg(R60, 0x0600);
LCD_WriteReg(R61, 0x020b);
/* Set GRAM area -------------------------------------------------------------*/
LCD_WriteReg(R80, 0x0000); /* Horizontal GRAM Start Address */
LCD_WriteReg(R81, 0x00EF); /* Horizontal GRAM End Address */
LCD_WriteReg(R82, 0x0000); /* Vertical GRAM Start Address */
LCD_WriteReg(R83, 0x013F); /* Vertical GRAM End Address */
LCD_WriteReg(R96, 0x2700); /* Gate Scan Line */
LCD_WriteReg(R97, 0x0001); /* NDL,VLE, REV */
LCD_WriteReg(R106, 0x0000); /* set scrolling line */
/* Partial Display Control ---------------------------------------------------*/
LCD_WriteReg(R128, 0x0000);
LCD_WriteReg(R129, 0x0000);
LCD_WriteReg(R130, 0x0000);
LCD_WriteReg(R131, 0x0000);
LCD_WriteReg(R132, 0x0000);
LCD_WriteReg(R133, 0x0000);
/* Panel Control -------------------------------------------------------------*/
LCD_WriteReg(R144, 0x0010);
LCD_WriteReg(R146, 0x0000);
LCD_WriteReg(R147, 0x0003);
LCD_WriteReg(R149, 0x0110);
LCD_WriteReg(R151, 0x0000);
LCD_WriteReg(R152, 0x0000);
/* Set GRAM write direction and BGR = 1 */
/* I/D=01 (Horizontal : increment, Vertical : decrement) */
/* AM=1 (address is updated in vertical writing direction) */
LCD_WriteReg(R3, 0x1018);
LCD_WriteReg(R7, 0x0173); /* 262K color and display ON */
Delay(5000); //上电延时
}
请问需如何更改? |
|