单片机控制的LCD汉字显示电路设计
摘 要 近年来,随着电子行业的发展,单片机的应用越来越广泛,基于单片机的电子电路的设计也越来越多。所以,单片机在电子教学中越来越普遍。 本设计介绍的是以ATMEGA8单片机为核心的液晶显示屏控制系统。该设计详细阐述了其工作原理、基本功能框图、主要设计方法及工作流程。本设计提出了一种能实时控制显示内容的基于单片机的液晶显示屏控制系统设计方案,给出了该单片机的硬件电路和软件程序,最终显示出汉字的结果。具体方法是首先设计并焊接出一个AVR单片机开发板,基于此开发板设计出LCD模块显示电路。之后,编写LCD模块初始化程序和显示程序。最后下载程序到单片机,LCD显示出汉字。 关键词: Atmega8 控制 LCD12864 显示 I
Title The control circuit design of the dot-matrix liquid crystal display controlled by the microprocessor Abstract In recent years, with the development of the electronics industry, the application of the Microcontroller Unit is becoming more and more widely, also, there is more and more electronic circuit design based on the Microcontroller Unit. Therefore, the Microcontroller Unit using in the electronic teaching is becoming more common. This design introduces the liquid crystal display control system based on the ATMEGA8 microcontroller. This design elaborated on its working principle, the basic functional block diagram, main design methods and working process. This design puts forward to a design scheme based on the Microcontroller Unit, which can control the showing content of the LCD screen controlling system at the real time. The specific method is that, firstly we should design and weld into an AVR Microcontroller development board and then design a LCD module display circuit based on the development board. After that, write the LCD module initialization program and displaying program. At last, download the program to the MCU, and the LCD will show the Chinese characters. Keywords ATMEGA8 control LCD12864 displaying II
目次 摘 要 ................................................................ I Abstract ............................................................. II 目次 ................................................................ III 1概述 ................................................................. 1 1.1课题背景 ....................................................... 1 1.2设计要求 ....................................................... 1 1.3 LCD简介及发展 ................................................. 1 1.4 AVR单片机 ..................................................... 2 2方案论证 ............................................................. 2 2.1方案一 ......................................................... 2 2.2方案二 ......................................................... 3 2.3方案三 ......................................................... 3 3主要模块简介 ......................................................... 3 3.1 ATMEGA8简介 ................................................... 3 3.2 LCD12864模块简介 .............................................. 5 3.2.1 KXM12864主要技术参数和性能 ............................... 5 3.2.2 KXM12864外形尺寸图 ....................................... 5 3.2.3 KXM12864液晶显示指令系统 ................................. 6 3.2.4 12864液晶显示动态指标及术语 .............................. 7 4硬件设计 ............................................................. 9 4.1设计流程图及设计思路 ........................................... 9 4.2各模块电路设计 ................................................ 10 4.2.1电源电路 ................................................. 10 4.2.2 LCD12864模块控制电路 .................................... 11 4.2.3 RS232电平转换电路 ....................................... 12 4.2.4 时钟电路 ................................................ 13 4.3硬件焊接与调试 ................................................ 14 4.4方案扩展 ...................................................... 14 5软件设计 ............................................................ 16 5.1 LCD12864模块初始化流程 ....................................... 16 .................................................................. 16 5.2部分程序代码 .................................................. 17 5.2.1软件延时 ................................................. 17 5.2.2 端口输出函数 ............................................ 18 5.2.3 写数据函数 .............................................. 18 5.2.4 写指令函数 .............................................. 19 5.2.5 初始化函数 .............................................. 20 III
5.2.6 显示函数 ................................................ 20 5.3程序调试中的注意问题 .......................................... 23 6实物与实测效果展示 .................................................. 27 6.1实物展示 ...................................................... 27 6.2实测效果展示 .................................................. 28 结论 ................................................................. 29 感言 ................................................................. 30 致谢 ................................................................. 31 参考文献 ............................................................. 32 附录A ................................................................ 33 硬件原理图(基于protel99se) ..................................... 33 附录B ................................................................ 34 程序代码 .......................................................... 34 附录C ................................................................ 40 元器件规格清单 .................................................... 40 IV