void lcd_init(void) { LCD_Init(LCD_Prescaler_2, LCD_Divider_16, LCD_Duty_1_4, LCD_Bias_1_3, LCD_VoltageSource_Internal); LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0xff); LCD_PortMaskConfig(LCD_PortMaskRegister_1,0xff); LCD_PortMaskConfig(LCD_PortMaskRegister_2,0x03); LCD_PulseOnDurationConfig(LCD_PulseOnDuration_1); LCD_Cmd(ENABLE); LCD_ContrastConfig(LCD_Contrast_Level_5); };
void startLcd() { int i; long j; CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE); CLK_RTCClockConfig(CLK_RTCCLKSource_LSI, CLK_RTCCLKDiv_1); CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE); LCD_Init(LCD_Prescaler_1, LCD_Divider_31, LCD_Duty_1_4, LCD_Bias_1_3, LCD_VoltageSource_Internal); LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0xff); LCD_PortMaskConfig(LCD_PortMaskRegister_1, 0xff); LCD_PortMaskConfig(LCD_PortMaskRegister_2, 0xff); LCD_ContrastConfig(LCD_Contrast_3V0); LCD_DeadTimeConfig(LCD_DeadTime_0); LCD_PulseOnDurationConfig(LCD_PulseOnDuration_1); LCD_Cmd(ENABLE); }
void LCD_SC_Init(void) { /* Enable LCD clock */ CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE); 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_8, LCD_Bias_1_4, LCD_VoltageSource_Internal); /* Mask register*/ LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0xff); LCD_PortMaskConfig(LCD_PortMaskRegister_1, 0x3f); LCD_ContrastConfig(LCD_Contrast_Level_7); LCD_PulseOnDurationConfig(LCD_PulseOnDuration_7); /* Enable LCD peripheral */ LCD_Cmd(ENABLE); }