Multi-state jump method, device and system based on serial port communication

By sorting and generating adapters on the microcontroller serial port, the problem of confusion in command management and function reuse in serial communication is solved, and flexible multi-state jump and efficient development are achieved.

CN120508318APending Publication Date: 2025-08-19THINKCAR TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510598393.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Priority Date
2024-05-10
Filing Date
2025-05-09
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

During the microcontroller communication process, the command management and function reuse of serial communication are chaotic, resulting in low development efficiency and difficult to achieve flexible multi-state jumps.

Method used

By sorting each layer of serial ports and generating adapters, the adapters are used to jump according to the instruction content to obtain matching functions or combination functions.

Benefits of technology

It realizes efficient management and flexible jumps of serial communication, solves the chaotic problem of command and function reuse, and helps developers to develop quickly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120508318A_ABST
    Figure CN120508318A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of communication, and discloses a multi-state jump method, device and system based on serial port communication, and the method comprises the steps: sorting each layer of serial ports, and enabling each layer of functions to be multiplexed according to a sorting mode; setting each layer of serial ports to generate adapters; and when an instruction is received, the adapter is commanded to jump based on the instruction content, and a function or a combined function matched with the instruction content is obtained to be called. Each layer of serial port is optimized, after a large number of instructions are managed and processed, the problems that in development of a single-chip microcomputer based on serial port communication, serial port instruction sending management is disordered, instruction multiplexing, function multiplexing and logic and data processing are disordered are solved, flexible skipping can be achieved, logic processing and multiplexing processing of different function codes can be achieved, and the development efficiency of the single-chip microcomputer based on serial port communication is improved. Therefore, developers can be assisted in rapid development.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to patent application number CN202410577460.4 filed with the China Patent Office on May 10, 2024, the entire contents of which are incorporated herein by reference. Technical Field

[0003] The present invention relates to the field of communication technology, and in particular to a multi-state jump method, device and system based on serial port communication. Background Art

[0004] Currently, the most common communication method for microcontrollers is the serial communication protocol. Serial communication requires setting up the serial port and sending and receiving commands. To complete a single function, numerous different commands must be sent. Combining different commands, or combining the same commands in a different order, creates a smaller functional module. These smaller functions are then combined and sequenced according to functional logic to achieve the desired functionality. This means that developing a multi-state transition function based on serial communication requires not only configuring the microcontroller pins but also managing and processing numerous commands, logically processing and reusing different functional codes, and flexibly transitioning between states. Therefore, a code framework that is easy to maintain, highly reusable, and allows for flexible state transitions is needed to facilitate rapid development. Summary of the Invention

[0005] The main purpose of the present invention is to provide a multi-state jump method, device and system based on serial communication, aiming to solve the technical problems that arise in the single-chip microcomputer communication process in the prior art.

[0006] The present invention proposes a multi-state jump method based on serial communication, the improvement of which includes:

[0007] Sort the serial ports on each layer, and the functions on each layer can be reused according to the sorting method;

[0008] Set up each layer of serial port to generate adapters;

[0009] When an instruction is received, the adapter is commanded to jump based on the instruction content, and a function or combined function matching the instruction content is obtained for calling.

[0010] As an improvement to the above technical solution, the jump method specifically includes:

[0011] Instructing the adapter to send at least one transfer function value as a guide to jump based on the instruction content;

[0012] And / or, the jump method further includes the following specific steps:

[0013] Based on the plurality of transfer function value guidelines, obtaining at least one functional area;

[0014] Each functional area is sorted according to the instruction content or according to the guidance order of multiple transfer function values to generate functions or combine functions.

[0015] As a further improvement of the above technical solution, before receiving the instruction, the method further includes setting the instruction, the steps of:

[0016] Get the serial port data of each layer and parse it to get the type and function of each serial port;

[0017] Set instructions based on the type and function of the serial port and generate multiple instruction subsets;

[0018] Pairing the instruction subset with the transfer function value, and storing the paired transfer function value in a database;

[0019] When receiving the instruction, the switch is instructed to send a switch function value as a guide to jump based on the instruction subset.

[0020] As a further improvement of the above technical solution, when the instruction is received, the method further includes:

