UART serial port multiplexing method, device, equipment and medium

By using the same UART serial port in the intelligent communication system and adopting time-sharing communication mode and on-demand communication mode, the problem of high cost and high power consumption during multi-device communication of home appliances is solved, and a low-cost and low-power communication method is realized.

CN119759817APending Publication Date: 2025-04-04GREE ELECTRIC APPLIANCE INC OF ZHUHAI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411828759.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-12
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

In the prior art, when home appliances communicate with multiple devices, there are problems of high cost and high power consumption.

Method used

By using the same UART serial port for communication in the intelligent communication system, the time-sharing communication mode and on-demand communication mode are adopted. The time-sharing communication mode communicates with each slave device in sequence according to the preset timing communication data, and the on-demand communication mode communicates with the slave device on-demand.

Benefits of technology

It realizes a low-cost and low-power communication method, which is suitable for multi-device communication scenarios, and has the advantages of high fault tolerance, high communication efficiency and fast response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759817A_ABST
    Figure CN119759817A_ABST
Patent Text Reader

Abstract

The invention provides a UART (Universal Asynchronous Receiver / Transmitter) serial port multiplexing method, a UART serial port multiplexing device, UART serial port multiplexing equipment and a medium. The first controller sequentially and circularly sends first information to each slave device according to preset time sequence communication data so as to obtain second information correspondingly fed back by each slave device; wherein the time sequence communication data comprises a communication period composed of a plurality of time periods; and if the communication mode is the on-demand communication mode, the first controller obtains third information from the slave equipment and sends corresponding fourth information to the corresponding slave equipment. The embodiment of the invention provides a time-sharing communication mode and an on-demand communication mode, and the time-sharing communication mode and the on-demand communication mode both have the advantages of low cost and low power consumption; wherein the time-sharing communication mode has the advantage of high error-tolerant rate; the on-demand communication mode has the advantages of high communication efficiency and high response speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a UART serial port multiplexing method, device, equipment and medium. Background Art

[0002] In the current development of home appliances, various products adopt more and more peripherals to make the product functions more diverse and powerful. For example, in the smart home system, various components (such as smart sockets, lighting systems, security cameras, etc.) can be controlled in a linked manner. The communication methods of each product are different. Among them, serial ports, as a low-cost and reliable communication method, have always occupied an important position in the communication development of home appliances.

[0003] With the introduction of various intelligent products, products need to communicate with multiple devices to achieve control, remote monitoring and management of multiple devices. In the prior art, multiple communication ports are usually mounted on the product to communicate with multiple devices at the same time. However, the communication method of mounting multiple communication ports on the product has the problems of high cost and high power consumption.

[0004] Therefore, existing communication methods have the problems of high cost and high power consumption. Summary of the invention

[0005] The embodiments of the present invention provide a UART serial port multiplexing method, device, equipment and medium, aiming to solve the problems of high cost and high power consumption in existing communication methods.

[0006] In a first aspect, an embodiment of the present invention provides a UART serial port multiplexing method, the method is applied to an intelligent communication system, the intelligent communication system includes a host device and at least one slave device, a first controller of the host device is communicatively connected with a second controller of each slave device through the same UART serial port, and the method includes the following steps performed by the first controller:

[0007] If the communication mode is a time-sharing communication mode, the first controller cyclically sends the first information to each of the slave devices in turn according to the preset timing communication data to obtain the second information corresponding to the feedback of each of the slave devices; wherein the timing communication data includes a communication cycle consisting of a plurality of time periods;

[0008] If the communication mode is the on-demand communication mode, the first controller obtains the third information from the slave device and sends the corresponding fourth information to the corresponding slave device.

[0009] In a second aspect, an embodiment of the present invention further provides a UART serial port multiplexing device, wherein the device is configured in an intelligent communication system, wherein the intelligent communication system includes a host device and at least one slave device, wherein a first controller of the host device is communicatively connected with a second controller of each slave device via the same UART serial port, and the device includes the following units configured in the first controller of the intelligent communication system:

