STM8L052驱动LCD字段屏,烧录成功程序后上电复位LCD屏能显示,但是在DEBUG时LCD屏不亮。用万用表测量,DEBUG模式SEG和COM口之间没有压差,上电复位正常显示时压差在1V左右。
DEBUG模式没有打断点,直接全速运行。
求各位大佬指教!!!!!
附程序如下:
void main(void)
{
GPIO_Init(GPIOD,GPIO_Pin_5,GPIO_Mode_Out_PP_Low_Fast);
GPIO_SetBits(GPIOD,GPIO_Pin_5);
/* Configures the LCD GLASS relative GPIO port IOs and LCD peripheral */
LCD_GLASS_Init();
/* Enable RTC clock */
CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
#if 1
/* Configures the RTC */
RTC_WakeUpClockConfig(RTC_WakeUpClock_CK_SPRE_16bits);
RTC_ITConfig(RTC_IT_WUT, ENABLE);
/* Enable general Interrupt*/
enableInterrupts();
#endif
LCD->RAM[LCD_RAMRegister_0] = 0x00;
LCD->RAM[LCD_RAMRegister_0] = 0xff;
LCD->RAM[LCD_RAMRegister_1] = 0x00;
LCD->RAM[LCD_RAMRegister_1] = 0xff;
LCD->RAM[LCD_RAMRegister_2] = 0x00;
LCD->RAM[LCD_RAMRegister_2] = 0xff;
LCD->RAM[LCD_RAMRegister_3] = 0x00;
LCD->RAM[LCD_RAMRegister_3] = 0xff;
LCD->RAM[LCD_RAMRegister_4] = 0x00;
LCD->RAM[LCD_RAMRegister_4] = 0xff;
LCD->RAM[LCD_RAMRegister_5] = 0x00;
LCD->RAM[LCD_RAMRegister_5] = 0xff;
while (1)
{
LCD->RAM[LCD_RAMRegister_0] = 0x00;
LCD->RAM[LCD_RAMRegister_0] = 0xff;
}
}
/**
* @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 */
// CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
/* Enable LCD clock */
CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE);
CLK_RTCClockConfig(CLK_RTCCLKSource_LSE, CLK_RTCCLKDiv_1);
LCD_DeInit();
/* Initialize the LCD */
LCD_Init(LCD_Prescaler_2, LCD_Divider_18, LCD_Duty_1_4,
LCD_Bias_1_2, LCD_VoltageSource_External);//LCD_VoltageSource_InternalLCD_VoltageSource_External
/* Mask register*/
LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0xFF);
LCD_PortMaskConfig(LCD_PortMaskRegister_1, 0x00);
LCD_PortMaskConfig(LCD_PortMaskRegister_2, 0x00);
LCD_PortMaskConfig(LCD_PortMaskRegister_3, 0x00);
LCD_ContrastConfig(LCD_Contrast_Level_7);
LCD_DeadTimeConfig(LCD_DeadTime_0);
LCD_PulseOnDurationConfig(LCD_PulseOnDuration_1);
// Delay_Ms(80);
LCD_Cmd(ENABLE); /*!< Enable LCD peripheral */
}
|