[0021] Obtaining instructions and parsing them to obtain at least a subset of instructions;

[0022] sorting the multiple instruction subsets according to the order in which the instruction subsets are obtained by parsing;

[0023] Instructing the adapter to send at least one transfer function value as a guide to jump based on the order of the instruction subset, and obtaining a functional area matching the instruction subset;

[0024] When the last functional slice matching the instruction subset is obtained, all functional slices are aggregated according to the order in which they are obtained to form a function or a combined function for calling.

[0025] As a further improvement of the above technical solution, the method includes:

[0026] Analyze the instructions and determine the number of instruction subsets of the same type;

[0027] If there are multiple instruction subsets of the same type, trigger the adapter to send at least one transfer function value as a guide to jump to obtain a combined function;

[0028] If there is no instruction subset of the same type, the adapter is instructed to send the transfer function value as a guide to jump to obtain the function.

[0029] The present invention also provides a multi-state jump system based on serial communication, comprising:

[0030] The serial port sorting end sorts the serial ports at each layer, and the functions of each layer can be reused according to the sorting method;

[0031] The adapter generation end sets each layer of serial port to generate an adapter;

[0032] The jump calling end, when receiving an instruction, commands the adapter to jump based on the instruction content, and obtains a function or combined function matching the instruction content for calling.

[0033] The present invention also provides a multi-state jump device based on serial communication, the improvement of which is that it includes:

[0034] Sorting module, which is used to sort the serial ports at each layer, and the functions of each layer can be reused according to the sorting method;

[0035] A setting module, the setting module is used to set each layer of serial port to generate an adapter;

[0036] The processing module is used to instruct the adapter to jump based on the content of the instruction when receiving the instruction, and obtain the function or combined function matching the content of the instruction for calling.

[0037] The present invention also provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps of any one of the above-mentioned multi-state jump methods based on serial port communication.

[0038] The present invention also provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned multi-state jump method based on serial port communication when executing the computer program.

[0039] The present invention also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the multi-state jump method based on serial communication are implemented.

[0040] The beneficial effects of the present invention are as follows: the present invention optimizes each layer of serial port, manages and processes a large number of instructions, solves the problems of chaotic management of serial port instruction sending and confusion of instruction multiplexing, function multiplexing, logic and data processing in the development of single-chip microcomputers based on serial port communication, and can flexibly jump to realize logical processing and multiplexing processing of different function codes, so as to assist developers in rapid development. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1This is a flow chart of a multi-state jump method based on serial communication according to an embodiment of the present invention;

[0042] Figure 2 This is a partial flow chart of a multi-state jump method based on serial communication according to an embodiment of the present invention;

[0043] Figure 3 This is a partial flow chart of a multi-state jump method based on serial communication according to an embodiment of the present invention;

[0044] Figure 4 This is a partial flow chart of a multi-state jump method based on serial communication according to an embodiment of the present invention;

[0045] Figure 5 This is a structural diagram of a multi-state jump device based on serial communication according to an embodiment of the present invention;

[0046] Figure 6 This is a schematic diagram of the principle of a multi-state jump system based on serial communication according to an embodiment of the present invention;

[0047] Figure 7 Schematic diagram of the internal structure of a computer device according to an embodiment of the present invention.

[0048] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments.

[0049] Icons: 100-Sorting module; 200-Setting module; 300-Processing module. DETAILED DESCRIPTION

[0050] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0051] Example 1

[0052] like Figure 1 As shown, the present invention proposes a multi-state jump method based on serial communication, comprising:

[0053] Step S1: sort the serial ports of each layer, and the functions of each layer can be reused according to the sorting method;

[0054] Step S2: setting each layer of serial port to generate an adapter;

[0055] Step S3: When receiving the instruction, the adapter is instructed to jump based on the instruction content, and a function or a combination of functions matching the instruction content is obtained for calling.