[0010] A first control unit, for, if the communication mode is a time-sharing communication mode, the first controller sequentially and cyclically sends first information to each of the slave devices according to preset timing communication data to obtain second information corresponding to feedback from each of the slave devices; wherein the timing communication data includes a communication cycle consisting of a plurality of time periods;

[0011] The second control unit is used for, if the communication mode is the on-demand communication mode, the first controller obtains the third information from the slave device and sends the corresponding fourth information to the corresponding slave device.

[0012] In a third aspect, an embodiment of the present invention further provides an electronic device, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the method described in the first aspect is implemented.

[0013] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a computer program, wherein the computer program includes program instructions, and wherein the program instructions, when executed by a processor, can implement the method described in the first aspect above.

[0014] The present invention provides a UART serial port multiplexing method, device, equipment and medium. The method is applied to an intelligent communication system, wherein the intelligent communication system includes a host device and at least one slave device. The first controller of the host device is connected to the second controller of each slave device through the same UART serial port for communication. The method includes the following steps performed by the first controller: if the communication mode is a time-sharing communication mode, the first controller sends first information to each of the slave devices in a cyclic manner according to preset timing communication data to obtain second information fed back by each slave device; wherein the timing communication data includes a communication cycle consisting of multiple time periods; if the communication mode is an on-demand communication mode, the first controller obtains third information from the slave device and sends corresponding fourth information to the corresponding slave device. The embodiment of the present invention provides two communication modes: time-sharing communication mode and on-demand communication mode. Both the time-sharing communication mode and the on-demand communication mode have the advantages of low cost and low power consumption. During the communication development process of the product, a suitable communication mode can be selected according to product requirements and specific usage scenarios. Among them, the time-sharing communication mode communicates with each slave device according to preset timing communication data, and has the advantage of high fault tolerance; the on-demand communication mode communicates with the slave device on demand, and has the advantages of high communication efficiency and fast response speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0016] Figure 1 A schematic diagram of a UART serial port multiplexing method provided by an embodiment of the present invention;

[0017] Figure 2 A schematic block diagram of a UART serial port multiplexing device provided in an embodiment of the present invention;

[0018] Figure 3 A schematic block diagram of an electronic device provided by an embodiment of the present invention;

[0019] Figure 4 A schematic diagram of an application scenario of the UART serial port multiplexing method provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0020] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0021] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0022] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0023] It should be further understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations. The embodiment of the present invention provides a UART serial port multiplexing method, device, equipment and medium. The UART serial port multiplexing method can be found in Figure 4 , Figure 4 A schematic diagram of an application scenario of a UART serial port multiplexing method provided in an embodiment of the present invention. The UART serial port multiplexing method is applied to an intelligent communication system 10, wherein the intelligent communication system 10 includes a host device A and at least one slave device (B1, B2, ..., Bn-1, Bn), wherein a first controller of the host device A is connected to a second controller of each slave device (B1, B2, ..., Bn-1, Bn) via the same UART serial port; wherein each of the slave devices is connected in parallel to connect each slave device to the host device A via the same UART serial port.

[0024] Figure 1 The following is a flow chart of a UART serial port multiplexing method provided by an embodiment of the present invention. Figure 1 As shown, the method includes the following steps S110-S120 executed by the first controller.

[0025] S110. If the communication mode is a time-sharing communication mode, the first controller sends first information to each of the slave devices in a cyclic manner according to preset timing communication data to obtain second information fed back by each of the slave devices; wherein the timing communication data includes a communication cycle consisting of multiple time periods.

