2022年stm寄存器版显示 .pdf

上传人:Che****ry 文档编号:34879766 上传时间:2022-08-19 格式:PDF 页数:8 大小:51.85KB
返回 下载 相关 举报
2022年stm寄存器版显示 .pdf_第1页
第1页 / 共8页
2022年stm寄存器版显示 .pdf_第2页
第2页 / 共8页
点击查看更多>>
资源描述

《2022年stm寄存器版显示 .pdf》由会员分享,可在线阅读,更多相关《2022年stm寄存器版显示 .pdf(8页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、对应 6 个 IO 口VCC 和 GND 自己接/.h 文件#ifndef _5110_H #define _5110_H #include sys.h #define N5110_CE_H() GPIOC-BSRR|=1BRR|=1BSRR|=1BRR|=1BSRR|=1BRR|=1BSRR|=1BRR|=1BSRR|=1BRR|=1BSRR|=1BRR|=11; #define uint u16 #define uchar u8 void Write_Data(uchar DC,uchar Data); void write_zuobiao(uchar X,uchar Y); void C

2、lean_Screen(void); void write_char(char c); void write_string(char *string); void delay_5110(uint x); void N5110_Init(void); void display_word(uchar x ,uchar y , uchar *p); void display_num_v(uchar x , uchar y , uint num); void display_num_add(uchar x , uchar y , uint num); void display_num_ad(uchar

3、 x , uchar y , uint num); void display_num_a(uchar x , uchar y , uint num); /.C 文件void gp_Init(void);/ 初始化#endif #include #include 5110.h void gp_Init(void) RCC-APB2ENR|=1APB2ENR|=1CRL&=0X00FFFFFF; GPIOC-CRL|=0X33000000;/PA2-7 推挽输出GPIOC-CRH&=0XFFFFFF00; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - -

4、 - - - - - 名师精心整理 - - - - - - - 第 1 页,共 8 页 - - - - - - - - - GPIOC-CRH|=0X00000033;/PA2-7 推挽输出GPIOB-CRL&=0XFFFFFF00; GPIOB-CRL|=0X00000033;/PA2-7 推挽输出GPIOC-ODR|=1ODR|=1ODR|=1ODR|=1ODR|=1ODR|=11; /PA7 输出高 /一个字符占8 行 5 列/BL pb1 /clk pb0 /din pc6 /dc pc7 /rst pc8 /ce pc9 u8 ap=0 x40,0 x20,0 xF8,0 x07,0

5、 x40,0 x20,0 x18,0 x0F, 0 x08,0 xC8,0 x08,0 x08,0 x28,0 x18,0 x00,0 x00, 0 x00,0 x00,0 xFF,0 x00,0 x00,0 x08,0 x04,0 x43, 0 x80,0 x7F,0 x00,0 x01,0 x06,0 x0C,0 x00,0 x00; uchar ascii_dot = / ASCII 表 0 x00,0 x00,0 x00,0 x00,0 x00, / - - 0 x00,0 x00,0 x5F,0 x00,0 x00, / -!- 0 x00,0 x07,0 x00,0 x07,0 x

6、00, / - 0 x14,0 x7F,0 x14,0 x7F,0 x14, / -#- 0 x24,0 x2E,0 x7B,0 x2A,0 x12, / -$- 0 x23,0 x13,0 x08,0 x64,0 x62, / -%- 0 x36,0 x49,0 x56,0 x20,0 x50, / -&- 0 x00,0 x04,0 x03,0 x01,0 x00, / - 0 x00,0 x1C,0 x22,0 x41,0 x00, / -(- 0 x00,0 x41,0 x22,0 x1C,0 x00, / -)- 0 x22,0 x14,0 x7F,0 x14,0 x22, / -*

7、- 0 x08,0 x08,0 x7F,0 x08,0 x08, / -+- 0 x40,0 x30,0 x10,0 x00,0 x00, / -,- 0 x08,0 x08,0 x08,0 x08,0 x08, / - 0 x00,0 x60,0 x60,0 x00,0 x00, / -.- 0 x20,0 x10,0 x08,0 x04,0 x02, / -/- 0 x3E,0 x51,0 x49,0 x45,0 x3E, / -0- 0 x00,0 x42,0 x7F,0 x40,0 x00, / -1- 0 x62,0 x51,0 x49,0 x49,0 x46, / -2- 0 x2

8、1,0 x41,0 x49,0 x4D,0 x33, / -3- 0 x18,0 x14,0 x12,0 x7F,0 x10, / -4- 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 8 页 - - - - - - - - - 0 x27,0 x45,0 x45,0 x45,0 x39, / -5- 0 x3C,0 x4A,0 x49,0 x49,0 x31, / -6- 0 x01,0 x71,0 x09,0 x05,0 x03, / -7- 0 x36,0 x49

9、,0 x49,0 x49,0 x36, / -8- 0 x46,0 x49,0 x49,0 x29,0 x1E, / -9- 0 x00,0 x36,0 x36,0 x00,0 x00, / -:- 0 x40,0 x36,0 x36,0 x00,0 x00, / -;- 0 x08,0 x14,0 x22,0 x41,0 x00, / - 0 x02,0 x01,0 x59,0 x05,0 x02, / -?- 0 x3E,0 x41,0 x5D,0 x55,0 x5E, / - 0 x7C,0 x12,0 x11,0 x12,0 x7C, / -A- 0 x7F,0 x49,0 x49,0

10、 x49,0 x36, / -B- 0 x3E,0 x41,0 x41,0 x41,0 x22, / -C- 0 x7F,0 x41,0 x41,0 x41,0 x3E, / -D- 0 x7F,0 x49,0 x49,0 x49,0 x41, / -E- 0 x7F,0 x09,0 x09,0 x09,0 x01, / -F- 0 x3E,0 x41,0 x51,0 x51,0 x72, / -G- 0 x7F,0 x08,0 x08,0 x08,0 x7F, / -H- 0 x00,0 x41,0 x7F,0 x41,0 x00, / -I- 0 x20,0 x40,0 x41,0 x3F

11、,0 x01, / -J- 0 x7F,0 x08,0 x14,0 x22,0 x41, / -K- 0 x7F,0 x40,0 x40,0 x40,0 x40, / -L- 0 x7F,0 x02,0 x0C,0 x02,0 x7F, / -M- 0 x7F,0 x04,0 x08,0 x10,0 x7F, / -N- 0 x3E,0 x41,0 x41,0 x41,0 x3E, / -O- 0 x7F,0 x09,0 x09,0 x09,0 x06, / -P- 0 x3E,0 x41,0 x51,0 x21,0 x5E, / -Q- 0 x7F,0 x09,0 x19,0 x29,0 x

12、46, / -R- 0 x26,0 x49,0 x49,0 x49,0 x32, / -S- 0 x01,0 x01,0 x7F,0 x01,0 x01, / -T- 0 x3F,0 x40,0 x40,0 x40,0 x3F, / -U- 0 x1F,0 x20,0 x40,0 x20,0 x1F, / -V- 0 x7F,0 x20,0 x18,0 x20,0 x7F, / -W- 0 x63,0 x14,0 x08,0 x14,0 x63, / -X- 0 x03,0 x04,0 x78,0 x04,0 x03, / -Y- 0 x61,0 x51,0 x49,0 x45,0 x43,

13、/ -Z- 0 x7F,0 x7F,0 x41,0 x41,0 x00, / - 0 x02,0 x04,0 x08,0 x10,0 x20, / - 0 x00,0 x41,0 x41,0 x7F,0 x7F, / - 0 x04,0 x02,0 x7F,0 x02,0 x04, / - 0 x08,0 x1C,0 x2A,0 x08,0 x08, / -_- 0 x00,0 x00,0 x01,0 x02,0 x04, / - 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3

14、页,共 8 页 - - - - - - - - - 0 x24,0 x54,0 x54,0 x38,0 x40, / -a- 0 x7F,0 x28,0 x44,0 x44,0 x38, / -b- 0 x38,0 x44,0 x44,0 x44,0 x08, / -c- 0 x38,0 x44,0 x44,0 x28,0 x7F, / -d- 0 x38,0 x54,0 x54,0 x54,0 x08, / -e- 0 x08,0 x7E,0 x09,0 x09,0 x02, / -f- 0 x98,0 xA4,0 xA4,0 xA4,0 x78, / -g- 0 x7F,0 x08,0 x

15、04,0 x04,0 x78, / -h- 0 x00,0 x00,0 x79,0 x00,0 x00, / -i- 0 x00,0 x80,0 x88,0 x79,0 x00, / -j- 0 x7F,0 x10,0 x28,0 x44,0 x40, / -k- 0 x00,0 x41,0 x7F,0 x40,0 x00, / -l- 0 x78,0 x04,0 x78,0 x04,0 x78, / -m- 0 x04,0 x78,0 x04,0 x04,0 x78, / -n- 0 x38,0 x44,0 x44,0 x44,0 x38, / -o- 0 xFC,0 x24,0 x24,0

16、 x24,0 x18, / -p- 0 x18,0 x24,0 x24,0 x24,0 xFC, / -q- 0 x04,0 x78,0 x04,0 x04,0 x08, / -r- 0 x48,0 x54,0 x54,0 x54,0 x24, / -s- 0 x04,0 x3F,0 x44,0 x44,0 x24, / -t- 0 x3C,0 x40,0 x40,0 x3C,0 x40, / -u- 0 x1C,0 x20,0 x40,0 x20,0 x1C, / -v- 0 x3C,0 x40,0 x3C,0 x40,0 x3C, / -w- 0 x44,0 x28,0 x10,0 x28

17、,0 x44, / -x- 0 x9C,0 xA0,0 xA0,0 x90,0 x7C, / -y- 0 x44,0 x64,0 x54,0 x4C,0 x44, / -z- 0 x08,0 x36,0 x41,0 x00,0 x00, / - 0 x00,0 x00,0 x77,0 x00,0 x00, / -|- 0 x00,0 x00,0 x41,0 x36,0 x08, / - 0 x06,0 x09,0 x09,0 x06,0 x00, / - 0 x08,0 x04,0 x08,0 x10,0 x08, / - 0 x55,0 x2A,0 x55,0 x2A,0 x55 / - ?

18、- ; uchar add5= 0 x3E,0 x51,0 x49,0 x45,0 x3E, / -0- 0 x00,0 x42,0 x7F,0 x40,0 x00, / -1- 0 x62,0 x51,0 x49,0 x49,0 x46, / -2- 0 x21,0 x41,0 x49,0 x4D,0 x33, / -3- 0 x18,0 x14,0 x12,0 x7F,0 x10, / -4- 0 x27,0 x45,0 x45,0 x45,0 x39, / -5- 0 x3C,0 x4A,0 x49,0 x49,0 x31, / -6- 0 x01,0 x71,0 x09,0 x05,0

19、 x03, / -7- 0 x36,0 x49,0 x49,0 x49,0 x36, / -8- 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 8 页 - - - - - - - - - 0 x46,0 x49,0 x49,0 x29,0 x1E / -9- ; void Write_Data(uchar DC,uchar Data) / 由 DIN 写入的函数 uchar n; N5110_CE_L(); if(DC=1) N5110_DC_D(); else N51

20、10_DC_C(); for(n=0;n8;n+) if(Data&0 x80)!=0) N5110_DIN_H(); else N5110_DIN_L(); N5110_CLK_L(); Data=1; N5110_CLK_H(); N5110_CE_H(); void write_zuobiao(uchar X,uchar Y) /定坐标的函数 Write_Data(0,X|0 x80); Write_Data(0,Y|0 x40); void Clean_Screen(void) /清屏函数 int i; write_zuobiao(0,0); for(i=0;i504;i+) Writ

