void LCD_Configure(void)
{
GPIO_InitType GPIO_InitStructure;
LCD_InitType LCD_InitStructure;
printf("\r\n%s : %d", __FUNCTION__, __LINE__);
LCD_ClockConfig(LCD_CLK_SRC_LSI);
printf("\r\n%s : %d", __FUNCTION__, __LINE__);
RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOB, ENABLE);
RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOC, ENABLE);
RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOD, ENABLE);
/*
* PB0 : LCD_SEG5
* PB1 : LCD_SEG6
*/
GPIO_InitStruct(&GPIO_InitStructure);
GPIO_InitStructure.Pin = GPIO_PIN_0 | GPIO_PIN_1;
GPIO_InitStructure.GPIO_Pull = GPIO_No_Pull;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Analog;
GPIO_InitStructure.GPIO_Alternate = GPIO_AF10_LCD;
GPIO_InitPeripheral(GPIOB, &GPIO_InitStructure);
/*
* PB10 : LCD_SEG10
* PB11 : LCD_SEG11
* PB12 : LCD_SEG12
* PB13 : LCD_SEG13
* PB14 : LCD_SEG14
* PB15 : LCD_SEG15
*/
GPIO_InitStruct(&GPIO_InitStructure);
GPIO_InitStructure.Pin = GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 |
GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;
GPIO_InitStructure.GPIO_Pull = GPIO_No_Pull;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Analog;
GPIO_InitStructure.GPIO_Alternate = GPIO_AF10_LCD;
GPIO_InitPeripheral(GPIOB, &GPIO_InitStructure);
/*
* PC10 : LCD_COM4
* PC11 : LCD_COM5
* PC12 : LCD_COM6
*/
GPIO_InitStruct(&GPIO_InitStructure);
GPIO_InitStructure.Pin = GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12;
GPIO_InitStructure.GPIO_Pull = GPIO_No_Pull;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Analog;
GPIO_InitStructure.GPIO_Alternate = GPIO_AF10_LCD;
GPIO_InitPeripheral(GPIOC, &GPIO_InitStructure);
/*
* PD2 : LCD_COM7
*/
GPIO_InitStruct(&GPIO_InitStructure);
GPIO_InitStructure.Pin = GPIO_PIN_2;
GPIO_InitStructure.GPIO_Pull = GPIO_No_Pull;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Analog;
GPIO_InitStructure.GPIO_Alternate = GPIO_AF10_LCD;
GPIO_InitPeripheral(GPIOD, &GPIO_InitStructure);
printf("\r\n%s : %d", __FUNCTION__, __LINE__);
LCD_InitStructure.Prescaler = LCD_PRESCALER_4;
LCD_InitStructure.Divider = LCD_DIV_25;
LCD_InitStructure.Duty = LCD_DUTY_1_4;
LCD_InitStructure.Bias = LCD_BIAS_1_3;
LCD_InitStructure.VoltageSource = LCD_VOLTAGESOURCE_INTERNAL;
LCD_InitStructure.Contrast = LCD_CONTRASTLEVEL_3;
LCD_InitStructure.DeadTime = LCD_DEADTIME_0;
LCD_InitStructure.PulseOnDuration = LCD_PULSEONDURATION_1;
LCD_InitStructure.HighDrive = LCD_HIGHDRIVE_DISABLE;
LCD_InitStructure.HighDriveBuffer = LCD_HIGHDRIVEBUFFER_ENABLE;
LCD_InitStructure.BlinkMode = LCD_BLINKMODE_OFF;
LCD_InitStructure.BlinkFreq = LCD_BLINKFREQ_DIV_8;
LCD_InitStructure.MuxSegment = LCD_MUXSEGMENT_DISABLE;
LCD_Init(&LCD_InitStructure);
printf("\r\n%s : %d", __FUNCTION__, __LINE__);
LCD_Write(LCD_RAM1_COM0, 0x00000000, 0xFFFFFFFF);
LCD_Write(LCD_RAM1_COM1, 0x00000000, 0xFFFFFFFF);
LCD_Write(LCD_RAM1_COM2, 0x00000000, 0xFFFFFFFF);
LCD_Write(LCD_RAM1_COM3, 0x00000000, 0xFFFFFFFF);
LCD_Write(LCD_RAM2_COM0, 0x00000000, 0x00000FFF);
LCD_Write(LCD_RAM2_COM1, 0x00000000, 0x00000FFF);
LCD_Write(LCD_RAM2_COM2, 0x00000000, 0x00000FFF);
LCD_Write(LCD_RAM2_COM3, 0x00000000, 0x00000FFF);
LCD_Write(LCD_RAM1_COM4, 0x00000000, 0xFFFFFFFF);
LCD_Write(LCD_RAM1_COM5, 0x00000000, 0xFFFFFFFF);
LCD_Write(LCD_RAM1_COM6, 0x00000000, 0xFFFFFFFF);
LCD_Write(LCD_RAM1_COM7, 0x00000000, 0xFFFFFFFF);
LCD_Write(LCD_RAM2_COM4, 0x00000000, 0x000000FF);
LCD_Write(LCD_RAM2_COM5, 0x00000000, 0x000000FF);
LCD_Write(LCD_RAM2_COM6, 0x00000000, 0x000000FF);
LCD_Write(LCD_RAM2_COM7, 0x00000000, 0x000000FF);
printf("\r\n%s : %d", __FUNCTION__, __LINE__);
LCD_UpdateDisplayRequest();
printf("\r\n%s : %d", __FUNCTION__, __LINE__);
}
在调试时,已经将板子上的VDD与VLCD短接在一起了;如果使用电压,通过调节内部参考电压值,LCD没有任何反应,但在执行LCD_Init和LCD_UpdateDisplayRequest这两个函数时会占用比较长的时间;如果配置成使用外部电压时,此时整个初始化过程会比较快,担LCD依旧没有任何显示……所以想寻网友的帮助,协助分析一下,这到底是怎么回事?