首页
会员中心
到顶部
到尾部
51单片机

基于AT89C52单片机的LED显示屏的控制系统设计

时间:2020/10/14 10:59:07  作者:  来源:  查看:0  评论:0
内容摘要: 基于AT89C52单片机的LED显示屏的控制系统设计摘要:这篇文章介绍了基于AT89C52单片机的LED点阵显示屏的软件和硬件开发过程。使用一个简单的外部电路来控制像素是32×192的显示屏。用动态扫描,显示屏可以显示6个32×32的点阵汉字。显示屏也可以分为两个小的显示...
基于AT89C52单片机的LED显示屏的控制系统设计
摘要这篇文章介绍了基于AT89C52单片机的LED点阵显示屏的软件和硬件开发过程。使用一个简单的外部电路来控制像素是32×192的显示屏。用动态扫描,显示屏可以显示6个32×32的点阵汉字。显示屏也可以分为两个小的显示屏,它可以显示24个像素是16×16的汉字。可以通过修改代码来改变显示的内容和字符的滚动功能,而且可以根据需要调整字符的滚速或者暂停滚动。中文字符代码存储在外部存储寄存器中,内存的大小由需要显示的汉字个数决定。这种显示屏具有体积小,硬件和电路结构简单的优点。
关键词发光二极管汉字显示AT89C52单片机 
1.导言
随着LED显示屏不断改善和美化人们的生活环境,LED显示屏已经成为城市明亮化,现代化、信息化的一项重要标志。在大的购物商场,火车站,码头,地铁,大量的管理窗口等,我们经常可以看到LED灯光。LED商业已成为一个快速增长的新产业,拥有巨大的市场空间和光明前景。文章,图片,动画和视频通过LED发光显示,并且内容可以变换。一些显示设备的模块化结构,通常有显示模块,控制系统和电源系统。显示模块是由LED管组成的点阵结构,进行发光显示,可以显示文章,图片,视频等。控制系统可以控制区域里LED的亮灭,电源系统为显示屏提供电压和电流。用电脑,取出字符字节,传送到微控制器,然后送到LED点阵显示屏上进行显示,很多室内和室外显示屏都是通过这个方法进行显示的。按显示的内容区分,LED点阵屏的显示可分为图形显示、图片显示和视频显示三个部分。与图片显示屏比较,不管是单色或者彩色的图形显示屏,都没有灰色色差,所以,图形显示不能反映丰富的色彩。视频显示屏不但可以显示运动、清楚和全彩的图像,也可以显示电视和计算机信号。虽然三者之间有一些不同,但显示的原理基本一样。
单片机具有优良的性价比,体型小,可靠性高,控制能力强,它广泛用于智能仪器、机电一体化的实时过程控制、机器人、家用电器、模糊控制和通讯系统等。
这篇文章讲诉了LED显示屏设计相关原理,以及对硬件的设计和软件流程进行了详细的介绍。最后,我们对整体的设计进行仿真并对结果进行了分析。
2.系统总体结构的设计
 
通过控制系统实现的目标、功能、可靠性、成本,精度和速度,选择单片机的型号。根据问题的实况,选择单片机型号主要考虑以下两个方面:首先,单片机要有很强的抗干扰能力,二是单片机要有低成本高效益的特性。MCS-51单片机在中国有很广的使用,有很多关于它的信息资料,而且可以兼容很多的芯片,尤其是ATMEL公司在2003年研发出的新一代微控制器,89S系列以及低成本高性能的AT89C52。AT89C52单片机是低电压,高性能CMOS 8位微控制器,这种芯片有8 KB的只读程序存储器(PEROM),它可以反复抹擦,运用了高密度不容易失性内存技术,256字节的随机存取数据存储(RAM),能与MCS-51指令集和8052产品相兼容。芯片的内置运用了8位中央处理器(CPU)的闪存存储单元,可以在更复杂的控制中使用。
总体的系统电路结构是由AT89C52芯片,时钟电路,复位电路,列、行扫描驱动电路和6个32× 32 LED点阵屏组成。LED显示屏的整体设计结构如图1所示。单个显示单元由点阵模块和两个74HC154组成。行的数据信号分为两部分,是由两个8255A所决定的。而8255A中数据来自AT89C52的P0口。两个74HC154芯片输入字符的列扫描信号,12个74HC154共分为六组。AT89C52的P1.0〜P1.3口提供74HC154输入信号。外部数据存储器6264和AT89C52 的P0口相连。
3.系统硬件电路设计
 
