下面是官方时钟框图和datasheet例程及配套源代码,正常的思维是输入时钟除以分配即为LCD的时钟:32.768/2/18=910.22 ,但是官方是228;datasheet提供的计算方法和源代码也不一样当然他们的计算结果是一样的!
datasheet上还说LCDclk是RTCclk的一半但是这样算出来结果还是差一倍。
2.png (62.53 KB, 下载次数: 0)
下载附件
2018-12-19 16:59 上传
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_Level_7);
LCD_DeadTimeConfig(LCD_DeadTime_0);
LCD_PulseOnDurationConfig(LCD_PulseOnDuration_1);
LCD_Cmd(ENABLE); /*!< Enable LCD peripheral */
}
一周热门 更多>