1 Introduction
LED display screen is a new information display media that developed rapidly around the world in the late 1980s and is used more and more widely. ATMEGA16L microcontroller is a low-power CMOS 8-bit microcontroller based on AVR RISC. It has 16K bytes of self-programming FLASH, 512 bytes of EEPROM, and 1K bytes of SRAM. It controls the LED display through the AVR microcontroller. It has a simple structure. , the application is flexible and easy to expand.
2 System design principles
2.1 Coding design
There are two processes in coding design: font extraction and font encoding conversion. There are two font files involved in font extraction, one is ASC16, which specifically stores ASCII codes; the other is HZK16, which specifically stores Chinese character font codes. To extract the font library, you must first initialize it, that is, open the font library. Then extract its corresponding encoding based on a character. First, after taking out the internal code of the character (pay attention to distinguishing between single-byte and double-byte internal codes), then use the internal code to obtain the offset of the encoding of the font corresponding to the character in ASCII or HZK16, and finally you can use this address Find the corresponding font code at the offset position in the file. We can calculate it using this formula:
In ASCII, offset = (low address of internal code) * 16,
In HZK16, offset = ((high address of internal code-161)*94 + (low address of internal code-161))*32.
The font code obtained at this time is not the final desired code (single-byte data such as English is displayed in an 8*16 dot matrix, while double-byte data such as Chinese characters is displayed in a 16*16 dot matrix). The 8*16 dot matrix is used uniformly here, which requires conversion. The table on the left in the figure below shows the order in which Chinese character codes are stored in the font library, and the table on the right shows the order in which codes are stored after conversion. The encoding conversion process is shown in Figure 1:
Figure 1 Code conversion
2.2 Matrix conversion and shift algorithm
The purpose of the matrix conversion and shift algorithm is to convert these original data into serial data so that the data can be correctly input to the 74HC595. The original data must be transformed. The following is its algorithm implementation.
for(m=0; m<8; m++) //m represents the LED number
{? for(j=0;j<8;j++) //j represents the row of data of a certain LED
{? for(i=0; i<8; i++) //i represents the number of the row of data of a certain LED.
{ displayport_a[m][j]|=((displaycode_a[i][m]&0x01)<
displaycode_a[i][m]=displaycode_a[i][m]>>1;
// displayport_a[m][j] means storing the converted data
// displaycode_a[i][m] means that the original data is stored
//'|' means OR, '&' means AND, '<<' means left shift
}
}
}
2.3 Communication between the upper computer and the lower computer
The communication between the upper computer and the lower computer is mainly through the RS232 interface, and the data transmission rate of the upper computer is 9600bps. In order to facilitate the transmission and reception of data, flags can be added before and after the data to be transmitted. If the amount of data sent is large, threads can also be used to send data. The lower computer can use the full-duplex Universal Asynchronous Receiver Transmitter (UART) in the microcontroller to receive data.
UART has two working modes: interrupt and query. UART initialization requires setting up several related control registers. We can express the initialization status of several UART control registers:
UCR = 0x00 When setting the baud rate, UART must be turned off first.
UBRR = 0x33 sets the baud rate to 9600bps
UCR = 0xD8 Open serial port: 8-bit data
How the UART receives and sends data is completed through the data register UDR. Although UDR has only one address, it physically separates two registers, one for sending and one for receiving. Interrupts are used to receive and send data, and the interrupt vector is 12, which is the interrupt handler uart0_rx_isr:12. The receiving and sending methods are as follows:
Receive=UDR receives a data
UDR= Send sends a data
2.4 Display principle
To light up the LED, the LED bit selection data signal must be set to low level. The display process is as follows: first, set the RCK of the 74HC595 to 0, then take out the data to be displayed and the bit selection signal from the corresponding array. Through a rising edge pulse of SCK, you can input this data into the 74HC595, and wait for all the data to be printed. After inserting the corresponding chip, finally set RCK to 1, and the data can be transmitted in parallel through 74HC595.
3 System Design Plan
The design of the overall hardware framework is based on the communication principle between the host computer and the lower computer, the LED dot matrix display principle and the characteristics of 74HC595. Figure 2 below illustrates the LED dot matrix display driving schematic diagram and its wiring method.
Figure 2 LED dot matrix display driving schematic diagram
The PA and PB ports will be used as data output ports, and a total of 16 8*8 LEDs will be connected. Each pin of the port will serve as a data input for the 74HC595. The purpose of using RCK and SCK in parallel is to achieve synchronous display of LED characters. In the line connection, Q`H must be connected to SI, because according to the characteristics of 74HC595, if the number of input data is greater than 8, then the previous data will be automatically overflowed. According to this idea, the two chips are connected and the input is entered first. 8-bit data signal, and then input the sequence of 8-bit bit selection signals, then the former 74HC595 stores the bit selection information, and the latter 74HC595 stores the data information.
According to the design principles of the system, the software process framework shown in Figure 3 is obtained:
?
Figure 3 Software process framework
4 Conclusion
For the current display system, the advantage is that the circuit implementation is simple and the cost is low. If the system requires a larger character display library, it only needs to expand the RAM or EEPROM of the AVR and use multiple AVR microcontrollers for communication. Of course, you need to pay attention to the data writing time at this time to avoid display desynchronization.
references
[1] Ding Huacheng, Geng Degen, Li Junkai. AVR microcontroller application design [M]. Beijing: Beihang University Press, 2002
[2] Shen Wen, Eagle lee, Zhan Weiqian. AVR microcontroller. Introductory guide to C language development [M]. Beijing: Tsinghua University Press, 2003
[3] Jin Chunlin, Qiu Huifang, Zhang Jiuxi. AVR series microcontroller---C language programming and application examples [M]. Beijing: Tsinghua University Press 2003
[4] Liu Leshan, Ouyang Xingming, Liu Xueqing. Microcomputer interface technology and application[M]. Wuhan: Huazhong University of Science and Technology Press, 2000
Previous article:Applications of ultra-bright LEDs
Next article:Application of 32-channel 256-level gray high-voltage driver chip HV632
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- 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!
- 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
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- DIY nucleic acid sampling registration system——lugl43138200
- [ST MEMS waterproof pressure sensor LPS27HHW review] + analysis and use of routines
- Free RF design tools.
- HuaDa Semiconductor MCU M0+ Series Product IAP Reference
- [Social Recruitment] [Campus Recruitment] China Electronics Technology Group Corporation Recruitment for Embedded Software Development
- EEWORLD University Hall----Live Replay: TI's new generation Sitara? AM62 processor revolutionizes human-computer interaction-accelerates the development of edge AI
- Zigbee low power consumption steps
- When using the ADC of Jinxin Electronics AVP32F335, the sampling value deviation
- mPower1203 programmable power supply also supports third-party applications to obtain the current of the device under test in real time
- The role of reference voltage in AD conversion