[0026] In this embodiment, the timing communication data includes a communication cycle consisting of a plurality of time periods, each of which is configured with corresponding device information; for example, the communication cycle includes a first time period, a second time period and a third time period, and the communication cycle can be set to 1 second, the first time period is 0 to 0.3 seconds, and the first time period is configured with device information of slave device B1; the second time period is 0.3 to 0.6 seconds, and the second time period is configured with device information of slave device B2; the third time period is 0.6 to 0.9 seconds, and the third time period is configured with device information of slave device B3; within a communication cycle, the first controller sends first information to the corresponding slave device according to the device information corresponding to the current time period, and the first information can be data acquisition request information, and the first information can be transmitted to the corresponding slave device by the first controller. The slave device sends the first information to obtain the second information fed back by the corresponding slave device, wherein the second information is the information collected by the slave device; for example, the current time period is the first time period, and the first controller will continuously send the first information to all slave devices, however, the first information has the device information of the slave device B1 (which can also be understood as tag information), therefore, the first information sent by the first controller can only be recognized by the slave device B1, and cannot be recognized by other slave devices, therefore, within the first time period, only the slave device B1 will reply to the first information, and the reply content is the second information, which may be the information collected by the slave device B1; when the first time period ends and reaches the second time period, the information exchange will automatically switch, at which time, the first controller communicates with the slave device B2.

[0027] In one embodiment, step S110 includes: the first controller confirms the time period corresponding to the current time based on the cycle start time, cycle end time and time period information in the timing communication data of the current communication cycle; wherein each time period in the communication cycle is configured with corresponding device information; the first controller generates corresponding first information based on the device information corresponding to the current time period and sends it to the corresponding slave device.

[0028] In this embodiment, before the first controller sends the first information, it will confirm the time period corresponding to the current time based on the cycle start time, cycle end time of the current communication cycle and the time period information in the timing communication data; wherein the time period information includes the sequence of each of the time periods and the length of each time period; each time period in the communication cycle is configured with corresponding device information; the first controller generates corresponding first information based on the device information corresponding to the current time period and sends it to the corresponding slave device to obtain the corresponding information collected by the slave device (i.e., the second information).

[0029] In one embodiment, before confirming the time period corresponding to the current time, the method further includes: if the current time reaches the cycle end time, the first controller enters the next communication cycle and uses the cycle end time as the cycle start time of the next communication cycle.

[0030] In this embodiment, if the current time reaches the cycle end time, the first controller enters the next communication cycle and uses the cycle end time as the cycle start time of the next communication cycle, and then confirms the current time period based on the time period information of the next communication cycle, wherein the time period information includes the sequence of each time period and the length of each time period, and the current time period is confirmed based on the sequence of each time period and the length of each time period, and then the current communication object is confirmed.

[0031] S120: If the communication mode is the on-demand communication mode, the first controller obtains third information from the slave device and sends corresponding fourth information to the corresponding slave device.

[0032] In this embodiment, the slave device can be an intelligent device such as an infrared sensor, a temperature and humidity sensor, etc. Assuming that at a certain moment the infrared sensor detects that someone is approaching, it will send a third message to the host device so that it can process the third information and feedback (the specific data processing method is not limited); the first controller obtains the third information from the slave device and sends the corresponding fourth information to the corresponding slave device. The fourth information can be a reply message to inform the corresponding slave device to receive and process the third information; specifically, the first controller can parse the third information. If the data format of the third information meets the preset protocol format requirements, the fourth information is returned to the corresponding slave device to let it know that the third data has been given to the host device.

[0033] The embodiment of the present invention provides two communication modes, namely, a time-sharing communication mode and an on-demand communication mode. Both the time-sharing communication mode and the on-demand communication mode have the advantages of low cost and low power consumption. During the communication development process of the product, a suitable communication mode can be selected according to product requirements and specific usage scenarios. Among them, the time-sharing communication mode communicates with each slave device according to preset timing communication data, and has the advantage of high fault tolerance compared to the on-demand communication mode. The on-demand communication mode communicates with the slave device on demand, and has the advantages of high communication efficiency and fast response speed compared to the time-sharing communication mode.

[0034] The method also includes the following steps performed by the second controller: when the communication mode is an on-demand communication mode, the second controller determines whether the collected real-time data meets the information request conditions; if so, the second controller generates corresponding third information based on the real-time data and sends it to the host device.