21、e_Data(1,0 x00); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 8 页 - - - - - - - - - void write_char(char c) /输入单个字符的函数 uint j ; uint k =(c- )*5; for(j = 0 ; j 5 ; j+) Write_Data(1 , ascii_dotk+j); void write_string(char *string) while(*string!=0 x00) write_ch

22、ar(*string); string+; void N5110_Init(void) /初始化函数 gp_Init() ; N5110_RST_L() ; delay_5110(100); / N5110 芯片复位N5110_RST_H() ; N5110_CE_H() ; / 初始不选通N5110 芯片 ,仅在需要写入数据的时候选通芯片Write_Data(0, 0 x21); / 设置功能设置寄存器,芯片活动 ,水平寻址 ,使用扩展命令Write_Data(0, 0 xbe); / 设置液晶偏置电压Write_Data(0, 0 x06); / 温度校正Write_Data(0, 0 x

23、13); / 设置偏置系统1:48 Write_Data(0, 0 x20); / 使用基本指令集Write_Data(0, 0 x0c); / 设置显示模式为普通模式Clean_Screen(); / 清屏N5110_BL_ON(); void display_word(uchar x ,uchar y , uchar *p) /根据坐标和要显示的汉字,按照一定的格式在5110 上显示出来 uchar q = 0 ; write_zuobiao(x,y) ; for(q = 0 ; q 16 ; q+) Write_Data(1 ,*(p+q) ; write_zuobiao(x,y+1)

24、; for(q = 16 ; q 32 ; q+) Write_Data(1 , *(p+q); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 8 页 - - - - - - - - - void delay_5110(uint x) /初始化函数中用到的延迟函数 uint a,b; for(a=0;a500;a+) for(b=0;bx;b+); void display_num_v(uchar x , uchar y , uint num) /根据坐标和要显示的数字

25、,显示动态 3 位数字 uchar i = 0 ; write_zuobiao(x , y) ; for(i = 0 ; i5 ; i+) Write_Data(1 , *(addnum/100+i) ; write_zuobiao(x+5 , y) ; for(i = 0 ; i5 ; i+) Write_Data(1 , *(add(num/10)%10+i) ; write_zuobiao(x+10 , y) ; for(i = 0 ; i5 ; i+) Write_Data(1 , *(addnum%10+i) ; write_zuobiao(x+15 , y) ; write_cha

26、r(v) ; void display_num_add(uchar x , uchar y , uint num) /根据坐标和要显示的4 个数字 uchar i = 0 ; write_zuobiao(x , y) ; for(i = 0 ; i5 ; i+) Write_Data(1 , *(addnum/1000+i) ; write_zuobiao(x+5 , y) ; for(i = 0 ; i5 ; i+) Write_Data(1 , *(add(num/100)%10+i) ; write_zuobiao(x+10 , y) ; for(i = 0 ; i5 ; i+) Wri

27、te_Data(1 , *(add(num/10)%100%10+i) ; write_zuobiao(x+15 , y) ; for(i = 0 ; i5 ; i+) Write_Data(1 , *(addnum%10+i) ; void display_num_ad(uchar x , uchar y , uint num) /根据坐标和要显示的2 个数字,按照一定的格式在5110 上显示出来 uchar i = 0 ; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,

28、共 8 页 - - - - - - - - - write_zuobiao(x , y) ; for(i = 0 ; i5 ; i+) Write_Data(1 , *(add(num/10)%10+i) ; write_zuobiao(x+5 , y) ; for(i = 0 ; i5 ; i+) Write_Data(1 , *(addnum%10+i) ; void display_num_a(uchar x , uchar y , uint num) /根据坐标和要显示1 个的数字,按照一定的格式在5110上显示出来 uchar i = 0 ; write_zuobiao(x , y) ; for(i = 0 ; i5 ; i+) Write_Data(1 , *(addnum%10+i) ; 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 8 页 - - - - - - - - -

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