当前位置:网站首页>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;}}
边栏推荐
猜你喜欢
随机推荐
微信小程序错误 undefined Expecting ‘STRING‘,‘NUMBER‘,‘NULL‘,‘TRUE‘,‘FALSE‘,‘{‘,‘[‘, got ]解决方案
考证必看 | PMP扫盲贴+PMP材料
Kubernetes 资源编排系列之二: Helm 篇
【CUDA】版本自由切换
设计分享|基于单片机的P0口驱动LED闪烁
PHP 正则给img的src添加域名
(codeforce547)C-Mike and Foam(质因子+容斥原理)
WeChat small program "decompiled" combat "behind to unpack the eggs
PMP考点有哪些啊?
有了国产 DevOps 工具 ,还怕数字化转型成本高?
Dynamic Host Configuration Protocol DHCP (DHCPv4)
DHCP的防御机制——DHCP Snooping(DHCP监听)
从洞察到决策,一文解读标签画像体系建设方法论丨DTVision分析洞察篇
C language library function summary2019.10.31
Introduction to Qt (5) - file operation, hotkey and mouse reading (implementation of txt window)
iptables firewall content full solution
-Wl,--start-group ... -Wl,--end-group for resolving circular dependencies of several libraries
wps表格分两页断开怎么办?wps表格分两页断开的解决方法
2022牛客多校六 A-Array(构造+哈夫曼)
2022杭电多校五 C - Slipper (dijkstra+虚拟结点)