确认过板子的硬件没有问题,能用IO口直接驱动点亮。用芯片内部驱动就会出问题。以下是我的初始化代码:
void LCD_GLASS_Init(void)
{
LCD_InitTypeDef LCD_InitStructure;
LCD_GPIOConfig(); /*!< Configure the LCD Glass GPIO pins */
/*!< Configure the LCD interface -------------------------------------------*/
RCC_APB1PeriphClockCmd(RCC_APB1Periph_LCD, ENABLE); /*!< Enable LCD APB1 Clock */
LCD_InitStructure.LCD_Prescaler = LCD_Prescaler_8;
LCD_InitStructure.LCD_Divider = LCD_Divider_16;
LCD_InitStructure.LCD_Duty = LCD_Duty_1_8;
LCD_InitStructure.LCD_Bias = LCD_Bias_1_4;
LCD_InitStructure.LCD_VoltageSource = LCD_VoltageSource_Internal;
LCD_Init( LCD_InitStructure);
//LCD_HighDriveCmd(ENABLE);
/*!< Configure the Pulse On Dura
tion*/
LCD_PulseOnDurationConfig(LCD_PulseOnDuration_2);
/*!< Configure the LCD Contrast (3.51V) */
LCD_ContrastConfig(LCD_Contrast_Level_4);
/*!< Wait Until the LCD FCR register is synchronized */
LCD_WaitForSynchro();
/*!< Enable LCD peripheral */
LCD_Cmd(ENABLE);
/*!< Wait Until the LCD is enabled */
while(LCD_GetFlagStatus(LCD_FLAG_ENS) == RESET)
{
}
/*!< Wait Until the LCD Booster is ready */
while(LCD_GetFlagStatus(LCD_FLAG_RDY) == RESET)
{
}
}