[0056] In the above embodiment, the serial port of the present invention is divided into six layers, including the pin configuration layer, serial port transceiver processing layer, instruction processing layer, serial port data processing layer, functional logic layer, and business logic layer. The present invention prioritizes the pin configuration layer, deploys all parameters, and then deploys the serial port transceiver processing layer, and so on until the business logic layer is deployed. Regarding step S1, the present invention arranges the serial ports from top to bottom as follows: business logic layer, functional logic layer, serial port data processing layer, instruction processing layer, serial port transceiver processing layer, and pin configuration layer. This arrangement allows the upper serial port to reuse the instructions and functions related to the lower serial port layer, thereby completing the call of the combined function. The pin setting layer of the present invention is provided with functions such as serial port initialization and timer configuration pins; the serial port transceiver processing layer is provided with functions for serial port sending and serial port receiving; the instruction processing layer is provided with functions related to instruction string processing; the serial port data processing layer is provided with functions for processing and encapsulating the specific reply meaning of each different instruction reply; the functional logic layer is provided with functions for small functional modules composed of different instructions; and the business logic layer is provided with functions for combining small functional modules to implement specific functions according to specific business logic. In addition, after the functions are set up inside each layer of the serial port, the serial port of each layer needs to be set up in order to generate an adapter. When an instruction is received, the adapter is commanded to jump based on the instruction content, and a function or combined function that matches the instruction content is obtained for calling. The functions and combined functions of the present invention are all composed of various functions contained inside each layer of the serial port. Commanding the adapter to jump obtains a function or combined function composed of various functions. The present invention optimizes each layer of serial port and manages and processes a large number of instructions, thereby solving the problems of chaotic management of serial port instruction sending, instruction multiplexing, function multiplexing, and logical and data processing in the development of single-chip microcomputers based on serial port communication. It can flexibly jump to realize logical processing and multiplexing of different function codes, so as to assist developers in rapid development.

[0057] Prioritize placing all instructions in the same container command and writing them so that the instructions can be initialized uniformly and the values of each state can be managed uniformly in a SATE container. Set the serial port for each layer as follows:

[0058] Step A: Write the functions of the first layer of pin configuration layer: Place the pin configuration related functions such as serial port initialization and timer initialization. After placing and verifying that the pin configuration can operate normally, you can write the second layer.

[0059] Step B, write the functions of the second layer serial port transceiver processing layer: set up the serial port sending and receiving, verify that the serial port can send and receive data normally and does not display garbled characters, and then write the third layer function.

[0060] Step C, write the function of the third layer instruction processing layer: write the function of splicing, truncating and other operations on the instruction string, including the necessary splicing and truncating of the instructions in the command and the incoming parameters to form the instructions to be sent that meet the requirements.

[0061] Step D, write the function of the fourth layer serial port data processing layer: write each command reply content processing function one by one and encapsulate the representative meaning of the specific reply. For example, send a command to check the WIFI connection. When the reply is 1, it means idle, when the reply is 2, it means connecting, and when the reply is 3, it means connected. At this time, you need to encapsulate the meaning of these 1, 2, and 3 and give them identifiers.

[0062] Step E: Write functions for the fifth functional logic layer: Encapsulate functional areas composed of different instructions. For example, to implement a Wi-Fi file download function, you first need to send a communication test instruction and a download instruction. The communication test instruction is used to determine the test Wi-Fi file download channel, and the download instruction is used to download the Wi-Fi file to the specified channel. Logically combining the sending and receiving of these two instructions will implement the Wi-Fi file download function.

[0063] Step F: Write functions for the sixth business logic layer: Combine functional areas according to specific logic to implement functional logic. For example, to implement a Wi-Fi upgrade function, you need to have three small functions: Wi-Fi scanning function area, Wi-Fi connection function area, and Wi-Fi file download function area.

[0064] Regarding step 3 above, when an instruction is received, the adapter is instructed to jump based on the instruction content, and a function or combination of functions matching the instruction content is obtained for calling. The jump method specifically includes:

[0065] Step S301: instructing the adapter to send at least one transfer function value as a guide for jump based on the instruction content.