[0035] In this embodiment, when the communication mode is an on-demand communication mode, the second controller will determine in real time whether the collected real-time data can be reported to the host device based on the preset information request conditions; for example, when the slave device is a temperature and humidity sensor, the temperature and humidity information of the target area will be detected in real time. If the temperature and humidity information is detected to be greater than the preset change threshold, the current temperature and humidity information will be used as the third information and sent to the host device.

[0036] In one embodiment, after the second controller generates corresponding third information according to the real-time data and sends it to the host device, it also includes: if the fourth information from the host device is not received within a preset response waiting time, the second controller resends the third information to the host device.

[0037] In this embodiment, when multiple slave devices simultaneously send data to the host device through the same UART serial port, data collision may occur, resulting in data upload failure. Therefore, if the fourth information is not received from the host device within the preset response waiting time, the second controller will resend the third information to the host device according to the preset protocol format requirements.

[0038] In one embodiment, before the second controller generates corresponding third information based on the real-time data and sends it to the host device, it also includes: the second controller detects the UART serial port to obtain the transmission status of the UART serial port; if the transmission status is a busy state, it returns to execute the step of detecting the UART serial port after delaying a preset waiting time.

[0039] In this embodiment, in order to avoid or reduce the occurrence of data collision, the second controller will first detect the UART serial port to obtain the transmission status of the UART serial port before sending the third information to the host device; if the transmission status is busy, it will return to the step of detecting the UART serial port after a preset waiting time, and will not send the third information to the host device until the detected transmission status is idle.

[0040] In one embodiment, after the second controller detects the UART serial port to obtain the transmission status of the UART serial port, it also includes: if the transmission status is an idle state, executing the step of the second controller generating corresponding third information according to the real-time data and sending it to the host device.

[0041] In this embodiment, if the transmission state is an idle state, the second controller generates corresponding third information according to the real-time data and sends it to the host device to reduce data collision and improve data upload efficiency and communication efficiency.

[0042] Furthermore, if the transmission states detected within a unit time are all idle states, a step is executed in which the second controller generates corresponding third information according to the real-time data and sends the third information to the host device.

[0043] In summary, the embodiments of the present invention provide two communication modes, namely, a time-sharing communication mode and an on-demand communication mode. Both the time-sharing communication mode and the on-demand communication mode have the advantages of low cost and low power consumption. During the communication development process of the product, a suitable communication mode can be selected according to product requirements and specific usage scenarios. Among them, the time-sharing communication mode communicates with each slave device according to preset timing communication data, and has the advantage of high fault tolerance. The on-demand communication mode communicates with the slave device on demand, and has the advantages of high communication efficiency and fast response speed.

[0044] Figure 2 A schematic block diagram of a UART serial port multiplexing device provided by an embodiment of the present invention. Figure 2 As shown, corresponding to the above UART serial port multiplexing method, the present invention also provides a UART serial port multiplexing device, the device is configured in an intelligent communication system, the intelligent communication system includes a host device and at least one slave device, the first controller of the host device is connected to the second controller of each slave device through the same UART serial port. Figure 2 The UART serial port multiplexing device 700 includes the following units configured in the first controller of the intelligent communication system:

[0045] The first control unit 701 is used for, if the communication mode is a time-sharing communication mode, the first controller sequentially and cyclically sends the first information to each of the slave devices according to the preset timing communication data to obtain the second information corresponding to the feedback of each of the slave devices; wherein the timing communication data includes a communication cycle consisting of a plurality of time periods;

[0046] The second control unit 702 is configured to, if the communication mode is the on-demand communication mode, cause the first controller to obtain the third information from the slave device and send the corresponding fourth information to the corresponding slave device.

[0047] In some embodiments, when the first control unit 701 executes the step of the first controller sending the first information to each of the slave devices in turn and cyclically according to the preset timing communication data, it is specifically used to:

