当前位置:网站首页>STM8L LCD digital tube driver, thermometer LCD display
STM8L LCD digital tube driver, thermometer LCD display
2022-08-08 23:07:00 【Jacky_Lu】
Starting the LCD driver stm8 supports 4com 28 seg and can display 28*4=112 dots of LCD
void LCD_Configuration(void){/* Enable RTC CLK */CLK_PeripheralClockConfig(CLK_Peripheral_RTC, ENABLE);/* Choice CLK Source, HSI_Freq = 16M, RTC_Freq = 500Khz*/CLK_RTCClockConfig(CLK_RTCCLKSource_HSI, CLK_RTCCLKDiv_32);/* Enable LCD CLK */CLK_PeripheralClockConfig(CLK_Peripheral_LCD, ENABLE);/* Frequency = 500K/(32+16)? Frame_Freq = Frequency/Duty = 60Hz */LCD_Init(LCD_Prescaler_32, LCD_Divider_16, LCD_Duty_1_4,LCD_Bias_1_3, LCD_VoltageSource_Internal);/* Enable PM */LCD_PortMaskConfig(LCD_PortMaskRegister_0, 0xFF);LCD_PortMaskConfig(LCD_PortMaskRegister_1, 0x0F);LCD_PortMaskConfig(LCD_PortMaskRegister_2, 0x00);LCD_PortMaskConfig(LCD_PortMaskRegister_3, 0x00);LCD_PortMaskConfig(LCD_PortMaskRegister_4, 0x00);LCD_PortMaskConfig(LCD_PortMaskRegister_5, 0x00);/*??LCD_Contrast_Level_7: Medium Density / High Density Maximum Voltage = 3.30V / 3.51V */LCD_ContrastConfig(LCD_Contrast_Level_7);/* No dead time */LCD_DeadTimeConfig(LCD_DeadTime_0);/*?LCD_PulseOnDuration_7: Pulse ON duration = 7/CLKprescaler */LCD_PulseOnDurationConfig(LCD_PulseOnDuration_7);LCD_Cmd(ENABLE);}Make bit table according to lcd wiring


#define CS(com,seg) (com*28+seg)#define SMG(NUM) CS(3,2+NUM*2),CS(2,2+NUM*2),CS(1,2+NUM*2),CS(0,1+NUM*2),CS(1,1+NUM*2),CS(3,1+NUM*2),CS(2,1+NUM*2) //The first digital tubeconst INT8U DispBitTab[]={SMG(0),SMG(1),SMG(2),SMG(3),};Create a character table corresponding to the digital tube
#define BIT0 0#define BIT1 1#define BIT2 2#define BIT3 3#define BIT4 4#define BIT5 5#define BIT6 6#define BIT7 7#define LedSeg_a ( 1<Display the program of the nixie tube
void dis_bcd(INT8U led_id, INT8U num) //Display subroutine{INT8U i,pos;led_id*=7;num=lednumTab[num];for(i=0;i<7;i++){pos=DispBitTab[led_id];if(num&1)LCD->RAM[pos/8]|=BitTab[pos%8];elseLCD->RAM[pos/8]&=~BitTab[pos%8];++led_id;num>>=1;}}边栏推荐
猜你喜欢

wps a3格式怎么转换成a4?wps a3格式转换成a4的方法

WeChat applet wx:for loop output example

Kubernetes与OpenStack

线性筛求积性函数

(2022牛客多校五)B-Watches(二分)

2022牛客多校六 J-Number Game(简单推理)

postman request+加密解密

Introduction to Qt (5) - file operation, hotkey and mouse reading (implementation of txt window)

Hi3516 使用 wifi模块

2022牛客多校六 A-Array(构造+哈夫曼)
随机推荐
Porting ucos2 code from stm32 to GD32
如何搭建一套自己公司的知识共享平台
ArcPy elements batch to dwg
flutter 书写json解析类
数组去重的几种方法
使用Mongoose populate实现多表关联存储与查询,内附完整代码
LeetCode:最长有效括号
2022杭电多校六 1006-Maex (树形DP)
postman request+加密解密
C language library function summary2019.10.31
用工具实现 Mock API 的整个流程
你了解你每天都在用的NAT吗?
Hi3516 use wifi module
人人熟知的IPV6竟然还有这么多细节
Introduction to Qt (4) - Continuous playback of pictures (the use of two timers)
2022牛客多校六 J-Number Game(简单推理)
The concept of GIL and pools
word文档标题怎么自动编号?
Excuse me: is it safe to pay treasure to buy fund on
ArcPy set the unique identification code