For PC, inputting Chinese characters is very simple, but in some single-chip human-machine interface systems, real-time input of Chinese characters is very difficult, and most of them can only display Chinese characters with pre-selected font dot matrix. However, each 16×16 Chinese character dot matrix is represented by 32 bytes. For occasions that require flexible use of a large number of Chinese characters, the program volume is too large and it is very difficult to implement. The following analyzes the structure of the Chinese character library, designs a practical Chinese pinyin input method, and gives the basic program of the LCD Chinese character display module.
1 Internal code representation of Chinese characters
Different operating systems have different internal codes for Chinese characters. For example, GB231280 Chinese character code is used on Apple OS, while GBK Chinese character code is used on Windows system. There are also Unicode code, GB180302000, Founder 748 code, etc. Since GB 231280 is the earliest (1980) "General Chinese Character Set and Its Interchange Standard Code" promulgated by the China National Bureau of Standards, all subsequent codes are compatible with GB2312. It contains 7,445 Chinese characters, letters, symbols, etc., including 6,763 Chinese characters, including 3,755 first-level Chinese characters and 3,008 second-level Chinese characters. It is the only Chinese code that is mandatory for use in mainland China and overseas regions that use simplified Chinese (such as Singapore, etc.), so it is also called the standard Chinese character library.
The dot matrix data of each Chinese character needs to occupy 32 B of memory, where the strokes are displayed is 1, and where there are no strokes is 0. Then the dot matrix data is converted into a dot matrix data form that can be displayed by the dot matrix LCD through the C51 language of the single-chip microcomputer.
2. Production of Chinese Character Library
This section discusses the specific method of burning a 16×16 dot matrix Song style Chinese character library into a 512 kB memory.
The memory chip used in this example is AM29C040, which is a 512 kB FLASH ROM produced by AMD. Readers can also use other products with a capacity of not less than 256 kB, but in the specific circuit design, attention should be paid to the pin definition and logical relationship, and the corresponding model should be selected when burning; UCDOS software has a file named HZK16DAT, which is a 16×16 national standard Chinese character dot matrix file. In this file, all Chinese characters in the national standard area code are stored in order from small to large according to the Chinese character area code. Each Chinese character occupies 32 B, and each area is 94 Chinese characters. Its size is 262 kB, which can all be written into AM29C040. In addition to storing all national standard Chinese characters, it can also store 8×16 ASCII code dot matrix data and Chinese character sentence encoding data, which is more convenient to use.
In actual operation, the production of a hardware Chinese character library is no different from the programming of an ordinary program memory. Note that when calling in the HZK16 file, it must be opened in binary mode. After successful programming and verification, the memory can be removed for use. In this way, a hardware Chinese character library is produced.
3 Design ideas
In this example, starting from the low-cost and low-power design concept, the Philips P89C51RD2 microcontroller is used as the core, and the input uses a 4×4 multiplexed keyboard, which can input numbers, letters or pinyin. The Chinese character library is stored in AMD's A M29C040 (512 k×8 b) FLASH, the LCD module DMF50174 (320×240), and the display controller SE D1335 is a liquid crystal display control chip produced by Japan's SEIKO EPSON. The chip select (control signal) of each chip is generated by 74 HC138 decoding.
The Chinese pinyin is input by keyboard, the single chip retrieves the area code, reads the Chinese character dot matrix design from FLASH, displays it on LCD, and uses the IAP function of P89C51RD2 to program online and change the user interface or interface function online.
4 Chinese character input
P89C51RD2 is a very excellent single-chip microcomputer released by Philips in 2001. This single-chip microcomputer is a derivative product based on the 8-bit 80C51 single-chip microcomputer. In addition to fully retaining the large framework of the 80C51 instruction system and hardware structure, it has carried out many aspects of strengthening, expansion and innovation. P89C51RD2 utilizes the original 16-bit addressing mechanism for external data and program memory, expands the on-chip RAM to 1 kB, and the on-chip FLASH EPROM to 64 kB. It has ISP (in-system programmable) and IAP (in-application programming), and has 6-clock and 12-clock modes. In the 6-clock mode, the external crystal oscillator is 0-20 MHz, and in the 12-clock mode, the external crystal oscillator can reach 0-33 MHz.
As a general application system, the Chinese characters in the first and second level character libraries are sufficient.
The word area code 2 B represents a Chinese character. The FLASH EPROM on the 64 kB chip can store more than 30,000 Chinese characters. In the design, they are stored in the FLASH in the form of an array. The first and second levels of 6,763 Chinese characters share 13,526 B.
The example approach is as follows: use Chinese Pinyin as the array name, the area code of the Chinese characters contained in the Pinyin as the array element, and define all the first and second level Chinese characters in the program in the form of code. This is a relatively tedious task and the workload is relatively large.
Input Chinese Pinyin from the keyboard, search the array with the same name through the input Chinese Pinyin index, get the area code of the Chinese character from the array and put it into the array qwm, put the number of Chinese characters into qwm_counter, and display it on the LCD. If one page cannot be displayed, you can turn the page to display it until it is displayed. Select the required Chinese characters to display and save them. You can also use the IAP function to program in the application to achieve code reconstruction. Definition:
Use the puthz16 program shown above to read the dot matrix data of these Chinese characters from FLASH using the area code, then use the dot drawing function to write the Chinese character dot matrix into the display cache and use the Chinese character display program to display the Chinese characters on the LCD or communicate through the serial port to send the Chinese character encoding.
5 Chinese character display
The DMF50174 used in the LCD display in this design is a 320×240 dot matrix, controlled by SED1335. Each screen can display 20×15, a total of 300 Chinese characters. The most basic display program is given below, based on which Chinese characters can be easily displayed on the LCD.
This design method has been actually applied to a system display controller, and it has been proven to be reliable and effective, and has a certain reference value for low-cost and low-power design. Due to space limitations, the IAP function is not listed, and readers can refer to relevant literature to design it themselves.
Previous article:Temperature and humidity control system of warehouse based on 51 single chip microcomputer
Next article:Design of error detection method in serial communication based on 51 single chip microcomputer
- 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!
- 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
- 01.GD32L233C-START, the energy-saving "core" era!
- Implementation of SDRAM controller in high-speed image storage system.pdf
- Common mistakes made by C language beginners | 22 points of summary
- PWM pulses generated by ecap
- 【Goodbye 2021, Hello 2022】Busy and fulfilling
- Derivation of the voltage transfer function of a circuit containing capacitors T(S) = Vo(S)/Vi(S)
- Answer the question to win a prize | Using GaN technology to meet power adapter design challenges
- Question about the schematic diagram of switching power supply
- Material: RF Circuit Design - Theory and Application
- A Brief Analysis of Streaming Media Solutions Based on Embedded DSP