Design Led Matrix
Design Led Matrix
Design Led Matrix
Design of LED Display Control System Based on AT89C52 Single Chip Microcomputer
Yongxian Song
The Institute of Electronic Engineering Huaihai Institute of Technology Lianyungang , China [email protected]
AbstractThis 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 1616. 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 TermsLED, 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 LEDs 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, realtime 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
Manuscript received January 1, 2010; revised June 10, 2010; accepted July 14, 2010.
719
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.
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.
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 cant 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.
The Circuit Design of Display Memory Unit The size of Chinese characters is 3232 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.
(a)
(b)
720
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.
(c) (d)
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
2011 ACADEMY PUBLISHER
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 PCs RS-232C port is 12V. MCU and PC, taking into account the short distance communication, and microcontroller is mainly
721
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 PCs TXD-side were changed into a current signal through the communication circuit, the infrared lightemitting 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. Realtime 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 PCs 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. Principles of Chinese characters dot matrix display and Sub-codes Chinese Times New Roman font which is UCDOS was taken as an example, each word composed of 16 16 dot matrix. That is, every word of the national standard Chinese character library expressed by the 256 lattice. We can understand each point as a pixel, and the shape of each word understood as an image. In fact, this character display screen not only can display Chinese characters, but also can display any graphics within the scope of 256 pixels. Due to the bus of microcontroller is the 8-bit, and a word need to split into two parts, as is shown figure 7. A
In order to understand Chinese characters dot matrix composition law, at first, the characters code was obtained by column scanning method. Chinese characters are divided into upper part and lower part, the upper part composed of 8 16 lattice, the lower part was also formed by the 8 16 lattice. The first column of the upper left corner which was the upper part was shown by Column scanning method first, namely, P00~P07 port of 0 column, direction was P00~P07, Chinese character for "large" was displayed, P05 was on, the other is off. That is, binary is 00000100, and convert to hexadecimal as 04h. After the first column of the upper part was over, and continue to scan the bottom half of the first column, It can be seen from Figure 7, this column is not on all, that is, binary was 00000000, hex was 00h. According to this method, the second column, third column, until the sixteenth was scanned in turn. Characters "big" scan code can be drawn. 04H, 00H, 04H, 02H, 04H, 02H, 04H, 04H 04H, 08H, 04H, 30H, 05H, 0C0H, 0FEH, 00H 05H, 80H, 04H, 60H, 04H, 10H, 04H, 08H 04H, 04H, 0CH, 06H, 04H, 04H ,00H, 00H It can be seen from this principle, no matter what font or image display, we can use this method to analyze the scan code and appears on the screen. Although above methods allow us to figure out the code for character dot-matrix process, but rely on manual methods for character code is a very complicated matter. To this end, Font software is used to find the character code, the content to display is entered after the software opens, font and size can be chosen according to requirements, you can select modulo by row or by column. Press the modulus button, the hexadecimal data character code can be automatically generated, we need to copy the data into the program.
TABLE I. 8255 AND 6264 ADDRESS ALLOCATION TABLE Peripheral devices The number of chip locations Address coding
A15-A0
8255A-1
3FFCH~3FFFH
7FFCH~7FFFH
6264
0A000H~0BFFF H
B. Address Assignment the Port and Data Memory In this design, we used to 8255A, 6264 and other external devices, and their gating is not the same, so strobe is controlled, which involves the address allocation problem. In the system, the address code of 8255A is 3FFCH ~ 3FFFH and 7FFCH ~ 7FFFH, the address code of 6264 is 0A000H ~ 0BFFFH. In addition, memory 6264 is divided into four zones, each space size is 2K, the
722
corresponding address code is 0A000H ~ 0A7FFH, 0A800H ~ 0AFFFH, 0B000H ~ 0B7FFH, 0B800H ~ 0BFFFH respectively. Table 1 and table 2 show the address allocation of the 8255A and 6264 respectively.
TABLE II. 6264 INTERNAL PARTION TABLE Zoning categories A15~A0 Partition size Address coding
First district
2K
0A000H~ 0A7FFH
Second district
2K
0A800~ 0AFFFH
Third district
2K
0B000H~ 0B7FFH
Figure.8
Fourth district
2K
0B8000~ 0BFFFH
C. Software process Software program composed of the beginning, initialization, display program, front, which the main program and subroutine flow chart are shown in Figure.8. and Figure 9. Character code stored in the static memory 6264, and the SCM will wait for signal is given, that is, the input signal of SCM pin P3.0. When P3.0 is from low to high, display program begin to be run. First, control words written to 8255A control port, 8255A work in the form of mode 0 in the design. After control word was finished, the data will be displayed which is transferred to the 8255A from the 6264, the display data is output for four times because the line width of the characters screen is 32, a row of data is input and transported from top to bottom each, signal of the first rows which is controlled by SCM is gated after data transmission is over, so the first column data is displayed, then call delay procedures to display the contents of the stable. the next column of data is read after delay procedures is over, and the next row is gated, so that the second column of data is also displayed, and so on, because the screen size is 32 192, 192 rows are shown, and 192 rows constitute an image. Then, scanning begin from the first column, and the starting address of display data backward shift on the basis of the original, which has an address overflow issues, it will assign start address to the address pointer when the data address is overflow, the display data content will be constantly repeated. Flow chart of communication with PC and SCM is shown in Figure 10. 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.
Figure.9
723
top floor. The circuit are not stringent requirements for components parameters, as long as the component selection is correct, no damage, good circuit board manufacturing process, all electronic components can be assembled into the correct welding procedure, and to download program and debug program. When PCB board was produced and debugged, IC that is 20 pin should be installed in the AT89C52 position, in order to the microcontroller can take down from the circuit board, and write program. B Simulation Scroll of Chinese characters was implemented by software programming, we take a whole series of images which was implemented by Column scan signals to a frame, here is 192 rows. Then the next frame data backward shift on the basis of the first frame data, and dynamic display can be generated. The images result of the simulation is shown in Figure11.
V. SIMULATION RESULTS AND ANALYSIS After the hardware and software design finished, the content of the design was simulated by Proteus, and modify circuit or optimize the program according to the simulation results. Proteus software which is EDA tool software is published by the British Labcenter electronics companies (the software agent in China is the Guangzhou Electronic Technology Co. Ltd. vane) [7]. It not only has simulation functions of other EDA tools, but also simulates microcontrollers and peripheral devices. It is the best simulation tool for microcontroller and external device. Although the Proteus just started in the domestic, lovers of SCM, the teachers of teaching in SCM and science and technology workers which engaged in SCM all love this software. Proteus is the world's leading EDA tools (simulation software), from the schematic layout, debugging code to the MCU and the external circuit cosimulation, a key switch to the PCB design, complete design was realized from concept to product. It Is only simulation software platform which is composed of circuit simulation software, PCB design software and the virtual model, the processor model supports 8051, HC11, PIC10/12/16/18/24/30/DsPIC33, AVR , ARM, 8086, and MSP430, etc. Cortex and the DSP family of processors were increased in 2010, and will increase other series processor model. In the compilation side, it also supports IAR, Keil and MATLAB and so on. A PCB design and component assembly Taking into account the number of components used in this design is not too much, we used the single routing strategy, and use a small amount of jumper wires on the
Figure.11 the images result of the simulation
The simulation results shows that simulation is consistent with theoretical analysis, the data distribution of the memory is correct, the data correctly stored into the data memory, the display shows the contents of the program is the data to be displayed, the display can also be achieved pause and display speed is adjustable, indicating that the design of the hardware and software are possible. After the compilation and simulation of program was accomplished, preparing an editor that can write the AT89C52, and connected with the host computer hardware, that is, we can write AT89C52 chip and download, then, the microcontroller AT89C52 which is written program insert into the IC that has 40 pins. When power is connected, we can debug and run, As the system circuit require for parameters of the components is not very high, as long as the device is better, the parameters can meet the requirements, and work immediately after welding assembly. VI. CONCLUSION LED display system that was designed adopted the host computer and slave structure, the host computer is PC, and communicated with slave computer display system through the serial communication interface, which can implement string modification, display mode settings, time settings and other functions; The slave mainly implement display of LED dot matrix display screen which was controlled by SCM. Chinese character display
724
is 32 32 dot matrix model, and to achieve real-time screen display changes, and have to display the current time and date functions. The design of LED dot matrix display control system has a simple circuit, stability, low power consumption, long life, easy to display characteristics, and include the LED display basic principles and procedures. As long as the microcontroller I/O interface is expanded, and increase the number of LED dot matrix and related chips, you can design a larger area and more tricks of the LED display. This article has some reference value of theory and practice. As the core control unit of the system, that is AT89C52, has lower frequency, in the future, in order to achieve LED video display in real time, and the display image can be compressed, which will increase the burden on the system. We can take advantage of high-speed DSP as the core control unit, and solve the above mentioned problems. ACKNOWLEDGMENT The authors wish to thank Zhang xianjin and Fan Jishan for providing critical comments for this study and QiuXiuLing for editorial assistance. REFERENCES
[1] Zhou Mingde. Principle and Application of Micro Computer Systems[M].Beijing: Tsinghua University Press2007 [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 Xiaoan, 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 [9] Long guoan. MCU-based design and production of LED display Chinese characters[J]. Modern electronic technology. 200713 [10] Wu Gang. Application of AT89C52 microcontroller in the hospital care [J]. Electronic Component & Device Applications. 2008,101223-24.
[11] Hou Liling. LED dot matrix display control system Based on AT89S52[J]. Journal of Zhangzhou Technical Institute. 2008, 10(3):70-72. Yongxian Song was born in xuzhou,on April 1,1975. He received the B.S. degree in Applied Electronic Technology from Huaihai Institute of Technology, Lianyungang,China, in 1997, and the M.S degree in Control Theory and Control Engineering from Jiangsu University, Zhenjiang, China , in 2006. From 2009 to now, He is studing for Ph.D degree in Control Theory and Control Engineering from Jiangsu university, Zhenjiang, China. Since 2006, he has beeen a teacher in Huaihai Institute of Technology, Lianyungang,China. His current research interests include signal processing ,intelligent control, and industrial control . Yuan Feng. was born in lianyungang ,on March 28,1978. He received the B.S. degree in Computer hardware and application from Huaihai Institute of Technology, Lianyungang, China, in 1999. and the M.S degree in Industrial Control from Nanjing University of Science, Nanjing, China, in 2007. From 1999 to now, he has beeen a teacher in Huaihai Institute of Technology, Lianyungang,China. His current research interests include signal processing, Computer Control Technology
Juanli Ma female, lecturer, born in 1976, 1995-1999 studied at Gansu University of Technology, studying
electrical automation, and obtained a bachelor degree. 2004-2007 studied at the Northwestern Polytechnical University, studying control theory and control engineering and obtained a Master degree in Engineering. From1999 to now, she has been working in the Huaihai Institute of Technology .
Xianjin Zhang was born in suqian, in1975. He received the B.S. degree in Applied Electronic Technology from Guilin University of Electronic Techonlogy, Guilin, China, in 1998, and the M.S degree in Power Electronic and Control Engineering from Nanjing University of Aeronautics & Astronautics, Nanjing, China, in 2005. From 2007 to now, He is studying for Ph.D degree in Power Electronic and Control Engineering from Nanjing University of Aeronautics & Astronautics, Nanjing, China.. Since 2005, he has been a teacher in Huaihai Institute of Technology, Lianyungang,China. His current research interests