A.单片机控制系统电路的设计
 
汉字的大小是32×32,然而单片机只有32个I/ O口,它不能满足这种设计的需要,所以I / O端口必须要扩展,数据口的扩展要用两个8255A。数据端口扩展如图2所示,74HC373是锁存八位低地址的锁存器,它为6264的低8位地址提供信号。6224高八位地址则由端口P2.0〜P2.4所提供。A0和A1决定 8255A内部端口地址。 74HC139是2-4的译码器,它的输入信号是单片机的P2.6和P2.7口,为外部端口设备提供选通信号。系统中有很多个外部设备,要保证它们的选通,并使它们的地址是唯一、不重复的。
AT89C52单片机的时钟电路是由单片机18,19号引脚(XTALI和XTAL2),12MHz的晶体振荡器,电容C1、C2所组成。它运用了内部时钟模式。
复位电路与AT89C52的复位输入引脚端相连,它主要由电阻R1,电容C3构成,用了简单的上电复位电路。
 
B.显示器存储器单元电路的设计
 
在设计中汉字大小是32×32,每个汉字的字符由四个部分(a) ,(b),(c)和(d)组成,每部分又有四个8× 8点阵。图3是显示模块的电路分解。(a)〜(b)的行信号由两个8255A输入的,1PA0〜1PA7和1PB0〜1PB7分别为8255A- 1的 PA和PB口,2PA0〜2PA7和2PB0〜2PB7分别为8255A- 2的PA和PB口,右边的数字代表由74HC154提供的列扫描信号。74HC154输入16列选通信号,因为(a)〜(d)要八个信号,因此(a)和(b)用同一个74HC154,(c)和(d)用同一个74HC154。两个74HC154提供的列扫描信号可以显示一个字符。在电路工作时,(a)〜(d)扫描相应选通信号,一次只有一个处在选通状态,而别的列处于关闭状态。显示的数据是由两片8255A同时提供,由于人眼有暂留效应,眼睛只会看到一个稳定字符。另外,显示每个中文字符要128个字节的空间,然而AT89C52单片机芯片内只有256字节数据存储器,远达不到设计所要求的,所以扩展了6264这个8×8K外部数据存储器。
 
C.数据单元电路的设计
 
Intel 8255A是一种可编程通用并行输入/输出接口芯片。可以通过软件设置功能,有很强的通用性。它可通过CPU数据总线直接连接外部设备,使用很灵活方便。 Intel 8255A接口芯片有三个8位的并行输入和输出端,运用编程方法可以设置这三个端口作为输入端或者输出端。芯片有基本输入和输出的工作方式,即选通输入/输出和双向输入/输出。数据在CPU数据总线传输时,它可进行选择性无条件移动,查询或者中断传输。Intel 8255A芯片的第三端口,就是端口C可以用作数据端,也可以作为控制端。当端口C作为一个数据端口时,它可用作8位数据端口,但也分别作为两个4位数据端口,每位都可以进行操作,可以设置一个特定的位进行输入或输出,这样对位的控制提供了方便。
在显示单元电路的设计中,两个8255A提供行数据信号,如图4所示。设计运用了动态扫描的方式,通过控制行或者列扫描来显示汉字。系统用列扫描方式控制屏的显示,如图5所示为列扫描电路。12片74HC154组成列扫描电路。由2片74HC154控制一个字符并显示一个字符32列。74HC154的输入信号传入显示屏的AT89C52的P1.0的〜P1.3口,第二片的输入信号是P1.7〜P1.4口, 12片 74HC154根据这种指令工作。
D.串行通信接口电路的设计
 
