Implementation of Chinese Input Method in B-ultrasound System

Publisher:ChanheroLatest update time:2014-02-28 Source: 21IC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With the rapid development and popularization of computers today, it is very common to input, edit and process Chinese characters using computers. In medical electronic products, Chinese characters need to be displayed in more and more occasions.

When using a high-performance CPU, a GUI program supported by an embedded operating system (such as Linux, WinCE) can be used to implement a friendly human-machine interface. In many cases, a relatively simple MCU is needed to control the entire system, such as using a single-chip microcomputer STC89C516RD+ to implement system control and human-machine interface. At this time, a low-cost solution that occupies less resources must be sought. This article introduces the implementation of Chinese input method in the B-ultrasound system.

Font design

The usual way to display Chinese characters is: first use the font software to extract the required Chinese character dot matrix, and the obtained data can be put into the ASM assembly file, then compile the assembly file in the microcontroller integrated development environment to generate a BIN file, and then use the programmer to burn the BIN file to the chip. When in use, it reads the Chinese character dot matrix data in the chip and writes it to the character memory.

If there are few characters to be displayed, the dot matrix data is small, and the data can be burned into the program memory. To implement Chinese input method, there are many characters to be displayed, and the amount of data is large, so it is necessary to specially generate character library data and put it into the extended data memory.

There are usually the following methods to construct a Chinese character library: use program space to make a small character library; use a large-capacity ROM chip specifically for the Chinese character library, which is generally not used in small portable devices; in order to reduce costs and reduce size, a large-capacity serial data storage device, such as AT45DB041B, can be used for occasions where speed requirements are not very high.

The files HZK16 and ASC16 in the UCDOS software are 16×16 national standard Chinese character dot matrix files and 8×16 ASCII code dot matrix files, respectively, which are stored in binary format. The most commonly used ASCII code dot matrix is ​​5×7 (5 dots horizontally and 7 dots vertically) or 7×9. For characters of a given font, the more dots a glyph has, the better the quality of the glyph, and the larger the amount of data required, the more storage space it occupies. For different display systems, to display the same graphic, the required data arrangement order is different. The existing HZK16 and ASC16 files may not be directly applied to your own system. The common method is to use font software with freely definable arrangement methods to obtain data and then put it into the program or data storage area.

By comparison, it is found that the use of 12×12 dot matrix to represent Chinese characters and 8×12 dot matrix to represent ASCII codes can take into account both aesthetics and reduce hardware costs, and some program modules can be shared, which also lays the foundation for the later Chinese and English display interface and menu operation interface. When the font software takes data, one direction must be a multiple of 8, so 12×12 will automatically adjust to 16×12 or 12×16, and the dot matrix characters are shown in Figure 1.

 

 

Figure 1 Dot matrix characters

It is not difficult to find that it takes 24 bytes to represent a Chinese character, of which 12 bytes are half blank. If the data obtained from the font is compressed, 18 bytes are enough to store the dot matrix data of a Chinese character.

Hardware Block Diagram

As shown in Figure 2, the STC89C516RD+ microcontroller integrates 64KB flash memory and 1280B SRAM. By utilizing its internal resources, there is no need to expand the external program memory. The decoder, screen address generator, multi-channel address/data switching, TV signal generator, and TV signal synthesis are mostly implemented using FPGA programming. After the signal is synthesized, it is sent to the monitor screen for display via D/A conversion.

 

 

Figure 2 Hardware block diagram

Software Implementation

According to the survey, among the Chinese character input schemes, pinyin input accounts for more than 80%, while shape code users account for less than 20%. The essence of Chinese character input method is to establish a mapping relationship between key combinations and Chinese character codes. The input method of the ultrasound system using a full keyboard and the PC using a standard keyboard is essentially the same. The mapping from key combinations to Chinese character codes can be achieved by establishing an index table, as shown in Figure 3.

 

 

Figure 3 Schematic diagram of key combination index

In the Keil C compilation environment, the "Pinyin Input Method Module" can be downloaded from the Internet. The medical system often uses the hospital name and patient name. For this reason, some common place names and names are added to this module, with a total of 4120 Chinese characters. The dot matrix is ​​extracted using the font software, and compressed to form a Chinese character dot matrix database, which is placed in the data storage area. Then, the font combination index table is established, together with some parameters and table data, sharing an EEPROM 39VF010. The 51 series microcontroller can address a maximum of 64KB of storage space, and the P1 port can be used as a page address to access data space above 64KB.

Compared with Chinese input methods with limited keys (such as mobile phones), Chinese input methods with full keyboards can more easily complete the operation of 26 letters and other functions using keys.

After the character library is ready, the key to the next software design is to build the traversal algorithm of the pinyin combination tree (as shown in Figure 4) and the search algorithm for homophones. Some internal RAM resources of the 51 single-chip microcomputer are occupied here to store the pinyin code, the character library address ADDR0 mapped by the current pinyin combination, the character library address ADDR1 mapped by the next pinyin combination, and the first address ADDR of the currently displayed Chinese character. According to the pinyin combination, the traversal algorithm is used to find the dot matrix address of the first Chinese character of the pinyin combination, and the up and down keys are used to turn the page. By comparing ADDR with ADDR0 or ADDR1, it is ensured that the Chinese character is found in the same pinyin combination.

 

 

Figure 4 Example of Pinyin combination tree

in conclusion

This solution has been successfully implemented on a certain B-ultrasound system. Currently, the Chinese pinyin input and storage of medical record numbers have been realized, and the Chinese interface display has been realized with the help of the Chinese character library.

Reference address:Implementation of Chinese Input Method in B-ultrasound System

Previous article:Voltage monitoring devices perform multiple functions
Next article:Design of digital voltmeter based on YL-236 single chip computer training device

Latest Power Management Articles
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号