cancel
Showing results for 
Search instead for 
Did you mean: 

stm8l lcd setting

David.Cheng
Associate II

0690X000009Z7tfQAC.pngHOW to code this table?

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/8 Duty, 1/4 Bias
     - LCD frequency = (clock source * Duty) / (Prescaler * Divider)
                     = 114 Hz ==> Frame frequency = 28,5 Hz*/
 
  CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
  /* Enable LCD clock */
  CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE);
  CLK_RTCClockConfig(CLK_RTCCLKSource_LSE, CLK_RTCCLKDiv_1);
 
  /* Initialize the LCD */
  LCD_Init(LCD_Prescaler_4, LCD_Divider_16, LCD_Duty_1_4,
           LCD_Bias_1_3, LCD_VoltageSource_Internal);
 
  /* Mask register*/
  LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0xFF);
  LCD_PortMaskConfig(LCD_PortMaskRegister_1, 0x0F);
  //LCD_PortMaskConfig(LCD_PortMaskRegister_2, 0x00);
  //LCD_PortMaskConfig(LCD_PortMaskRegister_3, 0xFF);
  //LCD_PortMaskConfig(LCD_PortMaskRegister_4, 0xFF);
  //LCD_PortMaskConfig(LCD_PortMaskRegister_5, 0x0F);
 
  LCD_ContrastConfig(LCD_Contrast_Level_7);
 
  //LCD_DeadTimeConfig(LCD_DeadTime_0); 
  LCD_PulseOnDurationConfig(LCD_PulseOnDuration_7);
 
  LCD_Cmd(ENABLE); /*!< Enable LCD peripheral */
}

 call this in main function

LCD_GLASS_Init();
    
    
    LCD->RAM[0] = 0x01;
    LCD->RAM[1] = 0x0f;

nothing shows, the battery voltage is 3.28, I found the power is not enough for lcd

0 REPLIES 0