Single-serial-port multi-software sharing system and method
By creating a virtual serial port pair, multiple programs allow access to a physical serial port at the same time, solving the problem of serial port resource exclusivity, improving the flexibility and stability of the system, and optimizing error handling and logging.
Patent Information
- Application Number
- CN202411939903.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-05-27
AI Technical Summary
In the prior art, physical serial ports can usually only be used exclusively by one program, which limits the ability of multiple programs to access the same serial port at the same time, resulting in competition problems for serial port resources, lack of flexibility and scalability, and insufficient error handling and logging.
By creating a virtual serial port pair, multi-program access to a single physical serial port is achieved. Using the serial port forwarding module and the virtual serial port module, multiple software can access a single physical serial port simultaneously through a shared virtual serial port, and optimize the error handling and logging mechanism.
It breaks the limitation that a physical serial port can only be occupied by one program in traditional serial port communication, improves the utilization rate of serial port resources, enhances the flexibility and response capabilities of the system, optimizes error handling and logging, and improves the stability and maintainability of the system.
Smart Images

Figure CN120045499A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a single serial port multi-software sharing system and method, belonging to the technical field of serial port communication. Background Art
[0002] In today's society, the rapid development of information technology has brought unprecedented opportunities and challenges to all walks of life. In this digital age, serial port technology, as a traditional data communication method, still plays an important role in many fields. At the same time, virtual serial port tools, as a new technology, have brought new possibilities and conveniences to serial port communication.
[0003] Serial port communication, as one of the earliest communication protocols used for data transmission, realizes data exchange between devices by transmitting data bit by bit. It is widely applied in many fields such as computer communication, industrial automation, communication equipment, and embedded systems.
[0004] Virtual serial port tools are a software technology that, by simulating the functions of physical serial ports, enables the establishment of virtual serial port connections within a computer or over a network. This technology allows application programs to communicate with hardware devices through virtual serial ports and also supports data transmission between virtual serial ports, greatly expanding the application scope of serial port communication. Virtual serial port tools are not limited by the number of physical serial ports, can simulate multiple serial ports on the same computer, and can achieve serial port communication between remote devices through network connections, greatly improving the flexibility and scalability of communication.
[0005] The access to physical serial ports in the prior art mainly relies on hardware interfaces such as RS-232 and RS-422. These interfaces define the electrical and mechanical connections between transmitters and receivers, including voltage, current, data lines, etc. Physical serial ports usually use 9-pin or 25-pin D-type connectors to achieve point-to-point communication.
[0006] The prior art mainly focuses on the direct communication of physical serial ports, but they do not support multiple software programs to access the same physical serial port. This limits the flexibility and efficiency of the system.
[0007] In the prior art, a physical serial port can usually only be bound and accessed by one program, which limits the ability of multiple programs to access the same serial port simultaneously. Serial port communication in the prior art usually relies on underlying driver programs to handle error detection and response, and the logging function is not perfect enough to support complex error analysis and system maintenance.
[0008] In the existing serial communication scenario, multiple software programs need to access the same serial port of a device simultaneously. However, each physical serial port can only be called by one software program at a time, which leads to the problem of serial port resource contention and restricts the use of software. To solve this problem, a method is needed that allows multiple software programs to access a single physical serial port simultaneously through shared virtual serial ports.
[0009] Defects or deficiencies of the prior art include:
[0010] 1. Exclusive nature of serial port resources: Physical serial ports are usually exclusively used by one program, which limits the ability of multiple programs to access the same serial port simultaneously and results in low resource utilization.
[0011] 2. Lack of flexibility and scalability: Although virtual serial port technology provides a certain degree of flexibility, in the prior art, the creation and management of virtual serial ports may not be flexible enough to meet the changing development and testing requirements.
[0012] 3. Insufficient error handling and logging: There is no sufficient tool and framework to support complex error logging and analysis, which limits the ability of problem diagnosis and system maintenance. Summary of the Invention
[0013] The technical problem to be solved by the present invention is: To overcome the deficiencies of the prior art and provide a single serial port multi-software sharing system and method.
[0014] The technical solution of the present invention is:
[0015] The present invention discloses a single serial port multi-software sharing system, including: a physical serial port, a serial port forwarding module, a virtual serial port module, and a serial port and debugging module; wherein,
[0016] The serial port forwarding module is connected to the physical serial port, reads the data of the physical serial port, and forwards it to the virtual serial port. At the same time, it forwards the data received from the virtual serial port module to the physical serial port;
[0017] The virtual serial port module creates multiple virtual serial ports, the virtual serial ports are connected in pairs, and the virtual serial ports are connected to the serial port forwarding module and the debugging module;
[0018] The debugging module receives and sends data from the virtual serial port.
[0019] Further, in the above system, the serial port forwarding module includes:
[0020] The data receiving sub-module receives data from the physical serial port or the virtual serial port, and performs parsing and error checking; it sends the serial port data after removing the error data to the data processing sub-module;
[0021] A data processing sub-module that converts and formats the serial port data sent by the data receiving sub-module to obtain processed data, and sends the processed data to the corresponding data sending sub-module.
[0022] A data sending sub-module that sends the processed data to a virtual serial port or sends the data from a virtual serial port to a physical serial port.
[0023] A configuration and management sub-module that sets serial port parameters according to the user's configuration instructions. The serial port parameters include baud rate, data bits, and stop bits, and is used to record logs.
[0024] Further, in the above system, the virtual serial port module includes:
[0025] A virtual serial port creation sub-module that creates multiple pairs of virtual serial ports in the operating system and sends the configuration information of each virtual serial port to the virtual serial port management sub-module.
[0026] A virtual serial port management sub-module that receives the configuration information from the virtual serial port creation sub-module and manages the connection with the data communication sub-module, and manages the status and configuration of all pairs of virtual serial ports.
[0027] A data communication sub-module that receives data from the debugging module and forwards it to the serial port forwarding module, and at the same time receives data from the serial port forwarding module and forwards it to the debugging module.
[0028] Further, in the above system, the debugging module includes:
[0029] A serial port debugging assistant sub-module that provides a user interface that enables the user to send specific data commands to a virtual serial port and receive and display data from the virtual serial port.
[0030] A data parsing sub-module that receives data from the virtual serial port module and performs protocol parsing, or sends data to the virtual serial port module.
[0031] The present invention discloses a method for sharing a single serial port among multiple software, including:
[0032] Generating multiple virtual serial ports in the operating system;
[0033] Setting serial port parameters, where the serial port parameters include baud rate, data bits, and stop bits;
[0034] Configuring serial port forwarding parameters, including selecting a physical serial port and setting data transmission parameters;
[0035] Establishing a connection between the physical serial port and the virtual serial port, and a paired connection between virtual serial ports according to the serial port forwarding parameters and the serial port parameters;
[0036] Receive data from a physical serial port or a virtual serial port, parse and perform error checking, and eliminate error data to obtain serial port data;
[0037] Convert and format the serial port data to obtain processed data;
[0038] Send the processed data to a virtual serial port or send data from a virtual serial port to a physical serial port.
[0039] The beneficial effects of the present invention compared with the prior art are as follows:
[0040] (1) By creating a pair of virtual serial ports, the present invention realizes multi-program access to a single physical serial port. The application of this technology breaks the limitation that a physical serial port can only be occupied by one program in traditional serial port communication, and improves the utilization rate of serial port resources.
[0041] (2) The present invention forwards the messages received from the physical serial port to multiple virtual serial ports, and at the same time forwards the data in the virtual serial ports to the physical serial port. This mechanism ensures that multiple programs can simultaneously receive and send data from the physical serial port, enhancing the flexibility and response ability of the system.
[0042] (3) The application developed using the Qt framework in the present invention makes the implementation of serial port communication more efficient and stable. The Qt framework provides rich serial port communication interfaces and time processing mechanisms, enabling the program to better manage serial port resources and improve the reliability of communication.
[0043] (4) Through virtual serial port technology, the present invention optimizes the allocation problem of serial port resources. In traditional serial port communication, resource allocation is a bottleneck because a physical serial port can only serve one program. The present invention realizes dynamic allocation of resources by creating a pair of virtual serial ports and solves this problem.
[0044] (5) For test devices in some special fields, FPGA-customized serial ports are used, and such serial ports cannot be accessed by a serial port debugging assistant or general serial port software. By calling the API of the customized serial port in the present invention, the FPGA serial port messages can be forwarded to a virtual serial port, enabling the serial port debugging assistant and other software to directly read the data of the serial port (COM), greatly improving the accessibility and compatibility of serial port resources.
[0045] (6) The present invention creates virtual serial port pairs, allowing multiple programs to access a physical serial port simultaneously, thus solving the problem of the exclusivity of serial port resources in the prior art. At the same time, the present invention improves the stability and maintainability of the system by optimizing the error handling and logging mechanisms. In addition, through the concurrency mechanism and synchronization control, the present invention ensures the stability of data sending and receiving by multiple programs, improves the resource allocation efficiency, solves the defects in the prior art, and enhances the flexibility of serial port communication.
[0046] (7) The present invention allows multiple programs to share the same physical serial port resource through virtual serial port technology. The application of this technology breaks the limitation that a physical serial port can only be occupied by one program in traditional serial port communication, and improves the utilization rate of serial port resources. Compared with the prior art, this method effectively solves the resource contention problem because it allows multiple programs to "own" the access right to the same physical serial port simultaneously without actual physical connections. For resource allocation, the sending and receiving of each virtual serial port pair are processed by independent threads, and the semaphore in Qt is used to dynamically sort the priorities of concurrent data to avoid resource sending conflicts.
[0047] (8) The present invention not only supports standard physical serial ports but also can adapt to FPGA-customized serial ports. This flexibility enables the system to adapt to more application scenarios and hardware devices. Through virtual serial port technology, the system can be easily extended to support more serial port devices without additional hardware resources.
[0048] (9) Through concurrency control, error handling, and the logging module, the present invention enhances the reliability and maintainability of the system. The system can detect errors in serial port communication and record the logs of all key operations, facilitating problem tracking and system maintenance. Description of the Drawings
[0049] Figure 1 is the connection relationship diagram of the present invention;
[0050] Figure 2 is the functional division diagram of the embodiment of the present invention;
[0051] Figure 3 is the working flow chart of the serial port sharing system of the present invention. Detailed Embodiment
[0052] The following further elaborates on the present invention patent in detail in conjunction with the drawings and specific embodiments.
[0053] As Figure 1 shown, the present invention discloses a single serial port multi-software sharing system, including: a physical serial port, a serial port forwarding module, a virtual serial port module, and a serial port and debugging module; wherein,
[0054] The serial port forwarding module is connected to the physical serial port, reads the data of the physical serial port, and forwards it to the virtual serial port. At the same time, it forwards the data received from the virtual serial port module to the physical serial port;
[0055] The virtual serial port module creates multiple virtual serial ports. The virtual serial ports are connected in pairs and connect the virtual serial ports to the serial port forwarding module and the debugging module;
[0056] The debugging module receives and sends data from the virtual serial port.
[0057] Preferably, the serial port forwarding module includes:
[0058] The data receiving sub-module receives data from the physical serial port or the virtual serial port, and performs parsing and error checking; it sends the serial port data after removing the error data to the data processing sub-module;
[0059] The data processing sub-module converts and formats the serial port data sent by the data receiving sub-module to obtain the processed data; it sends the processed data to the corresponding data sending sub-module;
[0060] The data sending sub-module sends the processed data to the virtual serial port or sends the data from the virtual serial port to the physical serial port;
[0061] The configuration and management sub-module sets the serial port parameters according to the user's configuration instructions. The serial port parameters include baud rate, data bits, and stop bits; it is used to record logs.
[0062] Preferably, the virtual serial port module includes:
[0063] The virtual serial port creation sub-module creates multiple pairs of virtual serial ports in the operating system; it sends the configuration information of each virtual serial port to the virtual serial port management sub-module;
[0064] The virtual serial port management sub-module receives the configuration information from the virtual serial port creation sub-module and manages the connection with the data communication sub-module; it manages the status and configuration of all virtual serial port pairs;
[0065] The data communication sub-module receives the data from the debugging module and forwards it to the serial port forwarding module. At the same time, it receives the data from the serial port forwarding module and forwards it to the debugging module.
[0066] Preferably, the debugging module includes:
[0067] The serial port debugging assistant sub-module provides a user interface that enables the user to send specific data commands to the virtual serial port and receive and display the data from the virtual serial port;
[0068] A data parsing sub-module that receives data from the virtual serial port module and performs protocol parsing, or sends data to the virtual serial port module.
[0069] The present invention discloses a method for sharing a single serial port among multiple software, including:
[0070] Generating multiple virtual serial ports in the operating system;
[0071] Setting serial port parameters, which include baud rate, data bits, and stop bits;
[0072] Configuring serial port forwarding parameters, including selecting a physical serial port and setting data transmission parameters;
[0073] Establishing a connection between the physical serial port and the virtual serial port, and pairwise connections between virtual serial ports according to the serial port forwarding parameters and serial port parameters;
[0074] Receiving data from the physical serial port or virtual serial port, performing parsing and error checking, and removing error data to obtain serial port data;
[0075] Converting and formatting the serial port data to obtain processed data;
[0076] Sending the processed data to the virtual serial port or sending data from the virtual serial port to the physical serial port.
[0077] Embodiment 1
[0078] This embodiment discloses a single serial port multi-software sharing system, including: a serial port forwarding module, a virtual serial port module, a serial port, and a debugging module; wherein, the function of the serial port forwarding module: responsible for occupying the actual physical serial port and monitoring the data received from the physical serial port. Its main task is to read the data of the physical serial port and forward it to the virtual serial port, and at the same time forward the data received from the virtual serial port to the physical serial port for sending. The function of the virtual serial port module is to create multiple virtual serial ports, and these virtual serial ports are pairwise connected. Half of the virtual serial ports are occupied by the serial port forwarding module, and the other half are occupied by the debugging module. The debugging module is software to help developers or users monitor and debug, which can display the details of data transmission, help identify and solve problems, and the debugging module receives and sends data from the virtual serial port.
[0079] The said serial port forwarding module includes:
[0080] (1) A data receiving sub-module
[0081] Function: Responsible for receiving data from the physical serial port or virtual serial port and performing necessary parsing and error checking;
[0082] Information transfer: Receiving data from the physical or virtual serial port and transferring it to the data processing sub-module;
[0083] (2) Data processing sub-module
[0084] Function: Process the data received by the data receiving sub-module, and perform necessary conversions and formatting;
[0085] Information transfer: Receive data from the data receiving sub-module, process these data, and then transfer the processed data to the corresponding data sending sub-modules (physical serial port and virtual serial port);
[0086] (3) Data sending sub-module
[0087] Function: Now it is divided into two parts. One part is responsible for sending the processed data to the virtual serial port, and the other part is responsible for sending the data from the virtual serial port to the physical serial port;
[0088] Information transfer: Receive data from the data processing module, and send it to the virtual serial port module, receive data from the virtual serial port module, and send it to the physical serial port after processing;
[0089] (4) Configuration and management sub-module
[0090] Function: Allow users to configure the settings of the serial port forwarding module, such as baud rate, data bits, stop bits, etc. At the same time, it includes a logging function;
[0091] Information transfer: Receive the configuration instructions from the user, and adjust the behavior of other sub-modules according to these instructions.
[0092] The virtual serial port module includes:
[0093] (5) Virtual serial port creation sub-module
[0094] Function: Responsible for creating multiple virtual serial ports in the operating system. These virtual serial ports are equivalent to real physical serial ports for other software;
[0095] Information transfer: Create virtual serial ports, and transfer their configuration information to the virtual serial port management sub-module;
[0096] (6) Virtual serial port management sub-module
[0097] Function: Manage the status and configuration of all virtual serial ports, including opening, closing, configuring the baud rate, etc.;
[0098] Information transfer: Receive the configuration information from the virtual serial port creation sub-module, and manage the connection with the data communication sub-module;
[0099] (7) Data communication sub-module
[0100] Function: Process data communication with the software connected to the virtual serial port;
[0101] Information transfer: Receive data from the debugging module and forward it to the serial port forwarding module. At the same time, also receive data from the serial port forwarding module and forward it to the debugging module;
[0102] The debugging module includes:
[0103] (8) Serial port debugging assistant sub-module
[0104] Function: Provide a user interface that enables users to send specific data commands to the virtual serial port and receive and display data from the virtual serial port;
[0105] Information transfer: Receive data from the virtual serial port module or send data to the virtual serial port module;
[0106] (9) Data parsing sub-module
[0107] Function: Parse the data received from the virtual serial port and the data to be sent to the virtual serial port, including interface display and protocol parsing;
[0108] Information transfer: Receive data from the virtual serial port module or send data to the virtual serial port module;
[0109] The present invention discloses a method for sharing a single serial port among multiple software, including the following steps:
[0110] Create virtual serial ports, and use the virtual serial port creation sub-module to generate multiple pairs of virtual serial ports in the operating system;
[0111] Configure the serial port forwarding module, and set the serial port forwarding module through the configuration and management sub-module, including selecting the physical serial port and setting data transmission parameters (such as baud rate, data bits, etc.);
[0112] Occupy the physical serial port through the data forwarding module and establish a connection between the physical serial port and multiple virtual serial ports;
[0113] The debugging module and related software are connected to the virtual serial port, and can form a connection with a single physical serial port for communication;
[0114] The serial port debugging module monitors and receives the original data, and the data parsing module parses it according to the protocol.
[0115] For the data forwarding module, the user selects serial port parameters such as the physical serial port number, baud rate, and parity bit in the interface. After occupying the physical serial port, this module connects to one end of a pre-set virtual serial port pair, and at the same time configures parameters such as the same baud rate and parity bit as the occupied physical serial port for the virtual serial port. The data forwarding module is developed using Qt. In Qt, the signal-slot mechanism is used. When data is received by the physical serial port or the virtual serial port, the slot function is triggered to read all the buffered data in the serial port and send the data from the other end, thus completing the data forwarding.
[0116] In one embodiment, a method for sharing a single serial port among multiple software includes the following steps:
[0117] (1) Use the virtual serial port module to create multiple groups of virtual serial port pairs. After the virtual serial port pairs are successfully created, they will be continuously saved in the operating system and do not need to be re-created after the system restarts.
[0118] (2) Use the serial port forwarding module to configure the serial port. This software is developed using Qt and mainly uses the QSerialPort class. After setting parameters such as the baud rate, data bits, and stop bits of the serial port through the software interface, the physical serial port and the virtual serial port are opened.
[0119] (3) Use the serial port forwarding software to associate the physical serial port and the virtual serial port, and use the signal-slot mechanism of Qt to forward data. When new data is detected by the physical serial port or the virtual serial port, the readyRead() signal is released. When the slot function receives the signal, it reads all the data in the buffer of the physical serial port / virtual serial port and writes it to the corresponding virtual serial port / physical serial port.
[0120] (4) Open the application software and the serial port debugging software. The serial port used needs to correspond to the serial port forwarding software. At this time, multiple application software can simultaneously perform two-way communication with a single physical serial port.
[0121] Embodiment 2
[0122] As Figure 2 shown, this embodiment provides a single serial port multi-software sharing system, including:
[0123] The physical serial port management module is responsible for direct interaction with the physical serial port; managing operations such as opening, closing, and setting of the physical serial port.
[0124] The specific steps for managing the opening, closing, and setting of the physical serial port are as follows:
[0125] S11. Initialize the physical serial port: Set the parameters of the physical serial port, such as the baud rate, data bits, stop bits, etc.;
[0126] S12. Open the physical serial port: Establish a connection with the physical serial port;
[0127] S13. Monitor the physical serial port: Continuously monitor the data reception status of the physical serial port;
[0128] S14. Read data: Read the data sent by the external device from the physical serial port;
[0129] S15. Write data: Write the data to be sent to the physical serial port;
[0130] S16. Close the physical serial port: Close the physical serial port connection when it is not needed;
[0131] The virtual serial port management module is used to create and manage virtual serial port pairs; provide read and write interfaces of the virtual serial port to the upper-layer application.
[0132] The read and write interfaces of the virtual serial port to the upper-layer application are as follows:
[0133] S21. Create virtual serial port pairs: Create a certain number of virtual input serial ports and virtual output serial ports as needed;
[0134] S22. Configure the virtual serial port: Set the parameters of the virtual serial port to simulate the behavior of the physical serial port;
[0135] S23. Bind the program to the virtual serial port: Allow the program to be bound to a specific virtual serial port pair;
[0136] S24. Data forwarding: Forward the data received from the physical serial port to all bound virtual input serial ports;
[0137] S25. Data aggregation: Aggregate the data from all virtual output serial ports and prepare to send it to the physical serial port.
[0138] The data forwarding module is responsible for forwarding data between the physical serial port and the virtual serial port; ensure the consistency and integrity of the data.
[0139] Step description:
[0140] 1. Receive data forwarding: Forward the data received from the physical serial port to all virtual input serial ports;
[0141] 2. Send data aggregation: Collect data from all virtual output serial ports;
[0142] 3. Schedule data sending: Determine the order and timing of data sending according to the scheduling algorithm;
[0143] 4. Send data to the physical serial port: Send the aggregated data to the physical serial port.
[0144] The concurrency control module manages the concurrent access of multiple programs to the serial port resources; ensure the synchronization and consistency of data transmission.
[0145] Step description:
[0146] 1 Write control: Ensure that when multiple programs write simultaneously, data errors and resource conflicts do not occur during data transmission;
[0147] 2 Read synchronization: Coordinate the data reading operations of multiple programs to prevent data conflicts.
[0148] The user interface module provides a user interaction interface; allows users to configure serial port parameters and manage serial port resources.
[0149] Step description:
[0150] 1 Interface design: Design an intuitive user interface to display the serial port status and configuration options;
[0151] 2 Parameter configuration: Allow users to configure the parameters of physical and virtual serial ports through the interface;
[0152] 3 Status monitoring: Real-time display of serial port status information, data transmission rate, number of bytes, etc.;
[0153] 4 Log viewing: Provide a log viewing function to record key operation information for users to easily track and diagnose problems.
[0154] Such as Figure 3 As shown, this embodiment provides a method for sharing a single serial port among multiple software, including:
[0155] Physical serial port access: The system first accesses a physical serial port, which is the actual interface for communicating with external devices.
[0156] Virtual serial port pair creation: The system creates multiple virtual serial port pairs, each of which includes a virtual input serial port and a virtual output interface to simulate the functions of a physical serial port.
[0157] Program binding: Multiple programs can be respectively bound to different virtual serial port pairs to achieve reading from the virtual input serial port and writing to the virtual output serial port.
[0158] Data read and write permissions, and can send and receive data independently.
[0159] Physical serial port data reception: When an external device sends data through the physical serial port, the system first receives this data at the physical serial port level.
[0160] Data forwarding to virtual serial ports: The system forwards the received data to all bound virtual input serial ports to ensure that all programs can receive the same data.
[0161] Programs send data: Each program can send data through its bound virtual output serial port.
[0162] Data Aggregation: The system aggregates all the data from the virtual output serial ports and prepares to send it to the physical serial port.
[0163] Data Scheduling: The system determines the order of data transmission according to the priority scheduling algorithm.
[0164] Physical Serial Port Data Transmission: The system sends the aggregated data to external devices through the physical serial port.
[0165] Concurrent Access Control: The system uses concurrent access control and semaphores for synchronization to avoid data conflicts and ensure data integrity.
[0166] Data Synchronization: Ensure the consistency and synchronization of data when multiple programs read the virtual serial port.
[0167] Status Monitoring: Real-time display of status information of the serial port, data transmission rate, number of bytes, etc.
[0168] Logging: The system records the logs of all key operations for problem tracking and system maintenance.
[0169] Although the content of the present invention has been described in detail through the above preferred embodiments, it should be recognized that the above description should not be considered as a limitation of the present invention. After those skilled in the art have read the above content, various modifications and alternatives to the present invention will be obvious. Therefore, the protection scope of the present invention should be defined by the appended claims.
[0170] The content not described in detail in the specification of the present invention belongs to the well-known technology of those skilled in the art.
Claims
1. A single serial port multi-software sharing system, characterized in that: include: Physical serial port, serial port forwarding module, virtual serial port module, serial port and debugging module; among them, The serial port forwarding module is connected to the physical serial port, reads the data of the physical serial port, and forwards it to the virtual serial port, and at the same time forwards the data received from the virtual serial port module to the physical serial port; The virtual serial port module creates multiple virtual serial ports, which are connected in pairs and connected to the serial port forwarding module and the debugging module; Debug module, receive and send data from virtual serial port.
2. A single serial port multi-software sharing system according to claim 1, characterized in that: The serial port forwarding module comprises: The data receiving submodule receives data from the physical serial port or virtual serial port, and performs parsing and error checking; the serial port data after removing the error data is sent to the data processing submodule; The data processing submodule converts and formats the serial port data sent by the data receiving submodule to obtain processed data; and sends the processed data to the corresponding data sending submodule; A data sending submodule, sending the processed data to the virtual serial port or sending the data from the virtual serial port to the physical serial port; The configuration and management submodule sets the serial port parameters according to the user's configuration instructions. The serial port parameters include baud rate, data bits and stop bits; it is used to record logs.
3. A single serial port multi-software sharing system according to claim 1, characterized in that: The virtual serial port module comprises: The virtual serial port creation submodule creates multiple virtual serial port pairs in the operating system; and sends the configuration information of each virtual serial port to the virtual serial port management submodule; The virtual serial port management submodule receives configuration information from the virtual serial port creation submodule and manages the connection with the data communication submodule; manages the status and configuration of all virtual serial port pairs; The data communication submodule receives data from the debugging module and forwards it to the serial port forwarding module, and at the same time receives data from the serial port forwarding module and forwards it to the debugging module.
4. A single serial port multi-software sharing system according to claim 1, characterized in that: The debugging module comprises: The serial port debugging assistant submodule provides a user interface that enables the user to send specific data commands to the virtual serial port and receive and display data from the virtual serial port; The data analysis submodule receives data from the virtual serial port module and performs protocol analysis, or sends data to the virtual serial port module.
5. A single serial port multi-software sharing method, characterized in that: include: Generate multiple virtual serial ports in the operating system; Set the serial port parameters, including baud rate, data bit and stop bit; Configure serial port forwarding parameters, including selecting the physical serial port and setting data transmission parameters; According to the serial port forwarding parameters and serial port parameters, establish the connection between the physical serial port and the virtual serial port, and the paired connection between the virtual serial ports; Receive data from a physical serial port or a virtual serial port, parse and check for errors, and remove error data to obtain serial port data; Convert and format the serial port data to obtain processed data; Send the processed data to the virtual serial port or send the data from the virtual serial port to the physical serial port.
Citation Information
Cited By
Serial port multi-path receiving and transmitting implementation method, device, equipment and program product
CN121478699A
Method and system for dynamically multiplexing serial port resources
CN121579394A