A Registry-Based Command Interaction Design Method

By adopting a registry-based design method, serial port command interaction in embedded microcontroller software development is simplified, solving the problems of complex and inefficient program design, and realizing real-time system status feedback and efficient instruction management.

CN115756645BActive Publication Date: 2025-10-31LUOYANG INST OF ELECTRO OPTICAL EQUIP OF AVIC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211458509.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-17
Publication Date
2025-10-31
Estimated Expiration
2042-11-17

AI Technical Summary

Technical Problem

In embedded microcontroller software development, traditional serial port command interaction design methods result in complex program design, low efficiency, difficulty in achieving real-time feedback of system operating status, and cumbersome addition of new instructions.

Method used

We adopt a registry-based command interaction design method, which enables the addition, querying, and deletion of commands through the registry. We use a two-dimensional array to store commands and processing interfaces, optimize the query process, store frequently used commands in the registry header, and store infrequently used commands in the registry footer, simplifying program design and improving efficiency.

Benefits of technology

It simplifies program design, reduces coding errors, improves program execution efficiency, and enables real-time operation status feedback of the microcontroller system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115756645B_ABST
    Figure CN115756645B_ABST
Patent Text Reader

Abstract

This invention discloses a registry-based command interaction design method, primarily addressing the problems of complex programming and low efficiency in serial port command interaction within microcontrollers. Unlike traditional methods where commands and related processing are intertwined, this registry-based command interaction design allows users to add, query, and delete commands by manipulating the registry. Within this framework, designers add corresponding commands to the registry and run registry query functions within the software body, focusing solely on command implementation. This significantly reduces the designer's workload, minimizes coding errors, and improves program efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of software interaction technology, specifically relating to a registry-based command interaction design method. Background Technology

[0002] In the field of embedded microcontroller software development, developers use the microcontroller's serial port to print information to reflect the current operating status of the microcontroller. Interaction is rarely achieved. As the system becomes more complex, simple printing cannot provide real-time feedback on the operating status of the entire system. When it comes to system operation, the interaction design is more complex, and only a small number of people design this part of the function.

[0003] Traditional interactive design methods use a while(1) loop to receive characters input from the serial port and check if the character is in the current command set. If it is, the corresponding function is executed. When a new instruction needs to be added, the developer adds corresponding character processing and parses the input parameters in while(1). As the number of commands increases, the processing content of while(1) eventually becomes extremely large, making the design cumbersome and the program execution efficiency low. Summary of the Invention

[0004] To overcome the shortcomings of existing technologies, this invention provides a registry-based command interaction design method, primarily addressing the problems of complex programming and low efficiency in serial port command interaction within microcontrollers. Unlike traditional methods where commands and related processing are intertwined, this registry-based command interaction design allows users to add, query, and delete commands by manipulating the registry. Within this framework, designers add corresponding commands to the registry and run registry query functions within the software body, focusing solely on command implementation. This significantly reduces the designer's workload, minimizes coding errors, and improves program efficiency.

[0005] The technical solution adopted by this invention to solve its technical problem includes the following steps:

[0006] Step 1: Developers implement the specific details of the command, including actions and states;

[0007] When a user calls the relevant interface to initialize the registry, the command is added to the registry.

[0008] In the main program while(1) loop, the registry query interface is called to retrieve and process the commands input on the serial port from the registry.

[0009] Step 2: The registry is implemented using a two-dimensional array; each element in the registry contains two members: the command entered by the user through the serial port and the corresponding processing interface in the software. The same command is not allowed to appear in the registry, and the commands are not case-sensitive.

[0010] Step 3: The registry operation interfaces involved are as follows:

[0011] The registry initialization interface initializes the global registry, performs validity and legality checks on the data in the registry, and connects to the registry query interface.

[0012] The registry new command interface checks whether the new command conflicts with the existing data in the registry, and adds the new command to the registry based on the check results. The principle of addition is: if the command is a frequently used command, it should be added to the beginning of the registry first, and if it is an infrequently used command, it should be added to the end of the registry.

[0013] The registry query interface implements command query in the registry. It is attached to the registry initialization interface and called in while(1), and the query starts from the beginning of the registry.

[0014] The registry command deletion interface is implemented when there are illegal commands in the registry. Illegal commands include command name conflicts and invalid naming issues. For illegal commands in the registry, the element is deleted and the registry is reinitialized.

[0015] Step 4: The program that implements the command resides inside the microcontroller and runs in debug mode. The microcontroller provides timely feedback on the operating status of the entire system based on the user's input instructions.

[0016] Preferably, the registry has a maximum of 256 elements, and the elements in the registry are added in the order of first-to-first-register.

[0017] The beneficial effects of this invention are as follows:

[0018] This invention adopts a registration method, which allows users to simply register the new command string in the registry to complete command query and invocation, simplifying program design and improving program execution efficiency. Attached Figure Description

[0019] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0020] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0021] The purpose of this invention is to provide a registry-based command interaction design method to solve the problem that adding instructions in traditional command interaction designs is cumbersome.

[0022] The registry-based command interaction design method of this invention allows developers to add new commands to the registry by calling a command registration interface. When a user invokes a related command on the serial port, the system receives the command, queries the registry for the corresponding command, and invokes the relevant processing. Using this method, developers only need to consider the implementation of the interface within this framework, without needing to worry about how commands are added.

[0023] In the command interaction design method of this invention, commands are based on a registry; the registry is implemented using a two-dimensional array, simplifying registry design and enabling more efficient command interaction; the registry includes initialization, registration, query, and deletion interfaces, standardizing registry operations; based on the framework design concept of the registry, developers can add commands on this framework, focusing only on the specific implementation of the commands; the registry's query optimization design concept stores frequently used commands in the registry header and uncommon commands in the registry footer, and queries start from the header, greatly improving the hit rate.

[0024] like Figure 1 The flowchart of the method of the present invention is shown. As can be seen from the figure, the developer first implements the specific details of the command, including actions, states and other reactions. The user calls the relevant interface to initialize the registry and adds the command to the registry. In the main body of the program while(1), the registry query interface is called to retrieve and process the command input on the serial port from the registry.

[0025] The registry is implemented using a two-dimensional array. Each element in the registry contains two members: the command entered by the user via the serial port and the corresponding processing interface in the software. Duplicate commands are not allowed in the registry, and commands are not case-sensitive. To improve the query efficiency of the registry, the registry has a maximum of 256 elements. The elements in the registry are added in the order of first-to-first-register.

[0026] The following are the registry operation interfaces involved:

[0027] The registry initialization interface primarily initializes the global registry, performs validity and legality checks on the data in the registry, and connects to the registry query interface.

[0028] The registry's new command interface primarily checks whether the new command conflicts with existing registry data. Based on the check results, it determines whether to add the new command to the registry. The principle for adding commands is as follows: if the command is frequently used, it should be added to the beginning of the registry first; otherwise, it should be added to the end of the registry.

[0029] The registry query interface implements command query in the registry. It is attached to the registry initialization interface and called in while(1). It starts the query from the head of the registry. The head usually stores the commands with high usage, which effectively improves the query efficiency and shortens the program response time.

[0030] The registry command deletion interface is mainly used to handle illegal commands in the registry, including issues such as conflicting command names and invalid naming. For illegal commands in the registry, the element is deleted and the registry is reinitialized.

[0031] The program implemented in this invention resides inside the microcontroller and runs in debug mode. The microcontroller can promptly provide feedback on the operating status of the entire system based on user-input instructions.

[0032] The registry-based interactive design realizes the modular construction concept. Once developers are familiar with the entire registry architecture, they only need to focus on the implementation of commands, reducing the program development cycle.

Claims

1. A registry-based command interaction design method, characterized in that, Includes the following steps: Step 1: Developers implement the specific details of the command, including actions and states; When a user calls the relevant interface to initialize the registry, the command is added to the registry. In the main program while(1) loop, the registry query interface is called to retrieve and process the commands input on the serial port from the registry. Step 2: The registry is implemented using a two-dimensional array; each element in the registry contains two members: the command entered by the user through the serial port and the corresponding processing interface in the software. The same command is not allowed to appear in the registry, and the commands are not case-sensitive. Step 3: The registry operation interfaces involved are as follows: The registry initialization interface initializes the global registry, performs validity and legality checks on the data in the registry, and connects to the registry query interface. The registry new command interface checks whether the new command conflicts with the existing data in the registry, and adds the new command to the registry based on the check results. The principle of addition is: if the command is a frequently used command, it should be added to the beginning of the registry first, and if it is an infrequently used command, it should be added to the end of the registry. The registry query interface implements command query in the registry. It is attached to the registry initialization interface and called in while(1), and the query starts from the beginning of the registry. The registry command deletion interface is implemented when there are illegal commands in the registry. Illegal commands include command name conflicts and invalid naming issues. For illegal commands in the registry, the element is deleted and the registry is reinitialized. Step 4: The program that implements the command resides inside the microcontroller and runs in debug mode. The microcontroller provides timely feedback on the operating status of the entire system based on the user's input instructions.

2. The command interaction design method based on a registry according to claim 1, characterized in that, The registry can contain a maximum of 256 elements, and the elements in the registry are added in the order of first-to-first-register.

Citation Information

Patent Citations

  • Real-time debugging positioning method of embedded system and apparatus thereof

    CN101340314A

  • Method for testing functions of massive functions

    CN103389940A