Rapid decoding method suitable for multi-component serial port data
By using Matlab software to decode aircraft serial port data, the problem of low decoding efficiency when dealing with large amounts of data in complex aircraft was solved, enabling fast and convenient data analysis.
Patent Information
- Application Number
- CN202511314850.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-15
- Publication Date
- 2025-12-30
AI Technical Summary
In complex aircraft, when serial communication is used, the amount of data is large and the number of serial data channels recorded by the recorder is large, resulting in a large workload for data analysis during joint testing, hardware-in-the-loop simulation and field testing, and the decoding efficiency of existing technologies is low.
The fopen function in Matlab software is used to convert serial port data into decimal values, and the valid data is extracted through a pre-configured decoding protocol. The data is then decoded and saved according to the communication protocol, and output in text or Excel file format is supported.
It enables rapid decoding of serial port data from multiple components, simplifies the data analysis process, improves data analysis efficiency, and allows decoded data to be saved as text or Excel files for easy analysis.
Smart Images

Figure CN121239764A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of communication technology, specifically relating to a fast decoding method for serial port data of multiple components. Background Technology
[0002] For complex aircraft that use serial communication, when the number of serial data channels recorded by the recorder is large and the amount of data is large, the lack of fast decoding software will bring a huge workload to the data analysis during joint testing, hardware-in-the-loop simulation and field testing. Summary of the Invention
[0003] To overcome the shortcomings of existing technologies, this invention provides a fast decoding method for serial port data from multiple components. This method can be used for rapid data analysis during joint testing, hardware-in-the-loop simulation, and field tests of complex aircraft employing serial communication, thereby improving data analysis efficiency. This decoding method is characterized by its simplicity, speed, and ease of analysis. Its key design features include: setting the serial port data decoding protocol (only required when using the software for the first time or when the communication protocol changes); setting the path to the serial port file to be decoded; setting parameters such as the data format to be saved; and sequentially reading, decoding, and saving the decoded data from the serial port file to be decoded. This decoding method is characterized by its simplicity, speed, and ease of analysis.
[0004] The technical solution adopted by this invention to solve its technical problem is as follows:
[0005] Step 1: Configure the serial port data decoding protocol when the communication protocol changes;
[0006] The decoding protocol configuration file is in Excel format. The settings include serial port data frame header, data content, number of bytes, scale, data type and output data type.
[0007] The configured decoding protocol is converted into the .mat format required for decoding using a Matlab program;
[0008] Step 2: Set the path to the serial port file to be decoded;
[0009] Step 3: Set the data format to be saved;
[0010] The output data type can be selected as text file format or Excel file format. The output data can be selected to include the recorder's timestamp and to output an information header, i.e., a data frame header. It can also be selected to parse all serial port data or parse a portion of the serial port data.
[0011] Step 4: Read the file that needs to be decoded and decode it;
[0012] First, the raw data of serial port named UART1 is read using the fopen function. pathMB is the path to the serial port file to be decoded, UART1.dat is the name of the serial port file to be decoded, and data0 automatically converts each byte of data in the serial port data into a decimal value with a scale of 1. Then, the valid data is extracted by reading the decoding protocol, and finally, the data is decoded and saved according to the communication protocol.
[0013] Step 5: Save the decoded data;
[0014] Depending on the different needs of data analysis, the decoded data will be output as a text file or an Excel file.
[0015] An electronic device includes: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to enable the electronic device to perform the above-described fast decoding method.
[0016] A computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the above-described fast decoding method.
[0017] A chip includes a processor for retrieving and running a computer program from a memory, causing a device on which the chip is installed to perform the aforementioned fast decoding method.
[0018] A computer program product includes a computer storage medium storing a computer program, the computer program including instructions executable by at least one processor, which, when executed by the at least one processor, implement the above-described fast decoding method.
[0019] The beneficial effects of this invention are as follows:
[0020] This invention enables rapid decoding of serial port data from multiple components. Taking a test as an example, the data sent from the launcher to the recorder consisted of 9 packets of serial port data. The decoding results are shown in [the image / document / etc.]. Figures 10-11 As can be seen, the decoded 9 packets of serial port data can be stored as 9 separate text files or 9 separate Excel files, and the time taken by the decoding software to parse all the data can be calculated. This decoding method is characterized by its simplicity, speed, and ease of analysis. Attached Figure Description
[0021] Figure 1 Workflow diagram of a fast decoding method for multi-component serial port data;
[0022] Figure 2 A schematic diagram illustrating the configuration of the communication protocol (UART1) from a certain component to the onboard computer;
[0023] Figure 3 A schematic diagram of the communication protocol used for decoding all components on the missile;
[0024] Figure 4 The path diagram shows the path to the serial port file to be decoded;
[0025] Figure 5 A diagram illustrating the parameters for setting the data format to be saved;
[0026] Figure 6 A schematic diagram illustrating the code for reading raw data from the UART1 serial port;
[0027] Figure 7 Flowchart for reading the decoding protocol of serial port UART1 and extracting valid data;
[0028] Figure 8 A schematic diagram illustrating the decoding and saving of UART1 serial port according to the communication protocol;
[0029] Figure 9 A code diagram illustrating the process of saving data in different formats;
[0030] Figure 10 This is a schematic diagram showing the output effect after decoding the serial port data of all components.
[0031] Figure 11 This is a schematic diagram showing the total time taken for decoding data from all nine serial ports of all components. (a) The output file format is a text file, and (b) The output file format is an Excel file. Detailed Implementation
[0032] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0033] The core of this invention's fast multi-component serial port data decoding method is to utilize the `fopen` function in Matlab software to quickly convert each byte of the raw data from each serial port into a decimal value with a scale of 1. Then, it extracts valid data according to the serial port content by reading a pre-configured decoding protocol, and finally decodes and saves the data according to the communication protocol. Key design features of this method include: setting the serial port data decoding protocol (only required when using the software for the first time or when the communication protocol changes); setting the path to the serial port file to be decoded; setting parameters such as the data format to be saved; and sequentially reading, decoding, and saving the decoded data from the serial port file to be decoded. The design flowchart is shown below. Figure 1 .
[0034] like Figure 1 This invention proposes a fast decoding method for serial port data from multiple components, solving the problem of low efficiency in manual decoding when dealing with large amounts of data from aircraft using serial communication. It provides a method for fast decoding of data from aircraft using serial communication.
[0035] The present invention will be described using data from a particular test as an example.
[0036] 1. Serial port data decoding protocol settings (only required when the communication protocol changes);
[0037] The decoding protocol configuration file is in Excel format. It requires settings for the serial port data frame header, data content, number of bytes, scale, data type, and output data type. The configured decoding protocol is then converted into the required .mat format using a Matlab program. Figures 2 to 3 As shown.
[0038] 2. Set the path to the serial port file to be decoded; for example... Figure 4 As shown.
[0039] 3. Set parameters such as the data format to be saved;
[0040] See the settings for data format and other parameters to be saved. Figure 5 The output data type can be either a text file or an Excel file. The output data can be selected to include a recorder time stamp and to include an information header (i.e., a data frame header). Additionally, it can be selected to parse all serial port data or parse only a portion of the serial port data.
[0041] 4. Read the file that needs to be decoded and decode it;
[0042] like Figure 6 First, the fopen function is used to read the raw data from the serial port named UART1, where pathMB is... Figure 4 The path to the serial port file to be decoded is set in the configuration file. UART1.dat is the name of the serial port file to be decoded. data0 is used to automatically convert each byte of data in the serial port data into a decimal value with a scale of 1, then extract the valid data by reading the decoding protocol, and finally decode and save it according to the communication protocol. See the detailed process below. Figures 7-8 .
[0043] 5. Save the decoded data;
[0044] Depending on the specific needs of the data analysis, the decoded data can be output as a text file or an Excel file. For example... Figure 9 As shown.
Claims
1. A fast decoding method for serial port data applicable to multiple components, characterized in that, The method comprises the following steps: Step 1: setting a serial port data decoding protocol when a communication protocol is changed; The setting file of the decoding protocol adopts an Excel file format, and the contents to be set include a serial port data frame header, data content, byte number, scale, data type and output data type; The set decoding protocol is converted into a.mat format required for decoding by a Matlab program; Step 2: setting a path of a serial port file to be decoded; Step 3: setting a data format to be saved; The output data type can be selected as a text file format or an Excel file format, the output data can be selected as whether to be provided with a recorder time mark and whether to be provided with an information header, that is, a data frame header; all serial port data or part of the serial port data can be selected to be parsed; Step 4: reading a file to be decoded and decoding; Firstly, the serial port name UART1 original data is read by a fopen function, pathMB is the set path of the serial port file to be decoded, UART1.dat is the serial port file name to be decoded, data0 is automatically converted into a decimal value with a scale of 1 for each byte of the serial port data, then valid data is extracted by reading the decoding protocol, and finally the data is decoded and saved according to the communication protocol; Step 5: saving the decoded data; According to different requirements of the analysis data, the decoded data is output as a text file format or an Excel file format.
2. An electronic device, comprising: It comprises: a processor and a memory; the memory is used for storing a computer program, and the processor is used for executing the computer program stored in the memory, so that the electronic device executes the method as claimed in claim 1.
3. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the method as claimed in claim 1.
4. A chip, characterized by It comprises: a processor, which is used for calling and running a computer program from a memory, so that a device installed with the chip executes the method as claimed in claim 1.
5. A computer program product, characterised in that, The computer program product comprises a computer storage medium, the computer storage medium stores a computer program, the computer program comprises instructions executable by at least one processor, and the instructions are executed by the at least one processor to implement the method as claimed in claim 1.
Citation Information
Patent Citations
Intelligent cell phone sensor data online collecting and real-time processing method
CN104615528A
Universal data decoding method based on RS422 / 485 serial port communication
CN105893314A
Method and device for automatically generating DBC file
CN113568876A
Method, device and equipment for decoding real-time data by using upper computer
CN114327237A
Method and system for realizing automatic analysis of message data based on configuration model
CN117336393A
Cited By
Universal serial communication framing and de-framing method for external parameter configuration of inertial sensor
CN121567803A