几个串口液晶屏显示与仿真,有详细解释
电路原理图如下:
单片机源程序如下:
- /******************************************************
- 编写人:xzf
- 模块 :Milford
- 功能 :串行液晶显示
- 日期 :2016-9-11
- 调试方法:虚拟仪器VIRTURE TERMINAL的使用
- ******************************************************/
- #include<reg52.h>
- #include"MILFORD.H"
- #include"UART.H"
- #define uint unsigned int
- #define uchar unsigned char
- uchar code prompts[]=" Serial LCD DEMO ";
- /**************************************************
- 延时子程序
- ***************************************************/
- void DelayMS(uint ms)
- {
- uchar i;
- while(ms--)
- {
- for(i=0;i<120;i++);
- }
- }
- /**************************************************
- 主程序
- ***************************************************/
- void main()
- {
- uchar i=0,c;
- ConfigUART(9600);
-
- DelayMS(200);
-
- while(prompts[i]!='\0')
- {
- UART_Send(prompts[i]);//地址没有确定,默认第一行第一列开始写
- i++;
- DelayMS(5);
- }
- wrcmd(0xc0); //任何屏的操作方法,先写地址,然后写数据,0xC0:第二行首列;0x85:第一行第六列
- wrcmd(0x0d); //0x0c:无光标;0x0d:有光标,光标闪烁,0x0e:下划线,与1602命令类似
- UART_Send(0x41); //写大写字母A
-
- DelayMS(120);
- while(1)
- {
- c = UART_Receive();
- if(c==0x0d) //回车键ASCII码值0x0D
- {
- wrcmd(0x01); //清屏
- continue;
- ……………………
- …………限于本文篇幅 余下代码请从51黑下载附件…………
复制代码
所有资料51hei提供下载:
串行液晶显示.rar
(20.4 KB, 下载次数: 35)
|