A multi-channel serial communication method, device, system, equipment and storage medium
Patent Information
- Application Number
- CN202311534856.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-16
- Publication Date
- 2026-11-03
- Estimated Expiration
- 2043-11-16
AI Technical Summary
In embedded programs, multi-channel serial communication leads to high microcontroller occupancy and severe resource contention, resulting in increased packet loss rate.
A multi-channel serial communication method is adopted, with the data acquisition terminal connected to the wireless terminal and the device to be acquired respectively, controlling the communication cycle and timing to avoid timing interference and serial port occupation caused by simultaneous communication.
It reduces packet loss rate, improves communication quality, and ensures the stability and efficiency of data transmission.
Smart Images

Figure CN117453613B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to communication technology, and more particularly to a multi-channel serial communication method, apparatus, system, device, and storage medium. Background Technology
[0002] In embedded programs employing a foreground / background architecture, if the communication device lacks a DMA (Direct Memory Access) peripheral, it lacks direct memory access for data transmission and reception. In such cases, interrupt-driven reception and loop-based transmission are typically used for serial port data communication. If the communication device uses this communication method across multiple serial ports, it significantly increases the microcontroller's resource utilization. Furthermore, because communication between different serial ports consumes the communication device's resources and affects their respective transmission timing, it leads to an increased packet loss rate. Summary of the Invention
[0003] This invention provides a multi-channel serial communication method, apparatus, system, device, and storage medium to avoid timing interference and serial port occupation caused by simultaneous communication of two serial ports at the data acquisition end, thereby reducing packet loss rate and improving communication quality.
[0004] In a first aspect, the present invention provides a multi-channel serial communication method applied to a data acquisition terminal, wherein the data acquisition terminal is connected to a wireless terminal and a device to be acquired via serial communication, comprising:
[0005] Receive the first request information sent by the wireless terminal;
[0006] In response to the first request information of the current period, the first response data corresponding to the first request information of the previous period is sent to the wireless terminal;
[0007] When the first response data corresponding to the first request information of the previous period is sent to the wireless terminal, the first request information of the current period is sent to the device to be collected.
[0008] Receive the first response data corresponding to the first request information of the current period returned by the device to be collected.
[0009] Optionally, the data acquisition terminal is also connected to the relay terminal via a bus, and the method further includes:
[0010] After receiving the first response data corresponding to the first request information of the current period returned by the device to be collected, the second request information from the relay end is forwarded to the device to be collected.
[0011] The system receives the second response data sent by the device to be collected in response to the second request information, and forwards the second response data to the relay terminal.
[0012] Optionally, the communication period between the data acquisition terminal and the wireless terminal is T1, and the communication period between the data acquisition terminal and the device to be acquired is T2, where T1 = T2. The start time of the communication period T2 between the data acquisition terminal and the device to be acquired is the time when the data acquisition terminal finishes sending the first response data corresponding to the first request information to the wireless terminal.
[0013] Optionally, the wireless terminal is connected to multiple data acquisition terminals via serial communication, and each data acquisition terminal is connected to a corresponding device to be acquired via serial communication. The wireless terminal sends the first request information to the multiple data acquisition terminals in a polling manner.
[0014] Optionally, each data acquisition terminal, after sending the first response data corresponding to the first request information of the previous period to the wireless terminal, sends the first request information of the current period to the device to be acquired.
[0015] Optionally, when the data acquisition terminal is powered on, a connection test signal is sent to the device to be acquired. After confirming that the connection with the device to be acquired is successful, the first request information sent by the wireless terminal is monitored.
[0016] Optional, multiplex serial communication methods also include:
[0017] After a first preset time has elapsed since the data acquisition terminal lost communication with the wireless terminal, the process returns to the step of monitoring the first request information sent by the wireless terminal.
[0018] Optional, multiplex serial communication methods also include:
[0019] After a second preset time has elapsed since the communication between the data acquisition terminal and the relay terminal is disconnected, the second request information is cleared and sent to the device to be acquired.
[0020] Secondly, the present invention also provides a multi-channel serial communication device for use in a data acquisition terminal, wherein the data acquisition terminal is connected to a wireless terminal and a device to be acquired via serial communication, comprising:
[0021] The first request information receiving module is used to receive the first request information sent by the wireless terminal;
[0022] The first request information sending module is used to send the first response data corresponding to the first request information of the previous period to the wireless terminal in response to the first request information of the current period.
[0023] The first response data sending module is used to send the first response data corresponding to the first request information of the previous period to the device to be collected when the first response data corresponding to the first request information of the previous period is sent to the wireless terminal.
[0024] The first response data receiving module is used to receive the first response data corresponding to the first request information of the current period returned by the device to be collected.
[0025] Thirdly, the present invention also provides a multi-channel serial communication system, including a data acquisition terminal, a wireless terminal, and a device to be acquired. The data acquisition terminal is connected to the wireless terminal and the device to be acquired via serial communication, and the data acquisition terminal is used to execute the multi-channel serial communication method provided in the first aspect of the present invention.
[0026] Optionally, the multi-channel serial communication system includes multiple data acquisition terminals and multiple devices to be acquired. Each data acquisition terminal is connected to a corresponding device to be acquired via serial communication, and the wireless terminal is connected to multiple data acquisition terminals via serial communication.
[0027] The multi-channel serial communication system also includes a relay terminal, which is connected to multiple data acquisition terminals via a bus.
[0028] Fourthly, the present invention also provides an electronic device, comprising:
[0029] One or more processors;
[0030] Storage device for storing one or more programs;
[0031] When the one or more programs are executed by the one or more processors, the one or more processors implement the multi-channel serial communication method provided in the first aspect of the present invention.
[0032] Fifthly, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the multi-channel serial communication method provided in the first aspect of the present invention.
[0033] The multi-channel serial communication method provided by this invention is applied to a data acquisition terminal. The data acquisition terminal is connected to a wireless terminal and a device to be acquired via serial communication. The method includes: receiving a first request message sent by the wireless terminal; responding to the first request message of the current period; sending first response data corresponding to the first request message of the previous period to the wireless terminal; sending the first request message of the current period to the device to be acquired after completing the transmission of the first response data corresponding to the first request message of the previous period to the wireless terminal; and receiving the first response data corresponding to the first request message of the current period returned by the device to be acquired. By sending the first response data corresponding to the first request message of the previous period to the wireless terminal after completing the transmission of the first response data corresponding to the first request message of the previous period to the wireless terminal, the first request message of the current period is sent to the device to be acquired. This means that communication between the data acquisition terminal and the wireless terminal is completed before the wireless terminal begins communication with the device to be acquired. This avoids timing interference and serial port occupancy caused by simultaneous communication via two serial ports on the data acquisition terminal, thereby reducing packet loss and improving communication quality.
[0034] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0035] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0036] Figure 1 A flowchart of a multi-channel serial communication method provided in an embodiment of the present invention;
[0037] Figure 2 This is a schematic diagram of the structure of a multi-channel serial communication system provided in an embodiment of the present invention;
[0038] Figure 3 for Figure 2 Communication timing diagram of a multi-channel serial communication system;
[0039] Figure 4 This is a schematic diagram of another multi-channel serial communication system provided in an embodiment of the present invention;
[0040] Figure 5 for Figure 4 Communication timing diagram of a multi-channel serial communication system;
[0041] Figure 6 This is a schematic diagram of another multi-channel serial communication system provided in an embodiment of the present invention;
[0042] Figure 7 for Figure 6 Communication timing diagram of a multi-channel serial communication system;
[0043] Figure 8 This is a schematic diagram of the structure of the multi-channel serial communication device provided in an embodiment of the present invention;
[0044] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.
[0045] The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation
[0046] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0047] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0048] Figure 1 This is a flowchart illustrating a multi-channel serial communication method provided in an embodiment of the present invention. This embodiment is applicable to situations where devices without DMA data transmission / reception functionality require multi-channel serial communication. The method is applied to a data acquisition terminal, which connects to both a wireless terminal and the device to be acquired via serial communication. This method can be executed by the multi-channel serial communication device provided in this embodiment of the present invention. This device can be implemented in software and / or hardware and is typically configured in electronic devices, such as... Figure 1As shown, this multi-channel serial communication method specifically includes the following steps:
[0049] S101, Receive the first request information sent by the wireless terminal.
[0050] Figure 2 This is a schematic diagram of a multi-channel serial communication system provided in an embodiment of the present invention, as shown below. Figure 2 As shown, the multi-channel serial communication system includes a data acquisition terminal 110, a wireless terminal 120, and a device to be acquired 130. The data acquisition terminal 110 is connected to both the wireless terminal 120 and the device to be acquired 130 via serial communication. Exemplarily, in some embodiments of the present invention, the data acquisition terminal 110 is connected to both the wireless terminal 120 and the device to be acquired 130 via RS485 communication. In the communication between the wireless terminal 120 and the data acquisition terminal 110, the wireless terminal 120 is the master device, and the data acquisition terminal 110 is the slave device. In the communication between the data acquisition terminal 110 and the device to be acquired 130, the data acquisition terminal 110 is the master device, and the device to be acquired 130 is the slave device.
[0051] For example, in this embodiment of the invention, the device to be collected 130 may be the main control board of an elevator, and the data acquisition terminal 110 is used to collect elevator operation data stored in the main control board of the elevator and send the elevator operation data to the wireless terminal 120. The wireless terminal 120 is a wireless terminal device specifically used to convert serial port data into IP data or convert IP data into serial port data for transmission through a wireless communication network. In this embodiment of the invention, the wireless terminal 120 is used to upload the collected elevator operation data to a remote server for comprehensive analysis of the elevator, such as fault detection.
[0052] For example, after the data acquisition terminal 110, the wireless terminal 120 and the device to be acquired 130 are all powered on and a stable connection is established, the wireless terminal 120 sends a first request message to the data acquisition terminal 110, and the data acquisition terminal 110 receives the first request message sent by the wireless terminal 120.
[0053] For example, in this embodiment of the invention, when the data acquisition terminal 110 is first powered on, the data acquisition terminal 110 does not consider communication with the wireless terminal 120, but actively sends a connection test signal to the device to be acquired 130 to test whether the data acquisition terminal 110 has established a connection with the device to be acquired 130. For example, the data acquisition terminal 110 can send a query command to the device to be acquired 130 to query the elevator number connected to the data acquisition terminal 110. After receiving the elevator number from the device to be acquired 130, it is determined that the connection with the device to be acquired 130 is successful; otherwise, the connection fails. After determining that the connection with the device to be acquired 130 is successful, it actively monitors the first request information sent by the wireless terminal 120. After determining that the connection with the device to be acquired 130 is not successful, it continues to send connection test signals to the device to be acquired 130 until the number of times it sends the signal reaches a preset value or a feedback signal indicating a successful connection is received.
[0054] S102. In response to the first request information of the current period, send the first response data corresponding to the first request information of the previous period to the wireless terminal.
[0055] Figure 3 for Figure 2 The communication timing diagrams for a multi-channel serial communication system are shown below. The top diagram shows the communication timing between the data acquisition terminal and the wireless terminal, while the bottom diagram shows the communication timing between the data acquisition terminal and the device to be acquired. Figure 3 As shown in the diagram above, for example, after receiving the first request information sent by the wireless terminal, the data acquisition terminal sends the first response data corresponding to the first request information of the previous cycle to the wireless terminal. Here, for communication between the data acquisition terminal and the wireless terminal, one cycle is the time interval between the start times of two consecutive receptions of the first request information sent by the wireless terminal by the data acquisition terminal. The first response data corresponding to the first request information of the previous cycle is the first response data sent by the device to be acquired to the data acquisition terminal in response to the first request information of the previous cycle; the response data can be elevator operation data.
[0056] S103. After sending the first response data corresponding to the first request information of the previous period to the wireless terminal, send the first request information of the current period to the device to be collected.
[0057] For example, such as Figure 3 As shown in the figure below, after sending the first response data corresponding to the first request information of the previous period to the wireless terminal, the first request information of the current period is sent to the device to be collected.
[0058] S104. Receive the first response data corresponding to the first request information of the current period returned by the device to be collected.
[0059] The device under test responds to the first request information sent by the data acquisition terminal by sending the first response data required for the first request information to the data acquisition terminal. The data acquisition terminal receives the first response data corresponding to the first request information of the current period returned by the device under test. For the communication between the data acquisition terminal and the device under test, one period is the time interval between the start times of two consecutive first request information sent by the data acquisition terminal to the device under test.
[0060] For example, such as Figure 3 As shown, after the data acquisition terminal sends the first response data corresponding to the first request information of the previous cycle to the wireless terminal, it continues to receive the first request information of the next cycle sent by the wireless terminal, and so on. After the data acquisition terminal finishes receiving the first response data corresponding to the first request information of the current cycle returned by the device to be acquired, it continues to send the first request information of the next cycle to the device to be acquired, and so on.
[0061] The multi-channel serial communication method provided in this invention is applied to a data acquisition terminal. The data acquisition terminal is connected to a wireless terminal and a device to be acquired via serial communication. The method includes: receiving a first request message sent by the wireless terminal; responding to the first request message of the current period; sending first response data corresponding to the first request message of the previous period to the wireless terminal; sending the first request message of the current period to the device to be acquired after completing the transmission of the first response data corresponding to the first request message of the previous period to the wireless terminal; and receiving the first response data corresponding to the first request message of the current period returned by the device to be acquired. By sending the first response data corresponding to the first request message of the previous period to the wireless terminal after completing the transmission of the first response data corresponding to the first request message of the previous period to the wireless terminal, the first request message of the current period is sent to the device to be acquired. This means that communication between the data acquisition terminal and the wireless terminal is completed before the wireless terminal begins communication with the device to be acquired. This avoids timing interference and serial port occupancy caused by simultaneous communication via two serial ports on the data acquisition terminal, thereby reducing packet loss and improving communication quality.
[0062] Figure 4 This is a schematic diagram of another multi-channel serial communication system provided in an embodiment of the present invention, as shown below. Figure 4 As shown, in some embodiments of the present invention, based on the foregoing embodiments, the data acquisition terminal 110 is also connected to the relay terminal 140 via a bus. For example, the bus is a CAN (Controller Area Network) bus, a serial communication protocol bus used for real-time applications. The characteristics of the CAN protocol include complete serial data communication, real-time support, a transmission rate of up to 1Mb / s, and 11-bit addressing and error detection capabilities. The relay terminal 140 can be a local server used to store local data from the device to be acquired.
[0063] Figure 5 for Figure 4 The communication timing diagrams for a multi-channel serial communication system are shown below. The top diagram shows the communication timing between the data acquisition terminal and the wireless terminal, while the bottom diagram shows the communication timing between the data acquisition terminal and the device to be acquired. Figure 5 As shown in the diagram below, after the data acquisition terminal receives the first response data corresponding to the first request information of the current period returned by the device to be acquired, it forwards the second request information from the relay terminal to the device to be acquired. The device to be acquired responds to the second request information by sending second response data to the data acquisition terminal. The second response data and the first response data may be the same or different; this embodiment of the invention does not impose any limitations on this. The data acquisition terminal receives the second response data sent by the device to be acquired in response to the second request information and forwards the second response data to the relay terminal.
[0064] In addition, the CAN interface has a high communication rate and a short communication time. For this part of the processing logic, the data acquisition end only needs to immediately return the second response data returned by the device to be acquired in the previous cycle to the relay end through the CAN bus after receiving the second request information from the relay end.
[0065] Figure 6 This is a schematic diagram of another multi-channel serial communication system provided in an embodiment of the present invention, as shown below. Figure 4 As shown, in some embodiments of the present invention, based on the foregoing embodiments, the wireless terminal 120 is connected to multiple data acquisition terminals 110 via serial communication. For example, the wireless terminal 120 is connected to three data acquisition terminals 110 (labeled 1#, 2#, and 3#) via serial communication. Each data acquisition terminal 120 is connected to a corresponding device 130 to be acquired (labeled 1#, 2#, and 3#) via serial communication. The wireless terminal 120 sends first request information to the multiple data acquisition terminals 110 in a polling manner. The relay terminal 140 is connected to the multiple data acquisition terminals 110 via a bus.
[0066] Figure 7 for Figure 6 The communication timing diagram of the multi-channel serial communication system is shown below. The top diagram shows the communication timing between the wireless terminal and each data acquisition terminal. The remaining diagrams, from top to bottom, show the communication timing between data acquisition terminals 1#-3# and their corresponding devices to be acquired. Figure 7As shown, the wireless terminal communicates with data acquisition terminals #1 through #3 sequentially using a polling method. After receiving the first request information sent by the wireless terminal, data acquisition terminal #1 sends the first response data of device #1 corresponding to the first request information of the previous cycle to the wireless terminal. Then, after receiving the first request information sent by the wireless terminal, data acquisition terminal #2 sends the first response data of device #2 corresponding to the first request information of the previous cycle to the wireless terminal. Then, after receiving the first request information sent by the wireless terminal, data acquisition terminal #3 sends the first response data of device #3 corresponding to the first request information of the previous cycle to the wireless terminal. This cycle repeats. The communication period T1 between the wireless terminal and the data acquisition terminals is the time interval between the start times of two consecutive first request information received by the same data acquisition terminal from the wireless terminal.
[0067] For communication between data acquisition terminal #1 and device #1, after data acquisition terminal #1 finishes sending the first response data corresponding to the first request information of the previous period to the wireless terminal, it sends the first request information of the current period to device #1, and then receives the first response data corresponding to the first request information of the current period returned by device #1. After receiving the first response data corresponding to the first request information of the current period returned by device #1, it forwards the second request information from the relay terminal to device #1, and device #1 responds to the second request information by sending the second response data to data acquisition terminal #1. This cycle repeats, and the communication period T2 between data acquisition terminal #1 and device #1 is the time interval between the start times of two consecutive first request information messages sent by data acquisition terminal #1 to device #1.
[0068] For communication between data acquisition terminal #2 and device #2, after data acquisition terminal #2 finishes sending the first response data corresponding to the first request information of the previous period to the wireless terminal, it sends the first request information of the current period to device #2, and then receives the first response data corresponding to the first request information of the current period returned by device #2. After receiving the first response data corresponding to the first request information of the current period returned by device #2, it forwards the second request information from the relay terminal to device #2, and device #2 responds to the second request information by sending the second response data to data acquisition terminal #2. This cycle repeats, and the communication period T2 between data acquisition terminal #2 and device #2 is the time interval between the start times of two consecutive first request information messages sent by data acquisition terminal #2 to device #2.
[0069] For communication between the #3 data acquisition terminal and the #3 device to be acquired, after the #3 data acquisition terminal finishes sending the first response data corresponding to the first request information of the previous cycle to the wireless terminal, it sends the first request information of the current cycle to the #3 device to be acquired, and then receives the first response data corresponding to the first request information of the current cycle returned by the #3 device to be acquired. After receiving the first response data corresponding to the first request information of the current cycle returned by the #3 device to be acquired, it forwards the second request information from the relay terminal to the #3 device to be acquired, and the #3 device to be acquired responds by sending the second response data to the #3 data acquisition terminal. This cycle repeats, and the communication period T2 between the #3 data acquisition terminal and the #3 device to be acquired is the time interval between the start times of two consecutive first request information messages sent by the #3 data acquisition terminal to the device to be acquired.
[0070] Each data acquisition terminal, after sending the first response data corresponding to the first request information of the previous cycle to the wireless terminal, sends the first request information of the current cycle to the device to be acquired. In this way, multiple data acquisition terminals can receive the response data of the corresponding devices to be acquired in a time-sharing manner, thereby enabling them to transmit response data back to the wireless terminal in a time-sharing manner and avoiding line congestion caused by multiple wireless terminals transmitting response data back to the wireless terminal simultaneously.
[0071] In some embodiments of the present invention, the communication period between the data acquisition terminal and the wireless terminal is T1, and the communication period between the data acquisition terminal and the device to be acquired is T2, where T1 = T2. The start time of the communication period T2 between the data acquisition terminal and the device to be acquired is the time when the data acquisition terminal finishes sending the first response data corresponding to the first request information to the wireless terminal. For example, in some embodiments of the present invention, T1 = T2 = 300ms, and the time for the wireless terminal to poll one data acquisition terminal is 100ms.
[0072] For example, in the foregoing embodiments, after the data acquisition end loses communication with the wireless terminal for a first preset time (e.g., 10 seconds), the system returns to actively monitor the first request information sent by the wireless terminal until the first request information is received, or the monitoring time exceeds the set time, at which point communication stops or an alarm is triggered.
[0073] For example, in the foregoing embodiment, after the communication between the data acquisition end and the relay end is interrupted for a second preset time (e.g., 10 seconds), the second request information stored in the data acquisition end is cleared, and the cleared second request information is sent to the device to be acquired.
[0074] Figure 8 This is a schematic diagram of the structure of a multi-channel serial communication device provided in an embodiment of the present invention. It is applied to a data acquisition terminal, which is connected to a wireless terminal and the device to be acquired via serial communication, as shown below. Figure 8 As shown, the multi-channel serial communication device includes:
[0075] The first request information receiving module 201 is used to receive the first request information sent by the wireless terminal;
[0076] The first request information sending module 202 is used to send the first response data corresponding to the first request information of the previous period to the wireless terminal in response to the first request information of the current period.
[0077] The first response data sending module 203 is used to send the first response data corresponding to the first request information of the previous period to the device to be collected when the first response data corresponding to the first request information of the previous period is sent to the wireless terminal.
[0078] The first response data receiving module 204 is used to receive the first response data corresponding to the first request information of the current period returned by the device to be collected.
[0079] In some embodiments of the present invention, the data acquisition terminal is also connected to the relay terminal via a bus, and the multi-channel serial communication device further includes:
[0080] The second request information sending module is used to forward the second request information from the relay end to the device under test after receiving the first response data corresponding to the first request information of the current period returned by the device under test.
[0081] The second response data receiving module is used to receive the second response data sent by the device to be collected in response to the second request information, and forward the second response data to the relay terminal.
[0082] In some embodiments of the present invention, the communication period between the data acquisition terminal and the wireless terminal is T1, the communication period between the data acquisition terminal and the device to be acquired is T2, T1 = T2, and the start time of the communication period T2 between the data acquisition terminal and the device to be acquired is the time when the data acquisition terminal finishes sending the first response data corresponding to the first request information to the wireless terminal.
[0083] In some embodiments of the present invention, the wireless terminal is connected to multiple data acquisition terminals via serial communication, each data acquisition terminal is connected to a corresponding device to be acquired via serial communication, and the wireless terminal sends the first request information to multiple data acquisition terminals in a polling manner.
[0084] In some embodiments of the present invention, when each data acquisition terminal finishes sending the first response data corresponding to the first request information of the previous period to the wireless terminal, it sends the first request information of the current period to the device to be acquired.
[0085] In some embodiments of the present invention, when the data acquisition terminal is powered on, a connection test signal is sent to the device to be acquired. After confirming that the connection with the device to be acquired is successful, the first request information sent by the wireless terminal is monitored.
[0086] In some embodiments of the present invention, the multi-channel serial communication device further includes:
[0087] The monitoring module is used to return to the step of monitoring the first request information sent by the wireless terminal after the communication between the data acquisition terminal and the wireless terminal is interrupted for a first preset time.
[0088] In some embodiments of the present invention, the multi-channel serial communication device further includes:
[0089] The zeroing module is used to clear the second request information and send it to the device to be collected after a second preset time period of communication disconnection between the data acquisition terminal and the relay terminal.
[0090] The aforementioned multi-channel serial communication device can execute the multi-channel serial communication method provided in the foregoing embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the multi-channel serial communication method.
[0091] Figure 9 This is a schematic diagram of an electronic device provided for an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0092] like Figure 9 As shown, the electronic device includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded into the RAM 13 from storage unit 18. The RAM 13 can also store various programs and data required for the operation of the electronic device. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0093] Multiple components in the electronic device are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, optical disk, etc.; and a communication unit 19, such as a network card, modem, wireless transceiver, etc. The communication unit 19 allows the electronic device to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0094] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as multiplexed serial communication methods.
[0095] In some embodiments, the multiplexing serial communication method can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on an electronic device via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the multiplexing serial communication method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the multiplexing serial communication method by any other suitable means (e.g., by means of firmware).
[0096] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0097] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0098] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0099] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0100] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0101] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0102] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the multi-channel serial communication method provided in any embodiment of this application.
[0103] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0104] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0105] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A multi-channel serial communication method, characterized in that, Applied to a data acquisition terminal, the data acquisition terminal is connected to a wireless terminal and the device to be acquired via serial communication, and includes: Receive the first request information sent by the wireless terminal; In response to the first request information of the current period, the first response data corresponding to the first request information of the previous period is sent to the wireless terminal; When the first response data corresponding to the first request information of the previous period is sent to the wireless terminal, the first request information of the current period is sent to the device to be collected. Receive the first response data corresponding to the first request information of the current period returned by the device to be collected.
2. The multi-channel serial communication method according to claim 1, characterized in that, The data acquisition terminal is also connected to the relay terminal via a bus, and the method further includes: After receiving the first response data corresponding to the first request information of the current period returned by the device to be collected, the second request information from the relay end is forwarded to the device to be collected. The system receives the second response data sent by the device to be collected in response to the second request information, and forwards the second response data to the relay terminal.
3. The multi-channel serial communication method according to claim 1, characterized in that, The communication period between the data acquisition terminal and the wireless terminal is T1, and the communication period between the data acquisition terminal and the device to be acquired is T2, where T1 = T2. The start time of the communication period T2 between the data acquisition terminal and the device to be acquired is the time when the data acquisition terminal finishes sending the first response data corresponding to the first request information to the wireless terminal.
4. The multi-channel serial communication method according to any one of claims 1-3, characterized in that, The wireless terminal is connected to multiple data acquisition terminals via serial communication. Each data acquisition terminal is connected to a corresponding device to be acquired via serial communication. The wireless terminal sends the first request information to the multiple data acquisition terminals in a polling manner.
5. The multi-channel serial communication method according to claim 4, characterized in that, When each data acquisition terminal finishes sending the first response data corresponding to the first request information of the previous period to the wireless terminal, it sends the first request information of the current period to the device to be acquired.
6. The multi-channel serial communication method according to any one of claims 1-3, characterized in that, When the data acquisition terminal is powered on, it sends a connection test signal to the device to be acquired. After confirming that the connection with the device to be acquired is successful, it monitors the first request information sent by the wireless terminal.
7. The multi-channel serial communication method according to claim 6, characterized in that, Also includes: After a first preset time has elapsed since the data acquisition terminal lost communication with the wireless terminal, the process returns to the step of monitoring the first request information sent by the wireless terminal.
8. The multi-channel serial communication method according to claim 2, characterized in that, Also includes: After a second preset time has elapsed since the communication between the data acquisition terminal and the relay terminal is disconnected, the second request information is cleared and sent to the device to be acquired.
9. A multi-channel serial communication device, characterized in that, Applied to a data acquisition terminal, the data acquisition terminal is connected to a wireless terminal and the device to be acquired via serial communication, and includes: The first request information receiving module is used to receive the first request information sent by the wireless terminal; The first request information sending module is used to send the first response data corresponding to the first request information of the previous period to the wireless terminal in response to the first request information of the current period. The first response data sending module is used to send the first response data corresponding to the first request information of the previous period to the device to be collected when the first response data corresponding to the first request information of the previous period is sent to the wireless terminal. The first response data receiving module is used to receive the first response data corresponding to the first request information of the current period returned by the device to be collected.
10. A multi-channel serial communication system, characterized in that, It includes a data acquisition terminal, a wireless terminal, and a device to be acquired. The data acquisition terminal is connected to the wireless terminal and the device to be acquired via serial communication. The data acquisition terminal is used to execute the multi-channel serial communication method as described in any one of claims 1-8.
11. The multi-channel serial communication system according to claim 10, characterized in that, It includes multiple data acquisition terminals and multiple devices to be acquired. Each data acquisition terminal is connected to a corresponding device to be acquired via serial communication. The wireless terminal is connected to multiple data acquisition terminals via serial communication. The multi-channel serial communication system also includes a relay terminal, which is connected to multiple data acquisition terminals via a bus.
12. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the multi-channel serial communication method as described in any one of claims 1-8.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the multi-channel serial communication method as described in any one of claims 1-8.
Citation Information
Patent Citations
Serial port communication system, method and device and electronic equipment
CN111159092A
Data acquisition instruction processing method, SNMP proxy device and storage medium
CN113014405A