PC机和单片机通过串行通讯接口链接。这个系统为了实现PC 机与单片机的串行通讯功能,把单片机串行接口的电平转换成RS–232C电平标准[11],其中PC机的RS232 口输出电压为±12V。照顾到单片机与PC 机的通信长度短,而且单片机只能接收命令和数据,所以选择最简单接法:PC机与单片机直接相连,PC机TXD端发出的信号传送到通信电路中再转化为电流信号,当有信号送进来时就有电流流过光耦合器中的红外发光二极管,二极管发出光信号投射到光敏三极管,再转换成电信号输到单片机的RXD 端,实现了以光为媒介的电到光到电信号转换传输过程,而且在电气上是完全阻隔的,减除了输出端对输入端可能产生的干扰和反馈。它的原理如图6所示。
4.软件的设计
整体软件设计可分为两大功能块:显示功能和通信功能。显示部分运用了动态扫描的方式,显示屏可以显示的汉字、字符等数据信息进行传输控制以及显示等功能。与PC 机的实时通信部分主要用了单片机串口中断接收数据信息,实现了与计算机的实时数据信息传输。
通信部分的主机软件运用了Visual Basic 编程,使用VB 在标准串口通信方面提供的具有强大功能的通信控件MSCOMM,该控件可设置串行通信的数据发送和接收,对串口状态及串口通信的信息格式和协议进行设置,直接用PC机的RS-232/RS-485 串口发送数据。
为了实现单片机与PC 机的可靠通信,必须要双方具有相同的数据格式和波特率,这个设计采用RS-232 通信,一帧10 位的数据格式,9600bit/s 的波特率。
 
 
 
 
 
 
 
 
Design of LED Display Control System Based
On AT89C52 Single Chip Microcomputer
 
Abstract:This paper introduces display design process about hardware and software based on AT89C52 single chip microcomputer. We use a simple external circuit to control the display screen, which size is 32 × 192. The display screen also can display the size of the six 32 × 32 dot matrix Chinese characters by a dynamic scan mode, and can be divided into two small display screen, which can display twenty-four Chinese characters whose size is 16×16. We can modify the code to change the content of the display, subtitles can achieve scrolling function and the scroll speed can be adjusted according to requirements, subtitles can also achieve pause function. The Chinese character code stored in external data memory, the capacity of data memory is expanded according to the requirements of Chinese characters we want to show. This display screen has advantages of small volume, few hardware and simple circuit structure.
Index Terms:LED, Chinese Character Display, AT89C52
 
I. INTRODUCTION
LED display has become an important symbol of the city lighting, modernization and information society with continuous improvement and beautification of people's living environment [6]. LED lights can be seen in the large shopping malls, railway station, docks, underground station, a variety of management window and so on. LED business has become a fast-growing new industry, a huge market space and bright prospects [9]. The text, pictures, animation and video are displayed by LED’s light, and content can be changed. Some components are the display devices of the modular structure, and which usually consists of a display module, control system and power system. The display module is constituted by the lattice structure which consists of LED, and is responsible for light-emitting display; the screen can display text, pictures, video and so on by control system which can control light or dark of LED in the corresponding region; Power system is responsible for transforming input voltage an d current into voltage and current which the screen needs. LED dot matrix display extracted display character font through PC, and sent to the microcontroller, then displayed in the dot matrix screen, which mainly used for display of indoor and outdoor characters. LED dot matrix display can be divided into graphic display, image display and video display by displayed content. Compared with the image display, the characteristics of graphic display is no difference in gray color whether it is monochrome or color display. Therefore, graphic display also fails to reflect the richness of color, and video display can not only show exercise, clear and full-color images, but also show television and computer signals. Although there are some differences between the three, but the most basic principles are similar [6].
SCM has excellent cost performance, small size, high reliability, strong control, and widely used in smart instruments, mechanical and electrical integration, real-time process control, robotics, domestic appliances, fuzzy control, communications systems and so on.
This article described the design by the LED display relevant principle, and the design of hardware and software structure are described in detail, finally, we simulate for the overall design and analyze the results.
 