[0066] Based on the above embodiment, the jump method of the present invention further includes instructing the adapter to send at least one jump function value based on the instruction content as a guide for jump, so as to obtain a function or a combination of functions composed of various functions. With respect to step S301, for example, to implement the WIFI connection function, the WIFI connection function includes two steps: scanning for WIFI and connecting to WIFI. First, it is necessary to send instructions to the 6th layer serial port to implement the WIFI connection business logic. The WIFI connection also includes two states: WIFI connection success and WIFI connection failure. These two states require sending instructions to the 5th layer serial port to obtain the two states of WIFI connection success and WIFI connection failure. The present invention requires sending two transfer function values as guidance for jumping for scanning WIFI and connecting WIFI. The transfer function value for scanning WIFI is sent to the 6th layer serial port first, and the transfer function value for connecting WIFI is sent to the 5th layer serial port secondly. After executing the WIFI scan to enter the WIFI connection mode, it is necessary to judge whether the WIFI connection is successful or failed. Regardless of whether the WIFI connection is successful or failed, it is necessary to respond to the instruction requirement, that is, according to step E, find the identification symbol adapted to the WIFI connection success or WIFI connection failure, and return the identification symbol of the WIFI connection success or WIFI connection failure to determine whether the WIFI connection function can be achieved.

[0067] If the identifier symbol is returned, it indicates that the state is connecting, which means that the functional area to be obtained for the instruction sent to the 5th layer is occupied by other instructions. If it needs to be obtained again to execute other instructions, it enters the multiplexing mode: when receiving the multiplexing instruction or detecting the signal that the instruction number is greater than 1, the occupied functional area is called.

[0068] Furthermore, the jump method of the present invention further includes the following specific steps:

[0069] Step S302: obtaining at least one functional area based on the plurality of transfer function value guidelines;

[0070] Step S303: sorting each functional area according to the instruction content or according to the guidance order of the multiple transfer function values to generate functions or combine functions.

[0071] In the above embodiment, for steps S302-S303, the construction of various software applications and APP applets is actually composed of various codes and functions. It can be seen from step E that the implementation of each function is composed of at least one functional area, and each functional area contains multiple functions. Based on the multiple transfer function value guidance, at least one functional area is obtained, and the business logic is combined according to step F. In fact, what is finally obtained is multiple functions of each serial port layer, and finally a function or a combined function is generated. For example, to realize the WIFI connection function, the WIFI connection function includes scanning WIFI and connecting WIFI. Therefore, after sending the instruction, the adapter is commanded to send multiple transfer function values as guidance to jump based on the instruction content, and multiple functional areas matching the instruction content are obtained: scanning WIFI functional area and connecting WIFI functional area, so as to determine whether the WIFI connection function can be realized. Send a command to check the WIFI connection, and according to the command content, instruct the adapter to send the transfer function value as a guide to jump to obtain the current status of the WIFI. When the reply is 1, it means idle, when the reply is 2, it means connecting, and when the reply is 3, it means connected.

[0072] In addition, reference Figure 2 Before receiving the instruction, the method further includes setting the instruction, the steps are as follows:

[0073] S304: Obtain and parse the serial port data of each layer to obtain the type and function of each serial port;

[0074] S305: Setting instructions according to the type and function of the serial port to generate multiple instruction subsets;

[0075] S306: Pairing the instruction subset with the transfer function value, and storing the paired transfer function value in a database;

[0076] S307: When receiving the instruction, instruct the adapter to send a switching function value as a guide to jump based on the instruction subset.

[0077] In the above embodiment, the instruction needs to be set before it is received so that each instruction can be adapted to the corresponding function to avoid returning an empty packet or no response. To address this problem, the present invention executes steps S304-S307 to obtain the type and function of each layer of serial port, and sets the type and function of each layer of serial port so that each functional area can adapt to an instruction. When an instruction is received, the functional area adapted to the instruction will be obtained, and then combined according to the functional logic and business logic to obtain a function or a combined function.

[0078] like Figure 3 As shown, when the instruction is received, the method further includes:

[0079] S308: Obtain and parse instructions to obtain at least one instruction subset;

[0080] S309: sorting the multiple instruction subsets according to the order in which the instruction subsets are obtained by parsing;

[0081] S310: Instructing the adapter to send at least one transfer function value as a guide for jumping based on the order of the instruction subset, and obtaining a functional area matching the instruction subset;

