資源簡介
STM8L驅動LCD 和顯示函數
CPU是STM8L152
代碼片段和文件信息
/**********************************************************************************
//概述:?
//作者:??????時間:?2013-03-22??17:47???地點:日晞科技研發部
//CPU型號:????系統主頻:
//版本號:
***********************************************************************************/
/**********************************************************************************
文件包含區
***********************************************************************************/
#include?“driver-PCB.h“
#include?“time.h“
#include?“stm8l15x.h“
#include?“logic.h“
#include?“LCD.h“
/**********************************************************************************
常量定義區
***********************************************************************************/
/**********************************************************************************
公共變量定義去
***********************************************************************************/
const?unsigned?char?LCD_SEG[10]?=?{0x3f0x060x5b0x4f0x660x6d0x7d0x070x7f0x6f};
/**********************************************************************************
私有變量定義區
***********************************************************************************/
/**********************************************************************************
外部變量聲明區
***********************************************************************************/
/**********************************************************************************
測試變量定義區
***********************************************************************************/
/**********************************************************************************
功能代碼定義區
***********************************************************************************/
/*************************************************
??Function:???????//?
??Description:????//?
??Input:??????????//?LCD初始化
??????????????????//?
??Output:?????????//?
??Return:?????????//?
??Others:?????????//?
*************************************************/
void?LCD_init?(?void?)
{
??/*?Enable?LCD/RTC?clock?*/
??CLK_PeripheralClockConfig(CLK_Peripheral_RTC?ENABLE);
??CLK_PeripheralClockConfig(CLK_Peripheral_LCD?ENABLE);
??
??#ifdef?USE_LSE
????CLK_RTCClockConfig(CLK_RTCCLKSource_LSE?CLK_RTCCLKDiv_1);
??#else
????CLK_RTCClockConfig(CLK_RTCCLKSource_LSI?CLK_RTCCLKDiv_1);
??#endif
??
??/*?Initialize?the?LCD?*/
??LCD_Init(LCD_Prescaler_1?LCD_Divider_31?LCD_Duty_1_4?
????????????????????????????????????LCD_Bias_1_4?LCD_VoltageSource_External);
??
??/*?Mask?register
??For?declare?the?segements?used.
??in?the?Discovery?we?use?0?to?23?segments.?*/
??LCD_PortMaskConfig(LCD_PortMaskRegister_0?0xfe);????//seg1~seg7
??LCD_PortMaskConfig(LCD_PortMaskRegister_1?0xff);????//seg8~seg15
??LCD_PortMaskConfig(LCD_PortMaskRegister_2?0x00);
??
??/*?To?set?contrast?to?mean?value?*/
??LCD_ContrastConfig(LCD_Contrast_3V3);
??
??LCD_DeadTimeConfig(LCD_DeadTime_1);
??LCD_PulseOnDurationConfig(LCD_PulseOnDuration_7);
??
??/*?Enable?LCD?peripher
- 上一篇:歸一化子程序智能車
- 下一篇:一級倒立擺的PID控制設計
評論
共有 條評論