Design of Chinese-English Translator Based on ARM7 Controller

Publisher:MysticalSoulLatest update time:2010-12-23 Source: 电子设计工程Keywords:Translator Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In order to improve the situation that a certain welding equipment can only output and print English documents, an English to Chinese translator with a high-performance ARM7 controller - LPC2214 as the core was designed. The design principles of the specific hardware circuit and optimized software algorithm were discussed in detail. The experimental results show that the translator has no restriction on the amount of input English data, which can significantly reduce the system hardware resource requirements and greatly improve the printing speed.

A welding device stores a large amount of data that needs to be output through a printer. However, the device and its supporting micro thermal printer can only print in English, not Chinese, which affects the user's reading. In addition, the original supporting English printer has the disadvantages of slow printing speed, large interval between each group of data, and waste of paper. Therefore, in order to solve the above problems, according to the application needs of actual engineering projects, a design scheme of English-to-Chinese translator based on ARM is proposed. The design is to add a circuit board with ARM as the core between the original device and the thermal printer that supports Chinese printing as an English-to-Chinese translator, receive the English data transmitted by the device, and then convert it into Chinese through the optimization algorithm, which can be printed while receiving. From the experimental results, the system design has good printing output effect, the whole printing process is fast and quick, the interval between each group of data is adjustable, and a lot of paper can be saved.

1 System Hardware Circuit Design

The system structure diagram of the translator is shown in Figure 1. It mainly includes power supply, core controller LPC2214 and dual serial port interface as well as startup and ISP control interface circuits. The system design adopts optimized system software algorithm, which can save a lot of hardware resource requirements. Due to the large amount of data and the requirement for fast printing, usually a large capacity SRAM is added to receive English data, and then compare and translate the print output. However, this system adopts a circular receive/send buffer and foreground and background program mode, so there is no need to increase SRAM, and it can realize receiving and printing at the same time, and the system hardware circuit design is simple and clear.

1.1 Power supply circuit

Figure 2 shows the power supply circuit of the system. It can be seen from the figure that the power input terminal only needs a voltage input of about 12 V, which is first reduced to 5 V through 7805 to meet the usual 5 V power supply and the input requirements of the low voltage difference regulator SPXlll7. Since LPC2214 requires two sets of power supply voltage inputs: 3.3 V and 1.8 V, the 5 V voltage is then output to 3.3 V and 1.8 V respectively through SPXlll7-3.3 and SPXlll7-1.8 to power LPC2214. In addition, the VDl diode in Figure 2 is designed to prevent the reverse power supply from burning the circuit.

1.2 LPC2214 and its startup control circuit

LPC2214 is a 32-bit high-performance processor based on ARM7 core produced by PHILIPS, which is widely used. It includes 256 KB Flash and 16KB SRAM. The 128-bit wide memory interface and unique acceleration structure on the chip enable the processor to run at a working frequency of up to 60 MHz. In addition, the memory can be configured into 4 groups through the external memory interface, and the capacity of each group is up to 16 MB. In addition, a variety of peripherals are integrated on the chip, including dual serial ports, 8 A/D acquisition channels, I2C interface and SPI interface, interrupt control supporting 32 interrupt requests, and up to 112 general I/O ports. Due to the high integration, it is not necessary to expand many external devices like 5l microcontrollers, which greatly simplifies the system hardware circuit design. Figure 3 shows the startup control circuit of the core controller LPC2214 of the English-to-Chinese translator. In Figure 3, the P2.26 and P2.27 pins of the LPC2214 need to be connected to an external pull-up resistor. After the system is reset, the program will start running from the address 0x00000000 of the on-chip Flash. In addition, the P0.14 pin is connected to a pull-up resistor to disable ISP (In-System Programming). If you want to enable ISP, just short the jumper JP3.


1.3 Dual serial port interface circuit

LPC2214 contains two serial interfaces, namely UART0 and UART1, which just meet the requirements of the system design application. These two serial interfaces are connected to the device and printer respectively. Since both the device and the printer require standard RS232 serial transmission, and LPC2214 is 3.3V level, two SP3232E are used for RS232 level conversion, as shown in Figure 4. LPC2214 detects the existence of the printer through the CTS1 signal of terminal J2 and notifies the device through the DTR signal of terminal J1; and detects whether the internal buffer of the printer overflows through the RXD1 (BUSY) signal of terminal J2; when the internal receiving buffer of LPC2-214 is full, the CTS signal of terminal J1 notifies the device to suspend data transmission.