[0048] The first controller confirms the time period corresponding to the current time based on the cycle start time, cycle end time and time period information in the timing communication data of the current communication cycle; wherein each time period in the communication cycle is configured with corresponding device information; the first controller generates corresponding first information based on the device information corresponding to the current time period and sends it to the corresponding slave device.

[0049] In some embodiments, before executing the step of confirming the time period corresponding to the current time, the first control unit 701 is further configured to:

[0050] If the current time reaches the cycle end time, the first controller enters the next communication cycle and uses the cycle end time as the cycle start time of the next communication cycle.

[0051] In some embodiments, the UART serial port multiplexing device 700 includes the following units configured in the first controller of the intelligent communication system:

[0052] a judgment unit, configured to, when the communication mode is the on-demand communication mode, cause the second controller to judge whether the collected real-time data meets the information request condition;

[0053] An information sending unit is used for, if satisfied, the second controller to generate corresponding third information according to the real-time data and send it to the host device.

[0054] In some embodiments, after executing the step of the second controller generating corresponding third information according to the real-time data and sending the third information to the host device, the information sending unit is further used to:

[0055] If the fourth message from the host device is not received within the preset response waiting time, the second controller resends the third message to the host device.

[0056] In some embodiments, before executing the step of the second controller generating corresponding third information according to the real-time data and sending the third information to the host device, the information sending unit is further used to:

[0057] The second controller detects the UART serial port to obtain the transmission status of the UART serial port; if the transmission status is a busy state, the second controller returns to execute the step of detecting the UART serial port after delaying a preset waiting time.

[0058] In some embodiments, after executing the step of the second controller detecting the UART serial port to obtain the transmission status of the UART serial port, the information sending unit is further used to:

[0059] If the transmission state is an idle state, the second controller generates corresponding third information according to the real-time data and sends the third information to the host device.

[0060] It should be noted that technicians in the relevant field can clearly understand that the specific implementation process of the above-mentioned UART serial port multiplexing device and each unit can refer to the corresponding description in the aforementioned method embodiment, and for the convenience and conciseness of the description, it will not be repeated here.

[0061] The above-mentioned UART serial port multiplexing device can be implemented in the form of a computer program, and the computer program can be Figure 3 The electronic device shown is running.

[0062] See also Figure 3 , Figure 3 800 is a schematic block diagram of an electronic device provided by an embodiment of the present invention. The electronic device 800 can be a terminal or a server, wherein a terminal is an electronic device with a communication function; a server can be an independent server or a server cluster composed of multiple servers.

[0063] See also Figure 3 The electronic device 800 includes a processor 802 , a memory and a network interface 805 connected via a system bus 801 , wherein the memory may include a non-volatile storage medium 803 and an internal memory 804 .

[0064] The non-volatile storage medium 803 can store an operating system 8031 ​​and a computer program 8032. The computer program 8032 includes program instructions, and when the program instructions are executed, the processor 802 can execute a UART serial port multiplexing method.

[0065] The processor 802 is used to provide computing and control capabilities to support the operation of the entire electronic device 800 .

[0066] The internal memory 804 provides an environment for the operation of the computer program 8032 in the non-volatile storage medium 803. When the computer program 8032 is executed by the processor 802, the processor 802 can execute a UART serial port multiplexing method.

[0067] The network interface 805 is used to communicate with other devices over the network. Figure 3 The structure shown in the figure is merely a block diagram of a partial structure related to the solution of the present invention, and does not constitute a limitation on the electronic device 800 to which the solution of the present invention is applied. The specific electronic device 800 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0068] The processor 802 is used to run the computer program 8032 stored in the memory to implement the following steps:

[0069] If the communication mode is a time-sharing communication mode, the first controller sends the first information to each of the slave devices in a cyclic manner according to the preset timing communication data to obtain the second information corresponding to the feedback of each slave device; wherein the timing communication data includes a communication cycle consisting of multiple time periods; if the communication mode is an on-demand communication mode, the first controller obtains the third information from the slave device and sends the corresponding fourth information to the corresponding slave device.

