本帖最后由 weiweiwsk 于 2013-7-26 15:53 编辑
初用STM8,根据官网上的例子还有网上的一些资料段式液晶驱动流程都差不多,我也是用库函数来驱动的,不知道是不是硬件有问题,只接了一个32768的晶振,另外屏的引脚比较多,因此走线也相对长了点,最长的大概有个5cm.
程序如下:
(时钟部分初始化,官网例子里有这部分)
CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);
RTC_DeInit();
RTC_WakeUpClockConfig(RTC_WakeUpClock_RTCCLK_Div16);
RTC_SetWakeUpCounter(0x400);
RTC_ITConfig(RTC_IT_WUT, ENABLE);
TimingDelay_Init();
(LCD初始化部分,下面的是详细内容)
LCD_GLASS_Init();
CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE);
CLK_RTCClockConfig(CLK_RTCCLKSource_LSE, CLK_RTCCLKDiv_1);
LCD_Init(LCD_Prescaler_2, LCD_Divider_18, LCD_Duty_1_8,
LCD_Bias_1_4, LCD_VoltageSource_Internal);
seg脚全部配上了,有些没有用上
LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0xFF);
LCD_PortMaskConfig(LCD_PortMaskRegister_1, 0xFF);
LCD_PortMaskConfig(LCD_PortMaskRegister_2, 0xFF);
LCD_PortMaskConfig(LCD_PortMaskRegister_3, 0xFF);
LCD_PortMaskConfig(LCD_PortMaskRegister_4, 0xFF);
LCD_PortMaskConfig(LCD_PortMaskRegister_5, 0xFF);
LCD_ContrastConfig(LCD_Contrast_Level_7);
LCD_DeadTimeConfig(LCD_DeadTime_0);
LCD_PulseOnDurationConfig(LCD_PulseOnDuration_1);
LCD_Cmd(ENABLE);
然后就是往RAM里写数据了
while (1)
{
LCD_WriteRAM(LCD_RAMRegister_0,0xFF);
LCD_WriteRAM(LCD_RAMRegister_1,0xFF);
LCD_WriteRAM(LCD_RAMRegister_2,0xFF);
LCD_WriteRAM(LCD_RAMRegister_3,0xFF);
LCD_WriteRAM(LCD_RAMRegister_4,0xFF);
LCD_WriteRAM(LCD_RAMRegister_5,0xFF);
LCD_WriteRAM(LCD_RAMRegister_6,0xFF);
LCD_WriteRAM(LCD_RAMRegister_7,0xFF);
}
但COM口一直没有波型,也没有电压,弄了几天了,求帮助! |