[0082] S311: When the last functional slice matching the instruction subset is obtained, all functional slices are aggregated according to the order in which they are obtained to form a function or a combined function for calling.

[0083] like Figure 4 As shown, the method includes:

[0084] S312: Analyze the instructions and determine the number of instruction subsets of the same type;

[0085] S313: If there are multiple instruction subsets of the same type, trigger the adapter to send at least one transfer function value as a guide to jump to obtain a combined function;

[0086] S314: If there is no instruction subset of the same type, instruct the adapter to send a transfer function value as a guide to jump to obtain the function.

[0087] In the above embodiment, for steps S308-S314, instructions are obtained and parsed to obtain at least one instruction subset. Multiple instruction subsets may include the same type and different types. For instruction subsets of the same type, it is indicated that the same functional area needs to be called multiple times. On this basis, if the functional area has been called, when the serial port receives the instruction subset of the same type, the multiplexing mode is triggered again. Based on the sorting method of the multiple instruction subsets, the adapter is commanded to send at least one transfer function value as a guide for jumping, and a functional area matching the instruction subset is obtained. The multiple functional areas are sorted according to the multiple instruction subsets or according to the business logic to form a function or a combined function. For example, a WIFI upgrade function is implemented. The WIFI upgrade function includes three small functions: WIFI scanning function area, WIFI connection function area, and WIFI file downloading function area. According to the function to be implemented, a command to obtain the WIFI upgrade function is sent. When the command is received, the command is parsed to obtain the WIFI scanning command subset, WIFI connection command subset, and WIFI file downloading command subset. The adapter sends three transfer function values based on these three command subsets. It is worth noting that the adapter of the present invention is commanded to give priority to sending the transfer function value adapted to the WIFI scanning command subset. After receiving the feedback, if the feedback signal indicates that the WIFI scan is successful, it is determined whether to send the WIFI connection command subset. If it is determined that it can be sent, the adapter is commanded to send the WIFI connection command subset. If a WIFI connection success signal is received, the communication link is now connected, and the adapter is commanded to send the WIFI file downloading command subset. If a WIFI file download success signal is received, it indicates that the WIFI upgrade function is implemented.

[0088] If a WIFI unconnected signal is received, determine whether the multiplexing mode is in progress. If the multiplexing mode is in progress, wait for a while until a WIFI connection success signal is received.

[0089] Similarly, if a WIFI file download failure signal is received, it is necessary to determine whether the multiplexing mode is in progress. Regardless of whether the above-mentioned WIFI connection function area or the WIFI file download function area is occupied by other instructions, when a subsequent request is received to obtain the WIFI connection function area or the WIFI file download function area again, the multiplexing mode will be entered to obtain the WIFI connection function area or the WIFI file download function area again to realize the WIFI upgrade function.

[0090] The present invention not only requires determining the content of the instruction but also instructs the adapter to send at least one transfer function value based on the functional logic or business logic of the instruction content. Furthermore, the transfer is performed in a functional logic sequence or business logic sequence, methodically executing each step to ultimately achieve the desired function. This invention addresses the issues of chaotic serial port instruction management, instruction multiplexing, function multiplexing, and logic and data processing in the development of single-chip microcomputers based on serial communication. It implements logical processing and multiplexing of different functional codes, thereby assisting developers in rapid development.

[0091] Example 2

[0092] like Figure 5 As shown, a multi-state jump device based on serial communication includes:

[0093] Sorting module 100, the sorting module 100 is used to sort the serial ports of each layer, and the functions of each layer can be reused according to the sorting method;

[0094] A setting module 200, the setting module 200 is used to set each layer of serial port to generate an adapter;

[0095] The processing module 300 is used to instruct the adapter to jump based on the content of the instruction when receiving the instruction, and obtain the function or combined function matching the content of the instruction for calling.