2 System Software Algorithm

Due to the large amount of data, the software design was optimized, mainly including three parts: Chinese and English data storage method, circular receiving and sending buffer algorithm, and search and translation algorithm.

2.1 Chinese and English data storage methods

First, the problem involved in the English-to-Chinese translator is the storage of Chinese characters in the computer. The storage of Chinese characters in the computer is stored in the form of machine code, and one Chinese character occupies 2 bytes. Therefore, in LPC2214, the Chinese character constant string corresponding to the received English string can be directly defined as the translated data. Secondly, in order to facilitate the search, the received English string is divided into 3 categories, and the corresponding Chinese character string is also divided into 3 categories, as shown in Figure 5. Among them, library 1 is the English line containing ":", and the corresponding Chinese translation only translates the English before ":", and the English characters and numbers after ":" do not need to be translated and directly output; library 2 is the English line that does not contain ":", and the corresponding Chinese library 2 can be directly output; library 3 is the English line library with polysemous semantics, which is further subdivided in Chinese library 3 and output. In the specific programming, a two-dimensional array structure is used to store the Chinese and English character library.

2.2 Ring receive and send buffer algorithm

The amount of data transmitted by the device is very large, with a total of hundreds of groups of data, and each group of data contains dozens of lines of English characters and numbers. If the corresponding Chinese characters are searched after all the data transmitted by the device is received, and the printer is controlled to print out in sequence after finding them, not only a large buffer is required for storage, but also a long delay from receiving data to printer output is required. Therefore, the front-end and back-end program mode is adopted here, that is, receiving, searching, and printing at the same time. This mode saves both time and storage space. A storage space is opened in the system as a receiving buffer, as shown in Figure 6. Two pointers are set: write pointer and read pointer. When initialized, these two pointers point to the starting position of the storage area respectively. The receiving device data adopts the UART0 serial port receiving interrupt processing mode so as not to lose any character sent by the device. After each line of English data is received by UART0, the write pointer is increased by 1. When the write pointer reaches the maximum storage space position, the write pointer is reset to the starting storage position, thus forming a circular buffer. When the receiving buffer is not empty, that is, there is English line data that needs to be translated, the read pointer points to the English line data that needs to be translated. Similar to the write pointer, after each line of data is translated, the printer is controlled to output and print through UART1, and the read pointer is increased by 1. When the read pointer reaches the maximum storage space position, the read pointer is reset to the starting storage position. Experiments show that setting the receiving and sending buffers to a few lines can normally receive and print data.

2.3 Search and Translation Algorithms

The search and translation algorithm is performed in the main program, which is to compare each line of English data received in the receiving and sending buffers with the English line data stored in the three English libraries. If they are consistent, the line number in the current English library is returned, and then the corresponding Chinese library data line number is found according to the line number. Finally, the printer can be controlled to output and print in a certain format. The entire algorithm process is shown in Figure 7.

3 Experimental Results

Figure 8 shows the comparison of English and Chinese printing effects. Due to the large amount of data, only a small section is captured here. It can be seen that the Chinese print output is accurately translated, neatly formatted, and has a suitable font size. In addition, since a faster thermal printer was selected, it can be clearly seen from the debugging process that the speed of Chinese printing is much faster than the original English printing speed.


4 Conclusion

The English-to-Chinese translator implemented in this system adopts better solutions in both software and hardware, with high hardware integration, small circuit board size, and simple software algorithms. Except for the startup code which uses assembly language, most of the other functional codes are programmed in modular C language. Therefore, for other related application areas, only corresponding changes in hardware and software are needed to facilitate implementation.

Keywords:Translator Reference address:Design of Chinese-English Translator Based on ARM7 Controller

Previous article:Research on SMC Interface of ARM920T and PC/104 Bus Simulation
Next article:Design of 14-bit A/DMAX194 in ARM single-chip system

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号