[0070] In some embodiments, when the processor 802 implements the step of the first controller sending the first information to each of the slave devices in turn and cyclically according to the preset timing communication data, it is specifically used to:

[0071] The first controller confirms the time period corresponding to the current time based on the cycle start time, cycle end time and time period information in the timing communication data of the current communication cycle; wherein each time period in the communication cycle is configured with corresponding device information; the first controller generates corresponding first information based on the device information corresponding to the current time period and sends it to the corresponding slave device.

[0072] In some embodiments, before implementing the step of confirming the time period corresponding to the current time, the processor 802 is further configured to:

[0073] If the current time reaches the cycle end time, the first controller enters the next communication cycle and uses the cycle end time as the cycle start time of the next communication cycle.

[0074] The processor 802 is further configured to run a computer program 8032 stored in the memory to implement the following steps:

[0075] When the communication mode is the on-demand communication mode, the second controller determines whether the collected real-time data meets the information request condition; if so, the second controller generates corresponding third information according to the real-time data and sends it to the host device.

[0076] In some embodiments, after implementing the step of the second controller generating corresponding third information according to the real-time data and sending the third information to the host device, the processor 802 is further configured to:

[0077] If the fourth message from the host device is not received within the preset response waiting time, the second controller resends the third message to the host device.

[0078] In some embodiments, before implementing the step of the second controller generating corresponding third information according to the real-time data and sending the third information to the host device, the processor 802 is further configured to:

[0079] The second controller detects the UART serial port to obtain the transmission status of the UART serial port; if the transmission status is a busy state, the second controller returns to execute the step of detecting the UART serial port after delaying a preset waiting time.

[0080] In some embodiments, after implementing the step of the second controller detecting the UART serial port to obtain the transmission status of the UART serial port, the processor 802 is further configured to:

[0081] If the transmission state is an idle state, the second controller generates corresponding third information according to the real-time data and sends the third information to the host device.

[0082] It should be understood that in the embodiment of the present invention, the processor 802 may be a central processing unit (CPU), and the processor 802 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0083] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.

[0084] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the following steps:

[0085] If the communication mode is a time-sharing communication mode, the first controller sends the first information to each of the slave devices in a cyclic manner according to the preset timing communication data to obtain the second information corresponding to the feedback of each slave device; wherein the timing communication data includes a communication cycle consisting of multiple time periods; if the communication mode is an on-demand communication mode, the first controller obtains the third information from the slave device and sends the corresponding fourth information to the corresponding slave device.

[0086] In one embodiment, when the processor executes the program instructions to implement the step of the first controller sending the first information to each of the slave devices in a cyclic manner according to the preset timing communication data, it is specifically used to:

[0087] The first controller confirms the time period corresponding to the current time based on the cycle start time, cycle end time and time period information in the timing communication data of the current communication cycle; wherein each time period in the communication cycle is configured with corresponding device information; the first controller generates corresponding first information based on the device information corresponding to the current time period and sends it to the corresponding slave device.

[0088] In one embodiment, before executing the program instructions to implement the step of confirming the time period corresponding to the current time, the processor is further configured to:

[0089] If the current time reaches the cycle end time, the first controller enters the next communication cycle and uses the cycle end time as the cycle start time of the next communication cycle.

[0090] When the program instructions are executed by the processor, the processor also performs the following steps:

[0091] When the communication mode is the on-demand communication mode, the second controller determines whether the collected real-time data meets the information request condition; if so, the second controller generates corresponding third information according to the real-time data and sends it to the host device.

[0092] In one embodiment, after executing the program instructions to implement the step of the second controller generating corresponding third information according to the real-time data and sending the third information to the host device, the processor is further configured to:

[0093] If the fourth message from the host device is not received within the preset response waiting time, the second controller resends the third message to the host device.

[0094] In one embodiment, before the processor executes the program instructions to implement the step of the second controller generating corresponding third information according to the real-time data and sending the third information to the host device, the processor is further configured to:

