STM8L152让LCD显示需要设置哪些东西

[复制链接]
6511|6
 楼主| RexZheng 发表于 2010-12-7 16:45 | 显示全部楼层 |阅读模式
STM8L152让LCD显示需要设置哪些东西?我把LCD控制器的寄存器全部一一设置了还是没显示,郁闷了
ST_ARM 发表于 2010-12-7 17:20 | 显示全部楼层
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_PCKENR2 |= 0x08;        // Enable LCD clock
        CLK_CRTCR = 0x22;                // Set HSI as LCD clock and it is divided by 2

        // Initialize the LCD
        LCD_FRQ = LCD_Prescaler_64;        // Set the prescaler as ClKinput/2
        LCD_FRQ |= LCD_Divider_18;                // Set the divider as CLKprescaler/18
        LCD_CR1 = LCD_Duty_1_4;                // Set the duty as 1/4 duty
        LCD_CR1 |= LCD_Bias_1_3;                // Set the bias as 1/3 bias
        LCD_CR2 = LCD_VoltageSource_Internal;// Set Internal voltage source for LCD

        // Mask register
        LCD_PM0 = 0xFF;
        LCD_PM1 = 0x3F;
        LCD_PM2 = 0xFF;
        LCD_PM3 = 0xFF;

        LCD_CR2 |= LCD_Contrast_3V3;        // Select the maximum voltage value Vlcd

        LCD_CR3 |= LCD_DeadTime_0;        // Srt the dead time
        LCD_CR2 |= LCD_PulseOnDuration_6;        // Set the pulses on duration

        LCD_CR3 |= LCD_CR3_LCDEN;        // Enable the LCD peripheral
}
 楼主| RexZheng 发表于 2010-12-8 16:12 | 显示全部楼层
是不是寄存器设置好后往LCDRAM里写数据就会显示了
 楼主| RexZheng 发表于 2010-12-8 16:13 | 显示全部楼层
但是我设置后依然不会显示,测量COM端口一直是低电平,感觉LCD驱动没工作一样,不知是怎么回事
honami520 发表于 2010-12-11 11:44 | 显示全部楼层
呵呵,看看我发的帖子,里面就有LCD的驱动的!
 楼主| RexZheng 发表于 2010-12-11 11:47 | 显示全部楼层
嘿嘿,已经解决了,内部时钟没设置对
libsam 发表于 2016-7-18 17:11 | 显示全部楼层
对不起你好,请问当初你的内部时钟是怎么设置的,我也遇到当初与您同样的问题。lcd就是没反应
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3

主题

25

帖子

1

粉丝
快速回复 在线客服 返回列表 返回顶部