Thesaurus management and switching method for multi-language microcontroller
By sorting and managing entries in a microcontroller and using entries for indexing, the problems of cumbersome language switching and large resource utilization in the existing technology are solved, and efficient vocabulary management and multi-language switching are achieved.
Patent Information
- Application Number
- CN202411825459.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2044-12-12
AI Technical Summary
When adding new languages to existing microcontrollers, they need to manually replace the entries in the code one by one, which takes a long time and is cumbersome to operate. Due to space limitations, the lexicon stored in the microcontroller is limited, making it difficult to meet the needs of efficient retrieval and multi-language switching.
By sorting out all entries in the language, giving each entries a unique entries, and uniformly summarizing them into the preset format entries file, importing them into the program chip of the microcontroller, dividing the entry storage area and entry mapping area, searching the entry codes using the dichotomy method to realize entry indexing, and supporting U disk import and other methods to update the entries.
It realizes efficient vocabulary management and multi-language switching, simplifies the operation process, reduces resource usage, and improves the efficiency of system language management.
Smart Images

Figure CN119292730B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of word library matching and multi-language switching based on a single-chip microcomputer, and in particular refers to a word library management and switching method for a multi-language single-chip microcomputer. Background Art
[0002] Microcontrollers are usually programmed using C language, which makes it difficult to search and identify the language.
[0003] Generally speaking, the Flash and RAM space of a single-chip microcomputer is limited, and the operating efficiency is low. There are high requirements for the size and retrieval speed of the language vocabulary. In addition, due to space limitations, the single-chip microcomputer cannot store too many vocabulary. Therefore, when adding a new language to the single-chip microcomputer, it is faced with the problem of manually replacing the entries in the code one by one, which is time-consuming and cumbersome. Summary of the invention
[0004] The purpose of the present invention is to provide a vocabulary management and switching method for a multi-language single-chip microcomputer to solve the problems existing in the prior art, and is particularly suitable for single-chip microcomputers with limited resources to achieve efficient vocabulary management and switching.
[0005] In order to achieve the above object, the solution of the present invention is:
[0006] A vocabulary management and switching method for a multi-language single-chip microcomputer, comprising:
[0007] Step 1: sort all the terms that need to be displayed in a certain language system, assign a unique corresponding term code to each term, the term codes are sorted in ascending order and are not repeated, and these terms and their term codes are uniformly summarized into a vocabulary file in a preset format;
[0008] Step 2: Bind the corresponding description content displayed on the page or function in the program with the corresponding word barcode in the word library;
[0009] Step 3, import the word library file into the program chip of the single-chip microcomputer; the program chip is divided into two areas, including a word storage area and a word mapping area;
[0010] The entry storage area is used to store description content. The Flash address in the entry storage area represents the description of the corresponding entry when the program is running;
[0011] The entry mapping area is used to store the mapping relationship between the entry barcode and the Flash address in the entry storage area;
[0012] Step 4: The single chip microcomputer searches for the corresponding term code in the term mapping area through binary search, and then determines the storage address of the term to implement the term indexing;
[0013] Step 5. When the system needs to switch to a new language, there is no need to replace the entries in the page or function one by one. Just return to step 1, summarize all the entries and their barcodes in the new language vocabulary into a vocabulary file in a preset format and then import them into the system's microcontroller. The microcontroller re-executes step 3 to complete the language switch. During this period, the binding relationship between the barcode and the description content remains unchanged.
[0014] In the step 3, the entry storage area and the entry mapping area are replaced by U disk import, online import and upgrade import to realize the import of the vocabulary file, and the program is not modified.
[0015] Between step 4 and step 5, when it is necessary to synchronize the entry content with the host computer, the single-chip microcomputer transmits the entry code and its corresponding relationship to the host computer through communication, so that the host computer can keep consistent with the display content of the single-chip microcomputer through the entry code.
[0016] After adopting the above technical solution, the present invention has the following technical effects:
[0017] (1) It can improve the efficiency of multi-language switching. Specifically, by centrally managing the vocabulary, when the system needs to switch languages, there is no need to replace the entries in the pages and functions one by one, which greatly simplifies the operation process. Instead, all entries need to be sorted and unified into a vocabulary file in a preset format, and then imported into the system to complete the language replacement;
[0018] (2) It can reduce resource usage. By optimizing the storage and unified management of the vocabulary, only one vocabulary needs to be retained on a single machine to meet multi-language requirements, reducing the usage of FLASH and RAM.
[0019] (3) It can simplify implementation complexity. Through the USB flash drive import, online import and upgrade import functions, users can flexibly update the vocabulary and achieve more efficient system language management. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 The flowchart of a specific embodiment of the present invention. DETAILED DESCRIPTION
[0021] In order to further explain the technical solution of the present invention, the present invention is described in detail below through specific embodiments.
[0022] refer to Figure 1 The figure shows a flowchart of a single-chip multi-language system, including the following contents:
[0023] ·Multi-language word libraries are imported through "language.csv" or other formats of files;
[0024] How the imported word library is stored in the on-chip Flash;
[0025] How the microcontroller (EMS in the figure) matches the entries in the vocabulary;
[0026] How does the host computer obtain the entry information of the vocabulary based on the word barcode?
[0027] Specifically, the present invention discloses a vocabulary management and switching method for a multi-language single-chip microcomputer, comprising:
[0028] Step 1: Arrange all the entries that need to be displayed in a certain language (based on the frequency of use, such as Chinese in China), assign a unique corresponding barcode to each entry, the barcodes are sorted in ascending order and are not repeated, and these entries and their barcodes are uniformly summarized in the language.csv or other preset format of the word library file; in this embodiment, please refer to the attached Figure 1 , the preset format includes two columns: the term code (Code) and the term description (Describe);
[0029] Step 2. Bind the corresponding description (Describe) content displayed on the page or function in the program to the corresponding word barcode in the word library; for example, the description content corresponding to the word barcode 735 is "battery overvoltage alarm value". If the battery protection parameter page in the code needs to display the Chinese description of the setting content "battery overvoltage alarm value", the word barcode 735 can be used instead of "battery overvoltage alarm value";
[0030] Step 3, import the word library file into the program chip of the single-chip microcomputer; the program chip is divided into two areas, including a word storage area and a word mapping area;
[0031] The entry storage area is used to store description content; the Flash address in the entry storage area represents the description of the corresponding entry when the program is running; for example, if the program wants to read the description of "battery overvoltage alarm value", it only needs to read the address content in 0x08008513;
[0032] The entry mapping area is used to store the mapping relationship between the entry code and the Flash address in the entry storage area; for example, the entry code of "battery overvoltage alarm value" is 735, and the corresponding mapping address is 0x08008513;
[0033] Step 4, the single chip computer searches for the corresponding word code in the word mapping area through binary search, and then determines the word storage address to implement the word index; for example, the address content in 0x08008513 can be obtained in the word mapping area through the word code 735, and then the word index is implemented;
[0034] Step 5. When the system needs to switch to a new language, there is no need to replace the entries in the page or function one by one. Just return to step 1, summarize all the entries and their barcodes in the new language vocabulary into language.csv or other vocabulary files in a preset format, and then import them into the system's microcontroller. The microcontroller re-executes step 3 to complete the language switch. During this period, the binding relationship between the barcode and the description content remains unchanged, so there is no need to change the code.
[0035] Through the above scheme, the present invention can improve the efficiency of multi-language switching. Specifically, by centrally managing the vocabulary, when the system needs to switch languages, there is no need to replace the entries in the pages and functions one by one, which greatly simplifies the operation process. Instead, all the entries only need to be sorted and unified into "language.csv" or other formats of files, and then imported into the system to complete the language replacement; the present invention can reduce resource usage. By optimizing the vocabulary storage and unified management, only one vocabulary needs to be retained on a single-sided machine to meet multi-language requirements, reducing the usage of FLASH and RAM; the present invention can simplify the implementation complexity. Through the U disk import, online import and upgrade import functions, users can flexibly update the vocabulary to achieve more efficient system language management.
[0036] Specific embodiments of the present invention are shown below.
[0037] In the above step 3, the word library file can be imported by replacing the word storage area and the word mapping area through U disk import, online import and upgrade import, without modifying the program.
[0038] Between the above steps 4 and 5, when it is necessary to synchronize the entry content with the host computer, the single-chip microcomputer transmits the entry code and its corresponding relationship to the host computer through communication, so that the host computer can keep consistent with the display content of the single-chip microcomputer through the entry code.
[0039] The above embodiments and drawings do not limit the product form and style of the present invention. Any appropriate changes or modifications made by ordinary technicians in the relevant technical field should be deemed to be within the patent scope of the present invention.
Claims
1. A method for managing and switching the word library of a multi-language single-chip microcomputer, characterized in that include: Step 1: sort all the terms that need to be displayed in a certain language system, assign a unique corresponding term code to each term, the term codes are sorted in ascending order and are not repeated, and these terms and their term codes are uniformly summarized into a vocabulary file in a preset format; Step 2: Bind the corresponding description content displayed on the page or function in the program with the corresponding word barcode in the word library; Step 3, import the word library file into the program chip of the single-chip microcomputer; the program chip is divided into two areas, including a word storage area and a word mapping area; The entry storage area is used to store description content. The Flash address in the entry storage area represents the description of the corresponding entry when the program is running; The entry mapping area is used to store the mapping relationship between the entry barcode and the Flash address in the entry storage area; Step 4: The single chip microcomputer searches for the corresponding term code in the term mapping area through binary search, and then determines the storage address of the term to implement the term indexing; Step 5. When the system needs to switch to a new language, there is no need to replace the entries in the page or function one by one. Just return to step 1, summarize all the entries and their barcodes in the new language vocabulary into a vocabulary file in a preset format and then import them into the system's microcontroller. The microcontroller re-executes step 3 to complete the language switch. During this period, the binding relationship between the barcode and the description content remains unchanged.
2. The method for managing and switching the vocabulary of a multi-language single-chip computer according to claim 1, characterized in that include: In the step 3, the entry storage area and the entry mapping area are replaced by U disk import, online import and upgrade import to realize the import of the vocabulary file, and the program is not modified.
3. The method for managing and switching the vocabulary of a multi-language single-chip computer according to claim 1, characterized in that include: Between step 4 and step 5, when it is necessary to synchronize the entry content with the host computer, the single-chip microcomputer transmits the entry code and its corresponding relationship to the host computer through communication, so that the host computer can keep consistent with the display content of the single-chip microcomputer through the entry code.
Citation Information
Patent Citations
Implementation method and equipment for low-cost embedded multi-language database
CN117149744A