Chinese Character Input in 51 Single-Chip Microcomputer Display and Control System

Publisher:数字思维Latest update time:2011-10-15 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Reference address:Chinese Character Input in 51 Single-Chip Microcomputer Display and Control System

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

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号