II. System Overall Structure Design
Single Chip Microcomputer (SCM) models were selected according to the target, function, reliability, cost, accuracy and speed of the control system. According to the actual situation of the subject, the choice of SCM models mainly considered from the following two aspects: First, SCM has strong anti-interference ability; Second,
SCM has a higher cost-effective. Due to MCS-51 is widely used in China, has more information and can compatible with the more peripheral chips too, in particular, ATMEL Corporation, introduced a new generation microcontroller in 2003, that is 89S series, and its typical products with high performance and low cost microcontroller is AT89C52. AT89C52 is a low voltage, high-performance CMOS 8-bit microcontroller, the chip includes 8 KB read-only program memory (PEROM) which erase can be repeated, 256byte random access data memory (RAM), devices adopt high-density nonvolatile memory technology to produce, compatible with the standard MCS-51 instruction set and the 8052 products, while the chip built-in general-purpose 8-bit central processing (CPU) , Flash storage unit, can be applied to the more complex control applications[10].
The system was realized by the circuitry which is made up of AT89C52 chip, Clock circuit, reset circuit, column scan driver circuit, line drive circuit and the six
32 × 32 LED dot matrix, the overall structure of LED characters display is shown in Fig.1. A display unit is composed of dot matrix and two 74HC154. Line data signal is divided into two parts, which is given by the two 8255A respectively, but the 8255A data are from the P0 port the master controller AT89C52. The column scanning signal of each character was given by the two 74HC154, the 74HC154 12 pieces and was divided into six groups. The input signal of 74HC154 was given by the P1.0~P1.3 of AT89C52. External data memory 6264 connected with the AT89C52 the P0 port.
 
III. SYSTEM HARDWARE CIRCUIT DESIGN
A. Circuit Design of MCU Control System
The size of Chinese characters is 32 × 32, but microcontroller has 32 I/O port, and can’t meet design requirements, so the I/O port must expand, the data port expansion was implemented by two 8255A. The data port expansion is shown in Fig.2, 74HC373 is the address latch, and latch low eight address, the low eight address signals of 6264 provided by it, but the high eight address signals of 6264 provided by P2.0~P2.4, Internal port of 8255A was chosen by A0 and A1. 74HC139 is 2-4 decoder, whose input signals are provided by P2.6 and P2.7 of SCM, and provided strobe for the external I / O devices, because the system has more than one external device, make sure that they can not be gated, so that their addresses is the only and do not repeat. 
The clock circuit of AT89C52 composed of 18, 19 feet from the clock side (XTALI and XTAL2), and 12MHz crystal X, capacitor C1 and C2, and uses on-chip oscillator mode.
Reset circuit uses a simple power-on reset circuit, and mainly constitute of resistor R1, capacitor C3, connected to the AT89C52's reset input pin.
 
B. The Circuit Design of Display Memory Unit
The size of Chinese characters is 32×32 in the design, each character composed of four parts which are (a), (b), (c), and (d), and each part composed of four LED matrix which the size is 8 × 8, circuit decomposition map of display unit is shown in Fig.3. The line signals of (a) ~ (b) are given by two 8255A, 1PA0 ~1PA7 and 1PB0 ~1PB7 are PA and PB port of 8255A-1, 2PA0 ~ 2PA7 and 2PB0 ~ 2PB7 are PA and PB port of 8255A-2, the right figures represent column scan signals which is given by 74HC154. 16 column strobes are provided by 74HC154, (a) ~ (d) requires eight signal, respectively, so (a) and (b) share a 74HC154, (c) and (d) shared a 74HC154. Display a character need two 74HC154 which provide column scan signals. When the circuit works, the (a) ~ (d) is gated by scanning signal in proper order, only one was gated at a time, and other columns are extinguished, the displayed data is given by two pieces of 8255A simultaneously, the human eye will see a stable character because of the human eye's persistence of vision. In addition, because the Chinese character for each display needs 128 bytes storage space, but AT89C52 microcontroller chip is only 256 bytes data memory, it is far less than the design requirements, so we the expanded storage space by 8K × 8 external data memory 6264.
 
