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.
Previous article:Voltage monitoring devices perform multiple functions
Next article:Design of digital voltmeter based on YL-236 single chip computer training device
- Popular Resources
- Popular amplifiers
- 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
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Date in spring - go to the beach and relax
- Sub-library: BlueCoin Development Platform
- [Atria AT32WB415 Review] 4. Implementation of printf under AT32 IDE (printf redirection)
- Power amplifier driving capacitive load case sharing
- Sapphire on PCB---DFM about optical positioning points
- How to choose between different chips in TI's Sub-1GHz product line?
- Design of optimal horn antenna based on HFSS
- Compilation and use of rocket-chip tool chain
- How to connect several cameras to a 100M switch
- Nvidia is said to acquire Arm for 40 billion pounds. Will the situation of domestic chips get worse?