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. It is a derivative product based on the 8-bit 80C51 single-chip microcomputer. In addition to fully retaining the framework of the 80C51 instruction system and hardware structure, it has carried out many aspects of strengthening, expansion and innovation. P89C51RD2 uses 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. The external crystal oscillator in the 6-clock mode is 0-20 MHz, and the external crystal oscillator in the 12-clock mode can reach 0-33 MHz . [page]
For general application systems, the Chinese characters in the first and second level character libraries are sufficient. The Chinese
character 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 level 6,763 Chinese characters share 13,526 B.
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.
[page]
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:High-speed control scheme for large-screen LED display using MCS51 single-chip microcomputer
Next article:Design of gas concentration information detection and alarm based on 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
- Request: DC-DC small package chip similar to LM2596
- What is the reason! Another wind turbine fire accident! And caused a ground wildfire
- 【Iprober 520 current probe】Practical use in motor control
- Can you please help me find out where is the problem with the program?
- What are the basic units of Weber Wb and Tesla T?
- How to add c files in esp32 idf components to compile
- Have you noticed the LPDSP32 audio codec inside RSL10? Does your project use this resource?
- Will the push-pull circuit be straight through?
- Award-winning live broadcast: Third-generation TI C2000 new features resource update
- EEWORLD University - Industrial Internet of Things using CC1310 sub-1 GHz wireless MCU