C. The Design of Ranks Data Unit Circuit
Inte1 8255A is a universal programmable parallel input/output interface chip. Its function can be set through the software program, and has a strong versatility. It can be directly through the CPU data bus connected to external devices, easy to use and flexible. Inte18255A interface chip has three 8-bit parallel input and output ports, programming methods can be used to set three ports as input ports or output ports. Chips work have the basic input and output, strobe input/output and bidirectional input / output. When the data were transmitted by data bus of CPU, its can choose to unconditionally transfer, query transmission or interrupt transmission. During Inte1 8255A chip three-port, the port C can be used as not only the data port, but also the control port. When the port C is taken as a data port, it can be used as not only 8-bit data port, but also separately as two 4-bit data port, and each bit of the port C can be operated, can set a particular bit to input or output, so provide convenient conditions for bits control.
In design of the display unit circuit, the lines data are given by two 8255A, as is shown in Figure 4. This design uses dynamic display means to display Chinese characters, which can be controlled the by the means of line or column scanning, The system uses the method of column scanning to control screen, Specific column scanning circuit is shown in Figure 5. Column scanning circuit composed of 12 pieces of 74HC154.Two pieces of 74HC154 provided 32 strobes to display a character. The input signal of 74HC154 is P1.0 ~ P1.3 which is provided by AT89C52 to control screen, but 12 pieces of 74HC154 were used in the design, they work according to the order, the input of another piece of 74HC154 is P1.4 ~ P1.7 which is provided by AT89C52 to control screen.
 
D. Serial Communication Interface Circuit
PC and SCM are linked via a serial communication interface. In order to implement serial communication function between MCU and PC, and serial interface level of SCM will be changed into standard RS-232C level [11]. Where the output voltage of PC’s RS-232C port is ± 12V. MCU and PC, taking into account the short distance communication, and microcontroller is mainly responsible for receiving commands and data, so the PC is directly connected with the microcontroller, this is the simplest connection method. the signals which is from PC’s TXD-side were changed into a current signal through the communication circuit, the infrared light-emitting diodes of optocouper have current when a signal occurs, the light signals which is emitted by diode projected onto the phototransistor, and converted to electric signal, then input to the microcontroller RXD side, so photoelectric conversion is implemented, and electrical is completely isolated to avoid the feedback and interference which is produced by output side. as is shown in Figure 6
 
IV. SOFTWARE DESIGN
The entire software design mainly composes of display program and communication program. The Chinese characters to be displayed on the screen, character and other data for transmission control and display functions were achieved by dynamic scan. Real-time communication parts which communicate with PC receive data information by SCM serial disruption, so real-time data information transmission with PC was implemented.
The host computer software was implemented by Visual Basic. In the standard serial communication, MSCOMM which is the power communication control is provided by VB, it can set the serial communication of data sent and received, and the serial communication port status, message formats and protocols are set, directly send data by PC’s RS -232/RS-485 serial port. In order to realized to PC reliable communication with SCM, and ensure that both sides have the same data format and baud rate [11], this design uses RS-232 communications, a 10 bits data format, 9600bit / s baud rate.
 
REFERENCES
[1] Zhou Mingde. Principle and Application of MicroComputer Systems[M].Beijing: Tsinghua UniversityPress2007
[2] Chen Junxia, Huang Yuehua, Gan Wen. Large-screen LED dot matrix display system[J]. Automation Technology and Application. 2007267: 118-120.
[3] Yan Shi. Digital Electronic Technology[M].Beijing: Higher Education Press2006
[4] Gu Deying, Luo Yunlin,Ma Shuhua. Computer Control Technology[M]. Beijing: Beijing University of Posts and Telecommunications Press, 2007
[5] Peng Wei. SCM typical system design example Jingjiang [M].Beijing: Electronic Industry Press2006
[6] Yin Xiao’an, Wu Mingliang. LED dot matrix display bar screen control system design based on SCM[J]. Research and development of the world.2008302: 154-155.
[7] Zhu Qinghui, Zhang Fengrui, Wang Kui. Proteus Tutorial[M].Beijing: Tsinghua University Press2008
[8] Li Xueli. 8051 tutorial examples based on Proteus[M].Beijing: Electronic Industry Press2008
  


相关评论
本类推荐
    广告联系QQ:45157718 点击这里给我发消息 电话:13516821613 杭州余杭东港路118号雷恩国际科技创新园  网站技术支持:黄菊华互联网工作室 浙ICP备06056032号