[0096] In the above embodiment, the serial port of the present invention is divided into six layers, including the pin configuration layer, the serial port transceiver processing layer, the instruction processing layer, the serial port data processing layer, the functional logic layer, and the business logic layer. The present invention prioritizes the pin configuration layer, deploys all parameters, and then deploys the serial port transceiver processing layer, and so on until the business logic layer is deployed. Regarding step S1, the sorting module 100 of the present invention sorts the serial ports from top to bottom as follows: business logic layer, functional logic layer, serial port data processing layer, instruction processing layer, serial port transceiver processing layer, and pin configuration layer. This sorting method allows the upper-level serial port to reuse the instructions and functions related to the lower-level serial port, thereby completing the call of the combined function. The present invention utilizes a setup module 200 to configure each serial port layer: the pin setup layer includes functions for serial port initialization, timer configuration, and other pin configurations; the serial port transceiver processing layer includes functions for serial port sending and receiving; the instruction processing layer includes functions related to instruction string processing; the serial port data processing layer includes functions for processing and encapsulating the specific meaning of each instruction's response to different data; the functional logic layer includes functions for combining small functional modules composed of different instructions; and the business logic layer includes functions for combining small functional modules to implement specific functions based on specific business logic. Furthermore, after the setup module 200 completes the internal configuration of each serial port layer, it also needs to configure each serial port layer to generate an adapter. When the processing module 300 receives an instruction, it commands the adapter to jump based on the instruction content, obtaining a function or combination of functions that matches the instruction content for invocation. The functions and combination of functions of the present invention are composed of various functions within each serial port layer. Commanding the adapter to jump results in a function or combination of functions composed of various functions.

[0097] In addition, the setting module 200 is also used to prioritize placing all instructions in the same container command and compiling them so as to uniformly initialize the instructions and uniformly manage the values of each state in a SATE container. The settings for each layer of serial port are as follows:

[0098] Step A: Write the functions of the first layer of pin configuration layer: Place the pin configuration related functions such as serial port initialization and timer initialization. After placing and verifying that the pin configuration can operate normally, you can write the second layer.

[0099] Step B, write the functions of the second layer serial port transceiver processing layer: set up the serial port sending and receiving, verify that the serial port can send and receive data normally and does not display garbled characters, and then write the third layer function.

[0100] Step C, write the function of the third layer instruction processing layer: write the function of splicing, truncating and other operations on the instruction string, including the necessary splicing and truncating of the instructions in the command and the incoming parameters to form the instructions to be sent that meet the requirements.

[0101] Step D, write the function of the fourth layer serial port data processing layer: write each command reply content processing function one by one and encapsulate the representative meaning of the specific reply. For example, send a command to check the WIFI connection. When the reply is 1, it means idle, when the reply is 2, it means connecting, and when the reply is 3, it means connected. At this time, you need to encapsulate the meaning of these 1, 2, and 3 and give them identifiers.

[0102] Step E: Write functions for the fifth functional logic layer: Encapsulate functional areas composed of different instructions. For example, to implement a Wi-Fi file download function, you first need to send a communication test instruction and a download instruction. The communication test instruction is used to determine the test Wi-Fi file download channel, and the download instruction is used to download the Wi-Fi file to the confirmed channel. Combining the sending and receiving of these two instructions according to the functional logic and business logic will implement the Wi-Fi file download function.

[0103] Step F: Write functions for the sixth business logic layer: Combine functional areas according to specific logic to implement functional logic. For example, to implement a Wi-Fi upgrade function, you need to have three small functions: Wi-Fi scanning function area, Wi-Fi connection function area, and Wi-Fi file download function area.

[0104] The present invention provides a multi-state jump device based on serial port communication. The present invention optimizes each layer of the serial port. After managing and processing a large number of instructions, it can flexibly jump, obtain multiple functional areas, and use functional logic and business logic to combine multiple functional areas to form functions or combined functions for calling, thereby realizing logical processing and multiplexing of different functional codes to assist developers in rapid development. In order to solve the problems of chaotic management of serial port sent instructions and chaotic instruction multiplexing, function multiplexing, logic and data processing, the implementation process of the multi-state jump device based on serial port communication of the present invention is consistent with that of Example 1, and Example 2 will not be repeated here.

[0105] Example 3

[0106] like Figure 6 As shown, a multi-state jump system based on serial communication includes:

[0107] The serial port sorting end sorts the serial ports at each layer, and the functions of each layer can be reused according to the sorting method.

