LED dot matrix blocks have the advantages of high brightness, uniform light emission, good reliability, and easy assembly, and can form display screens of various sizes. At present, LED display screens have been widely used in text display and have achieved good results, but most of them can only display scrolling text information but not images, and there are also disadvantages such as complex systems. This paper proposes a master-slave single-chip LED display solution. This design uses the FLASH ROM and RAM of the AVR single-chip microcomputer itself, does not require any external storage circuit, and has a simple circuit structure. The system realizes 16-level grayscale display of images and can be widely used in public places such as shopping malls and stations.
1 Introduction to AVR MCU
AVR microcontroller is an enhanced RISC (Reduced Instruction Set CPU) high-speed 8-bit microcontroller with built-in FLASH. The hardware adopts the Harward structure, which can execute one instruction in one clock cycle, and most instructions are single-cycle instructions. It supports in-system programming ISP, and the MEGA series also supports in-application programming IAP. The built-in FLASH program memory can be erased and written more than 1,000 times, which brings convenience to users' development, production and maintenance. The E2PROM that can be erased and written 100,000 times brings convenience to the preservation of data after power failure. AVR microcontroller has rich on-chip resources, such as RTC, WATCHDOG, AD converter, PWM, USART, SPI, TWI interface, etc., and the I/O port has strong functions and strong driving ability.
2 Overall system design
The LED display system is mainly composed of three parts: PC host image and text conversion and data sending unit, main control unit and display submodule.
The host computer completes the conversion of images and text into display codes of the display screen, and sends the display information to the main control unit. The main control unit uses an AT-mega32 microcontroller with 32 kB on-chip FLASH ROM and 2 kB on-chip RAM, and no external memory. If you want to store more display information, you can choose AT-mega64 with 64 kB on-chip FLASH ROM or AT-megal28 with 128 kB on-chip FLASH ROM, or you can use an external memory to increase the storage capacity. The main control unit mainly completes the scrolling and segmentation of the display data, and then sends it to each submodule through the asynchronous serial port. Each display submodule uses 4 8×8 monochrome dot matrix blocks to form a 16×16 dot matrix screen, and uses an ATmega8 to complete the scanning dynamic display.
The data communication between the main control unit and the display submodule adopts the standard asynchronous serial port format. Each frame of data includes 1 start bit, 8 data bits, 1 address/data mark bit, and 1 stop bit, totaling 11 bits. The data transmission rate is 625 kb/s, and the byte transmission rate is 56.8 kB/s. Each submodule consists of 256 LEDs. To achieve 16-level grayscale, each LED requires 4 bits of space. Therefore, the full-screen data volume of each display submodule is 128 B, plus 1 B of addressing bytes, totaling 129 B. When the main control unit updates the display content of the display submodule, it sends display data to all submodules one by one according to the address. After updating the data of all submodules, it sends a special address word 0xFF as a control word to make all submodules update the display data at the same time. This can avoid the problem of asynchronous screen updates of each submodule when the screen is large and the number of display submodules is large. For the 6×4 display sub-modules completed in this design, due to the limitation of communication rate, the maximum screen update speed can reach 56,800/(129×24+1)=18.34 frames/s. Since the main control unit also needs to complete the segmentation of full-screen data and the movement control of display content, the actual frame number is lower than the above value, but it can meet the requirements for ordinary picture display.
In field applications, there is no need for a PC host computer. You only need to store the information to be displayed in the main control unit, and then you can use the buttons in the main control unit to select the display content and method. The display can be cyclic, and the text information can also be scrolled up and down, left and right.
3 System Hardware Design
The system consists of two hardware circuits: the main board circuit and the sub-module display driver circuit.
3.1 Mainboard Circuit
The main board circuit is very simple, consisting of a minimum system composed of ATmega32 and RS 232, RS 485 interface circuits.
The data on the main board is sent to each sub-module by the asynchronous serial port. In order to ensure the reliability of data transmission while increasing the transmission speed and distance, the information sent by the main board is converted into RS 485 signals and transmitted to the LED sub-module using a coaxial cable with a shielded layer. The interface chip used for conversion is MAX485, which works at a voltage of 5 V, with a maximum transmission speed of 2.5 Mb/s and a transmission distance of up to 1 200 m. Using a coaxial cable with a shielded layer can reduce the signal interference generated during the transmission process.
When data needs to be downloaded from the PC to the FLASH ROM, the MAX232 chip is used to realize the communication between ATmega32 and the PC.
3.2 Submodule display driver circuit
The submodule display drive circuit is composed of RS 485 conversion circuit, submodule address identification circuit and dot matrix drive circuit. The RS 485 conversion circuit is the same as that in the main board, and also uses MAX485 for level conversion.
Since the asynchronous serial port of the microcontroller is used for multi-machine communication and data transmission, each submodule should have an address identification corresponding to its position. The address identification circuit is composed of an 8-bit parallel-input and serial-output chip 74HCl65 and an 8-bit dip switch, so this system can accommodate up to 255 submodules (address OxFF is used as the control word for updating the submodule display). If the address of each submodule is simply determined by the internal settings of the software, the program corresponding to each AT-mega8 will be different, which will bring inconvenience to the burning of the program. Therefore, an external hardware circuit is used to identify the address of the submodule. The use of 74HC165 for serial-to-parallel conversion is to save the pin resources of the microcontroller.
The LED dot matrix is driven by dynamic scanning method and realizes 16-level grayscale display. In order to save the time consumption of scanning program in the single-chip program and improve the scanning speed, the display data is output in parallel. The driving circuit uses 4-16 decoder 74HC154 to drive 16 medium-power transistors 8550 as row selection, and 2 8-bit data latches 74LS373 as row data latches.
4 System Software Design
The system software design includes three parts: the design of the host computer software, the programming of the mainboard AT-mega32, and the programming of the display submodule ATmega8.
The host computer software completes the image and text editing, and transmits the display data to the main board through the computer serial interface. The main board receives the data from the host computer and performs self-update of the display data in the FLASH ROM through the program in the internal Boot Loader area. The main board divides the display data and sends it to each sub-module, and completes the up and down, left and right scrolling of the display data. The sub-module realizes 16-level grayscale image display by modulating the pulse duty cycle by software.
4.1 Host computer software design
The upper computer software is developed using VB, which mainly completes the image point selection, linear compensation and dot matrix data generation. First, the image file is converted into a monochrome grayscale image with a resolution of 96×64 and a color depth of 256 levels. Since the duty cycle/brightness of the duty cycle-driven LED is a logarithmic characteristic, it is necessary to add an exponential characteristic to adjust it to a linear characteristic before it can be delivered to the display system for display. The calculation formula is Dout=15×(Din/255)n. n is the proportional coefficient, which is determined to be 1.35 after actual display calibration. At the same time, the conversion from 256-level grayscale to 16-level grayscale is completed through this formula. The communication between the PC and the motherboard is realized through the MSComm control.
4.2 Motherboard ATmega32 Programming
The host software is mainly divided into three parts: key response processing, display data segmentation and data transmission after segmentation. Among them, the segmentation of display data occupies the most important position, and the scrolling of display content is also included in this part. The key response uses external interrupt response, and after de-bounce processing with timer TO, the key valid flag is set. The key valid flag is checked in the main program and the response processing is performed.
4.3 Display submodule programming
The software of the display submodule is divided into two parts: data reception and dynamic refresh display. Since the submodule needs to achieve 16 levels of grayscale and also needs to achieve a sufficiently high refresh rate to avoid flickering, the speed requirement for the refresh display part is relatively high. The solution adopted in this design is: the full screen (each submodule is 16 rows × 16 dots/row) refresh is divided into 16 time slices, and each time slice realizes the scanning of one row. The time slice of each row is divided into 15 sub-time slices, where the darkest point of grayscale lights up 0 sub-time slices, and the brightest point of grayscale lights up 15 time slices, thereby realizing a duty cycle of 0/15 to 15/15, a total of 16 levels of average current control, thereby realizing 16 levels of grayscale display. Through: MEGA8 on-chip timer T2, each sub-time slice obtains a scanning time of 52μs, 15 sub-time slices constitute a single-line scanning time slice (52μs×15=780μs), and 16 single-line scanning time slices constitute a full-screen scan (780μs×16=12.48 ms), then the refresh frequency is about 80 Hz, which can ensure that there is no flicker even at the highest brightness.
5 Conclusion
The LED display screen based on AVR microcontroller proposed in this paper has been applied in the field. The watchdog function of AVR microcontroller makes the system stable and reliable. Since this design is a master-slave solution, it is scalable, and the use of ISP function brings great convenience to the debugging of circuit boards and the maintenance of the system. Practice has proved that this system can easily display text information in various fonts and 16-level grayscale images, with clear pictures, stable performance, and easy operation, and has good application value.
Previous article:Design of ISP1362OTG based on AVR microcontroller
Next article:AVR microcontroller reset circuit
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- Why is it said that the larger the ceramic capacitor package, the better the frequency characteristics?
- The smartwatch craze has left the survivors
- [TI recommended course] #Boost and buck-boost DCDC converters help wireless charging design#
- Milliohm meter based on [EVAL-ADICUP360] - Programming
- USB to TTL serial port debugging tool based on 2.4G wireless transmission
- When the epidemic in Shanghai is over, I plan to develop in other cities.
- [Technical Live Broadcast] Experts from MPS, Nexperia, and Tektronix gathered to discuss the key points of new energy vehicle power design
- Dogecoin suddenly became popular. Here is a tutorial on graphics card mining
- The difference between power module ripple and noise
- The rate at which the stm32 ADC interrupt occurs is only 12k/sec