[0095] The second controller detects the UART serial port to obtain the transmission status of the UART serial port; if the transmission status is a busy state, the second controller returns to execute the step of detecting the UART serial port after delaying a preset waiting time.

[0096] In one embodiment, after executing the program instructions to implement the step of the second controller detecting the UART serial port to obtain the transmission status of the UART serial port, the processor is further configured to:

[0097] If the transmission state is an idle state, the second controller generates corresponding third information according to the real-time data and sends the third information to the host device.

[0098] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.

[0099] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0100] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0101] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0102] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling an electronic device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.

[0103] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A UART serial port multiplexing method, characterized in that: The method is applied to an intelligent communication system, wherein the intelligent communication system includes a host device and at least one slave device, wherein a first controller of the host device is communicatively connected with a second controller of each slave device via a same UART serial port, and the method includes the following steps performed by the first controller: If the communication mode is a time-sharing communication mode, the first controller cyclically sends the first information to each of the slave devices in turn according to the preset timing communication data to obtain the second information corresponding to the feedback of each of the slave devices; wherein the timing communication data includes a communication cycle consisting of a plurality of time periods; If the communication mode is the on-demand communication mode, the first controller obtains the third information from the slave device and sends the corresponding fourth information to the corresponding slave device.

2. The UART serial port multiplexing method according to claim 1, characterized in that: The first controller sends first information to each of the slave devices in turn and cyclically according to preset timing communication data, including: The first controller confirms the time period corresponding to the current time according to the cycle start time and cycle end time of the current communication cycle and the time period information in the sequential communication data; wherein each time period in the communication cycle is configured with corresponding device information; The first controller generates corresponding first information according to the device information corresponding to the current time period and sends the first information to the corresponding slave device.

3. The UART serial port multiplexing method according to claim 2, characterized in that: Before confirming the time period corresponding to the current time, the method further includes: If the current time reaches the cycle end time, the first controller enters the next communication cycle and uses the cycle end time as the cycle start time of the next communication cycle.

4. The UART serial port multiplexing method according to claim 1, characterized in that: The method comprises the following steps performed by the second controller: When the communication mode is the on-demand communication mode, the second controller determines whether the collected real-time data meets the information request condition; If satisfied, the second controller generates corresponding third information according to the real-time data and sends it to the host device.

5. The UART serial port multiplexing method according to claim 4, characterized in that: After the second controller generates corresponding third information according to the real-time data and sends the third information to the host device, the method further includes: If the fourth information from the host device is not received within the preset response waiting time, the second controller resends the third information to the host device.

6. The UART serial port multiplexing method according to claim 4, characterized in that: Before the second controller generates corresponding third information according to the real-time data and sends the third information to the host device, the second controller further includes: The second controller detects the UART serial port to obtain a transmission status of the UART serial port; If the transmission status is a busy state, the method returns to the step of detecting the UART serial port after a preset waiting time.

7. The UART serial port multiplexing method according to claim 6, characterized in that: After the second controller detects the UART serial port to obtain the transmission status of the UART serial port, the second controller further includes: If the transmission state is an idle state, the second controller generates corresponding third information according to the real-time data and sends the third information to the host device.

8. A UART serial port multiplexing device, characterized in that: The device is configured in an intelligent communication system, the intelligent communication system includes a host device and at least one slave device, the first controller of the host device is communicatively connected with the second controller of each slave device through the same UART serial port, and the device includes the following units configured in the first controller of the intelligent communication system: A first control unit, for, if the communication mode is a time-sharing communication mode, the first controller sequentially and cyclically sends first information to each of the slave devices according to preset timing communication data to obtain second information corresponding to feedback from each of the slave devices; wherein the timing communication data includes a communication cycle consisting of a plurality of time periods; The second control unit is used for, if the communication mode is the on-demand communication mode, the first controller to obtain the third information from the slave device and send the corresponding fourth information to the corresponding slave device.

9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method according to any one of claims 1 to 7 can be implemented.