[0108] The adapter generation end sets each layer of serial port to generate an adapter.

[0109] The jump calling end, when receiving an instruction, commands the adapter to jump based on the instruction content, and obtains a function or combined function matching the instruction content for calling.

[0110] In the above embodiment, the serial port of the present invention is divided into 6 layers, including the pin setting layer, the serial port transceiver processing layer, the instruction processing layer, the serial port data processing layer, the functional logic layer, and the business logic layer. The present invention prioritizes setting the pin setting layer, deploying all parameters, and then deploying the serial port transceiver processing layer, and so on, until the business logic layer is deployed. With respect to step S1, the serial port sorting terminal of the present invention sorts the serial ports from the top layer to the bottom layer as follows: business logic layer, functional logic layer, serial port data processing layer, instruction processing layer, serial port transceiver processing layer, and pin setting layer. This sorting method allows the upper-layer serial port to reuse the instructions and functions related to the lower-layer serial port, so as to complete the call of the combined function. The present invention utilizes an adapter generation end to configure each layer of serial ports: the pin configuration layer includes functions for serial port initialization, timers, and other pin configurations; the serial port transceiver processing layer includes functions for serial port sending and receiving; the instruction processing layer includes functions related to instruction string processing; the serial port data processing layer includes functions for processing and encapsulating the specific response meaning of each different instruction response; the functional logic layer includes functions for small functional modules composed of different instructions; and the business logic layer includes functions for combining small functional modules to implement specific functions based on specific business logic. Furthermore, after the adapter generation end completes the internal configuration of functions for each layer of serial ports, it also needs to configure each layer of serial ports in order to generate the adapter. When the jump call end receives an instruction, it commands the adapter to jump based on the instruction content, obtaining a function or combination of functions that matches the instruction content for invocation. The functions and combination of functions of the present invention are composed of various functions contained within each layer of serial ports. Commanding the adapter to jump results in a function or combination of functions composed of various functions.

[0111] In addition, the adapter generation end is also used to prioritize placing all instructions in the same container command and compiling them so that the instructions can be initialized uniformly and the values of each state can be managed uniformly in a SATE container. The settings for each layer of serial port are as follows:

[0112] Step A: Write the functions of the first layer of pin configuration layer: Place the pin configuration related functions such as serial port initialization and timer initialization. After placing and verifying that the pin configuration can operate normally, you can write the second layer.

[0113] Step B, write the functions of the second layer serial port transceiver processing layer: set up the serial port sending and receiving, verify that the serial port can send and receive data normally and does not display garbled characters, and then write the third layer function.

[0114] Step C, write the function of the third layer instruction processing layer: write the function of splicing, truncating and other operations on the instruction string, including the necessary splicing and truncating of the instructions in the command and the incoming parameters to form the instructions to be sent that meet the requirements.

[0115] Step D, write the function of the fourth layer serial port data processing layer: write each command reply content processing function one by one and encapsulate the representative meaning of the specific reply. For example, send a command to check the WIFI connection. When the reply is 1, it means idle, when the reply is 2, it means connecting, and when the reply is 3, it means connected. At this time, you need to encapsulate the meaning of these 1, 2, and 3 and give them identifiers.

[0116] Step E: Write functions for the fifth functional logic layer: Encapsulate functional areas composed of different instructions. For example, to implement a Wi-Fi file download function, you first need to send a communication test instruction and a download instruction. The communication test instruction is used to determine the test Wi-Fi file download channel, and the download instruction is used to download the Wi-Fi file to the confirmed channel. Combining the sending and receiving of these two instructions according to the functional logic and business logic will implement the Wi-Fi file download function.

[0117] Step F: Write functions for the sixth business logic layer: Combine functional areas according to specific logic to implement functional logic. For example, to implement a Wi-Fi upgrade function, you need to have three small functions: Wi-Fi scanning function area, Wi-Fi connection function area, and Wi-Fi file download function area.

[0118] A computer program product includes a computer program or instructions, which, when executed by a processor, implements the steps of any one of the above-mentioned multi-state jump methods based on serial port communication.

