最近用STM8L152驱动3.3V的LCD但发现STM8输出的电压只有供电电压的一半
程序如下:
void LCD_Config(void)
{CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE);
CLK_RTCClockConfig(CLK_RTCCLKSource_LSE, CLK_RTCCLKDiv_1);
LCD_Init(LCD_Prescaler_1, LCD_Divider_31, LCD_Duty_1_4,
LCD_Bias_1_3, LCD_VoltageSource_External);
//选择seg8-seg15作为LCD段码输入端(stm8l152K6 32pin 无SEG0-SEG7)
//特别注意:STM8L152K6只有4个COM,且固定在PA4\5\6和PD1端口
LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0);
LCD_PortMaskConfig(LCD_PortMaskRegister_1, 0xFF);
LCD_PortMaskConfig(LCD_PortMaskRegister_2, 0);
LCD_PortMaskConfig(LCD_PortMaskRegister_3, 0);
LCD_PortMaskConfig(LCD_PortMaskRegister_4, 0);
LCD_PortMaskConfig(LCD_PortMaskRegister_5, 0);
LCD_ContrastConfig(LCD_Contrast_Level_7);
//LCD_ContrastConfig(LCD_Contrast_3V0);
LCD_DeadTimeConfig(LCD_DeadTime_0);
LCD_PulseOnDurationConfig(LCD_PulseOnDuration_1);
LCD_Cmd(ENABLE);
}
|