本帖最后由 FAQ 于 2014-3-26 12:25 编辑
MCU:stm8L152驱动LCD。
下面是固件库里面的例子代码。
怀疑注释(红色部分的计算结果228Hz和57Hz)是错误的。
我认为应该是下面这样的。
LCD frequency =455Hz
Frame frequency = 455/4=113Hz。
做过的朋友你们有没有注意到这个问题。
/**
* @brief Configures the LCD GLASS relative GPIO port IOs and LCD peripheral.
* @param None
* @retval None
*/
void LCD_GLASS_Init(void)
{
/*
The LCD is configured as follow:
- clock source = LSE (32.768 KHz)
- Voltage source = Internal
- Prescaler = 2
- Divider = 18 (16 + 2)
- Mode = 1/4 Duty, 1/3 Bias
- LCD frequency = (clock source * Duty) / (Prescaler * Divider)
= 228 Hz ==> Frame frequency = 57 Hz */
/* Enable LCD clock */
CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE);
CLK_RTCClockConfig(CLK_RTCCLKSource_LSE, CLK_RTCCLKDiv_1);
/* Initialize the LCD */
LCD_Init(LCD_Prescaler_2, LCD_Divider_18, LCD_Duty_1_4,
LCD_Bias_1_3, LCD_VoltageSource_Internal);
/* Mask register*/
LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0xFF);
LCD_PortMaskConfig(LCD_PortMaskRegister_1, 0xFF);
LCD_PortMaskConfig(LCD_PortMaskRegister_2, 0xFF);
LCD_PortMaskConfig(LCD_PortMaskRegister_3, 0xFF);
LCD_ContrastConfig(LCD_Contrast_3V3);
LCD_DeadTimeConfig(LCD_DeadTime_0);
LCD_PulseOnDurationConfig(LCD_PulseOnDuration_1);
LCD_Cmd(ENABLE); /*!< Enable LCD peripheral */
}
|