[0119] like Figure 7 As shown, the present invention also provides a computer device, which can be a server, and its internal structure can be as follows Figure 7As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the computer design is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store all data required for the process of a multi-state jump method based on serial communication. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a multi-state jump method based on serial communication is implemented.

[0120] Those skilled in the art will understand that Figure 7 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present invention and does not constitute a limitation on the computer device to which the solution of the present invention is applied.

[0121] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, any of the above-mentioned multi-state jump methods based on serial port communication is implemented.

[0122] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided by the present invention and used in the embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate DDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0123] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, apparatus, article, or method comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, apparatus, article, or method. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, apparatus, article, or method comprising the element.

[0124] The above description is only a preferred embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A multi-state jump method based on serial communication, characterized in that: include: Sort the serial ports on each layer, and the functions on each layer can be reused according to the sorting method; Set up each layer of serial port to generate adapters; When an instruction is received, the adapter is commanded to jump based on the instruction content, and a function or combined function matching the instruction content is obtained for calling.

2. A multi-state jump method based on serial communication according to claim 1, characterized in that: The jump method specifically includes: Instructing the adapter to send at least one transfer function value as a guide to jump based on the instruction content; And / or, the jump method further includes the following specific steps: Based on the plurality of transfer function value guidelines, obtaining at least one functional area; Each functional area is sorted according to the instruction content or according to the guidance order of multiple transfer function values to generate functions or combine functions.

3. The multi-state jump method based on serial communication according to claim 1, characterized in that: Before receiving the instruction, the method further includes setting the instruction, the steps of: Get the serial port data of each layer and parse it to get the type and function of each serial port; Set instructions based on the type and function of the serial port and generate multiple instruction subsets; Pairing the instruction subset with the transfer function value, and storing the paired transfer function value in a database; When receiving the instruction, the switch is instructed to send a switch function value as a guide to jump based on the instruction subset.

4. A multi-state jump method based on serial communication according to claim 3, characterized in that: When the instruction is received, the method further includes: Obtaining instructions and parsing them to obtain at least a subset of instructions; sorting the multiple instruction subsets according to the order in which the instruction subsets are obtained by parsing; Instructing the adapter to send at least one transfer function value as a guide to jump based on the order of the instruction subset, and obtaining a functional area matching the instruction subset; When the last functional slice matching the instruction subset is obtained, all functional slices are aggregated according to the order in which they are obtained to form a function or a combined function for calling.

5. A multi-state jump method based on serial communication according to any one of claims 1 to 4, characterized in that: The method comprises: Analyze the instructions and determine the number of instruction subsets of the same type; If there are multiple instruction subsets of the same type, trigger the adapter to send at least one transfer function value as a guide to jump to obtain a combined function; If there is no instruction subset of the same type, the adapter is instructed to send the transfer function value as a guide to jump to obtain the function.

6. A multi-state jump device based on serial communication, characterized in that: include: Sorting module, which is used to sort the serial ports at each layer, and the functions of each layer can be reused according to the sorting method; A setting module, the setting module is used to set each layer of serial port to generate an adapter; The processing module is used to instruct the adapter to jump based on the content of the instruction when receiving the instruction, and obtain the function or combined function matching the content of the instruction for calling.

7. A multi-state jump system based on serial communication, characterized in that: include: The serial port sorting end sorts the serial ports at each layer, and the functions of each layer can be reused according to the sorting method; The adapter generation end sets each layer of serial port to generate an adapter; The jump calling end, when receiving an instruction, commands the adapter to jump based on the instruction content, and obtains a function or combined function matching the instruction content for calling.

8. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the multi-state jump method based on serial port communication described in any one of claims 1 to 5 are implemented.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the multi-state jump method based on serial port communication described in any one of claims 1 to 5 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the multi-state jump method based on serial port communication described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Communication method and device and multi-module communication system

    CN111585697A

  • Universal bus type serial port communication method, system and equipment and storage medium

    CN116170249A

  • Virtual serial port and protocol for use in serial-over-LAN communication

    US20060168099A1

  • Power-Saving Device for Universal Serial Bus Modem Apparatus and Method Thereof

    US20120151239A1