A two-in-one communication method and system based on one-line communication and USART

By analyzing the signal characteristics in the device interface circuit and controlling the sending circuit according to the baud rate, two-in-one communication of one-line and USART is realized, which solves the problems of complex switching, high resource occupation and poor compatibility in the existing technology, and improves communication stability and rate balance.

CN119788763BActive Publication Date: 2025-10-03深圳市华芯控股有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510280333.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-11
Publication Date
2025-10-03
Estimated Expiration
2045-03-11

AI Technical Summary

Technical Problem

In the existing technology, the communication mode switching between the one-line communication and the USART is complex, resource occupancy is high, data compatibility is poor, communication stability is low, and there is a lack of balanced control between rate and stability.

Method used

When the device signal receiving circuit in the device interface circuit receives the signal of the communication device, the device signal sending circuit is controlled to be disconnected, the signal characteristics are analyzed to determine whether it is a one-line signal or a USART signal, and the sending circuit is controlled to turn on the corresponding communication mode according to the signal baud rate.

Benefits of technology

It realizes simple communication mode switching, reduces resource usage, improves data compatibility and communication stability, and achieves balanced control of rate and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119788763B_ABST
    Figure CN119788763B_ABST
Patent Text Reader

Abstract

The present invention relates to technical fields such as communication technology, and provides a two-in-one communication method and system based on a one-line communication and a USART. The method and system obtain a device signal connected to a device signal receiving circuit for analysis, determine whether the device signal is a one-line communication signal or a USART signal, determine the signal baud rate of the one-line communication signal after obtaining the specific signal baud rate of the one-line communication signal, control a device signal sending circuit of a device interface circuit to be turned on, and send the one-line communication signal with the specific signal baud rate to a communication device, and determine the signal baud rate of the USART signal after obtaining the specific signal baud rate of the USART signal, control a device signal sending circuit of the device interface circuit to be turned on, and send the USART signal with the specific signal baud rate to the communication device, thereby realizing two-in-one communication of the one-line communication and the USART, making communication mode switching simple, reducing resource occupation, and improving data compatibility.
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 composite communication method and system combining a Single-Wire Interface (SIF) and a Universal Synchronous / Asynchronous Receiver / Transmitter (USART). Background Art

[0002] The One-Line protocol enables inter-device communication over a single wire, offering the advantages of low hardware resource consumption and low cost. However, its communication rate is relatively low and it typically uses a simplex communication mode, making it suitable for scenarios with small data volumes and low communication quality requirements. USART, a widely used hardware interface for serial communication, supports full-duplex communication, features high data transfer rates, and flexible configuration. However, USART requires two data lines (TX and RX) for communication, which consumes relatively high hardware resources. Existing technologies use separate hardware methods for One-Line and USART, often resulting in low communication efficiency, complex switching mechanisms, high resource usage, and compatibility issues.

[0003] In summary, the existing communication technologies of Yixiantong and USART have technical problems such as complex communication mode switching, high resource usage, poor data compatibility, low communication stability, and lack of balanced control between communication rate and stability. Summary of the Invention

[0004] In view of the shortcomings of the above-mentioned prior art, the present invention provides a two-in-one communication method and system based on one-line communication and USART to realize two-in-one communication of one-line communication and USART, so as to simplify communication mode switching, reduce resource occupation, improve data compatibility, improve communication stability, and achieve balanced control of communication rate and stability.

[0005] In a first aspect, the present invention provides a two-in-one communication method based on a one-line communication and a USART, comprising:

[0006] When a device signal receiving circuit of a device interface circuit receives a device signal of a communication device, the device signal sending circuit of the device interface circuit is controlled to be disconnected, and the device signal received by the device signal receiving circuit is obtained. After obtaining the device signal, a signal feature of the device signal is analyzed to determine whether the obtained device signal is a one-line signal or a USART signal.

[0007] After obtaining that the device signal is a one-line signal, determining the signal baud rate of the one-line signal, and after obtaining the specific signal baud rate of the one-line signal, controlling the device signal sending circuit of the device interface circuit to be turned on, and sending the one-line signal with the specific signal baud rate to the communication device;

[0008] After obtaining that the device signal is a USART signal, the signal baud rate of the USART signal is determined. After obtaining the specific signal baud rate of the USART signal, the device signal sending circuit of the device interface circuit is controlled to be turned on, and the USART signal with the specific signal baud rate is sent to the communication device.

[0009] In a second aspect, the present invention provides a two-in-one communication system based on a one-line communication and a USART, comprising:

[0010] The device interface circuit includes a device signal receiving circuit and a device signal transmitting circuit; the device signal receiving circuit is used to access the device signal of the communication device, and the device signal transmitting circuit is used to send a USART signal or a one-line signal with a specific signal baud rate to the communication device;

[0011] A microcontroller running a two-in-one communication method based on a one-line communication and a USART.

[0012] Compared with the prior art, the present invention has the following beneficial effects:

[0013] The present invention provides a two-in-one communication method and system based on a one-line communication and a USART. When a device signal receiving circuit of a device interface circuit receives a device signal of a communication device, the device signal sending circuit of the device interface circuit is controlled to be disconnected, and the device signal received by the device signal receiving circuit is obtained. After the device signal is obtained, the signal characteristics of the device signal are analyzed to determine whether the obtained device signal is a one-line communication signal or a USART signal. After determining that the device signal is a one-line communication signal, the signal baud rate of the one-line communication signal is determined. After obtaining the specific signal baud rate of the one-line communication signal, the device signal sending circuit of the device interface circuit is controlled to be turned on, and the one-line communication signal with the specific signal baud rate is sent to the communication device. After determining that the device signal is a USART signal, the signal baud rate of the USART signal is determined. After obtaining the specific signal baud rate of the USART signal, the device signal sending circuit of the device interface circuit is controlled to be turned on, and the USART signal with the specific signal baud rate is sent to the communication device, thereby achieving two-in-one communication of the one-line communication and the USART, simplifying communication mode switching, reducing resource occupation, and improving data compatibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their description are used to explain the present invention and do not constitute an undue limitation of the present invention. Some specific embodiments of the present invention will be described in detail in an illustrative and non-restrictive manner with reference to the drawings. The same reference numerals in the drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the drawings:

[0015] Figure 1 This is a flow chart of a two-in-one communication method based on a one-line communication and USART according to an embodiment of the present invention;

[0016] Figure 2 The present invention is a structural diagram of a two-in-one communication system based on a one-line communication and a USART.

[0017] Description of reference numerals:

[0018] 100, device connection circuit; 200, short-circuit current limiting protection circuit; 300, device signal receiving circuit; 400, device signal sending circuit. DETAILED DESCRIPTION

[0019] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the embodiments described are only 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 making creative efforts should fall within the scope of protection of the present invention.

[0020] Example 1

[0021] See also Figure 1-Figure 2 This embodiment provides a two-in-one communication method based on a one-line communication and a USART, comprising the following steps:

[0022] S101. When a device signal receiving circuit of a device interface circuit receives a device signal of a communication device, controlling the device signal sending circuit of the device interface circuit to be disconnected, and obtaining the device signal received by the device signal receiving circuit. After obtaining the device signal, analyzing a signal feature of the device signal to determine whether the obtained device signal is a one-line signal or a USART signal.

[0023] S102: after determining that the device signal is a one-line signal, determining the signal baud rate of the one-line signal, and after obtaining the specific signal baud rate of the one-line signal, controlling the device signal sending circuit of the device interface circuit to be turned on, and sending the one-line signal having the specific signal baud rate to the communication device;

[0024] S103. After obtaining that the device signal is a USART signal, determine the signal baud rate of the USART signal. After obtaining the specific signal baud rate of the USART signal, control the device signal sending circuit of the device interface circuit to be turned on, and send the USART signal with the specific signal baud rate to the communication device.

[0025] It should be noted that in this embodiment, when the device signal receiving circuit of the device interface circuit receives the device signal of the communication device, the device signal transmitting circuit of the device interface circuit is controlled to be disconnected, and the device signal received by the device signal receiving circuit is obtained. After obtaining the device signal, the signal characteristics of the device signal are analyzed to determine whether the obtained device signal is a one-line signal or a USART signal. After determining that the device signal is a one-line signal, the signal baud rate of the one-line signal is determined. After obtaining the specific signal baud rate of the one-line signal, the device signal transmitting circuit of the device interface circuit is controlled to be turned on, and the one-line signal with the specific signal baud rate is sent to the communication device. After determining that the device signal is a USART signal, the signal baud rate of the USART signal is determined. After obtaining the specific signal baud rate of the USART signal, the device signal transmitting circuit of the device interface circuit is controlled to be turned on, and the USART signal with the specific signal baud rate is sent to the communication device, thereby achieving two-in-one communication of one-line and USART, making communication mode switching simple, reducing resource usage, and improving data compatibility.

[0026] It should also be noted that when parsing the signal characteristics of the device signal to determine whether the acquired device signal is a one-line signal or a USART signal, different signal characteristics of the device signal can be parsed, thereby determining whether the acquired device signal is a one-line signal or a USART signal based on the specific signal characteristics of the device signal obtained by parsing. Specifically, parsing the signal characteristics of the device signal to determine whether the acquired device signal is a one-line signal or a USART signal can include: parsing the synchronization signal characteristics of the device signal to obtain the synchronization signal characteristics of the device signal; and after obtaining the synchronization signal characteristics of the device signal, determining whether the acquired device signal is a one-line signal or a USART signal based on the synchronization signal characteristics of the device signal. Specifically, parsing the signal characteristics of the device signal to determine whether the acquired device signal is a one-line signal or a USART signal may include: parsing the data level characteristics of the device signal to obtain the data level characteristics of the device signal; after obtaining the data level characteristics of the device signal, determining whether the acquired device signal is a one-line signal or a USART signal based on the data level characteristics of the device signal. Specifically, parsing the signal characteristics of the device signal to determine whether the acquired device signal is a one-line signal or a USART signal may include: parsing the stop signal characteristics of the device signal to obtain the stop signal characteristics of the device signal; after obtaining the stop signal characteristics of the device signal, determining whether the acquired device signal is a one-line signal or a USART signal based on the stop signal characteristics of the device signal.

[0027] It should also be noted that when parsing the signal characteristics of the device signal to determine whether the acquired device signal is a one-line signal or a USART signal, multiple different signal characteristics of the device signal can be parsed, thereby determining whether the acquired device signal is a one-line signal or a USART signal based on the multiple specific signal characteristics of the device signal obtained through the analysis. In some preferred embodiments, parsing the signal characteristics of the device signal to determine whether the acquired device signal is a one-line signal or a USART signal can include: parsing the data level characteristics and stop signal characteristics of the device signal to obtain the data level characteristics and stop signal characteristics of the device signal; after obtaining the data level characteristics and stop signal characteristics of the device signal, determining whether the acquired device signal is a one-line signal or a USART signal based on the data level characteristics and stop signal characteristics of the device signal. It should be noted that in this embodiment, by analyzing the data level characteristics and stop signal characteristics of the device signal to obtain the data level characteristics and stop signal characteristics of the device signal, after obtaining the data level characteristics and stop signal characteristics of the device signal, determining whether the acquired device signal is a one-line signal or a USART signal based on the data level characteristics and stop signal characteristics of the device signal, compared to the analysis and determination method based on the data level characteristics or stop signal characteristics alone, communication stability can be improved, and communication rate and stability can be balanced. In other preferred embodiments, analyzing the signal characteristics of the device signal to determine whether the acquired device signal is a one-line signal or a USART signal can include: analyzing the synchronization signal characteristics and stop signal characteristics of the device signal to obtain the synchronization signal characteristics and stop signal characteristics of the device signal; after obtaining the synchronization signal characteristics and stop signal characteristics of the device signal, determining whether the acquired device signal is a one-line signal or a USART signal based on the synchronization signal characteristics and stop signal characteristics of the device signal. It should be noted that, in this embodiment, the synchronization signal characteristics and the stop signal characteristics of the device signal are analyzed to obtain the synchronization signal characteristics and the stop signal characteristics of the device signal. After obtaining the synchronization signal characteristics and the stop signal characteristics of the device signal, it is determined whether the acquired device signal is a one-line signal or a USART signal based on the synchronization signal characteristics and the stop signal characteristics of the device signal. Compared with the analysis and judgment method of the synchronization signal characteristics or the stop signal characteristics alone, the communication stability can be improved, and the communication rate and stability can be balanced and controlled.In some other preferred embodiments, parsing the signal characteristics of the device signal to determine whether the acquired device signal is a one-line signal or a USART signal may include: parsing the synchronization signal characteristics and data level characteristics of the device signal to obtain the synchronization signal characteristics and data level characteristics of the device signal; and after obtaining the synchronization signal characteristics and data level characteristics of the device signal, determining whether the acquired device signal is a one-line signal or a USART signal based on the synchronization signal characteristics and data level characteristics of the device signal. It should be noted that in this embodiment, by parsing the synchronization signal characteristics and data level characteristics of the device signal to obtain the synchronization signal characteristics and data level characteristics of the device signal, and after obtaining the synchronization signal characteristics and data level characteristics of the device signal, determining whether the acquired device signal is a one-line signal or a USART signal based on the synchronization signal characteristics and data level characteristics of the device signal, compared to a method of parsing and determining the synchronization signal characteristics or data level characteristics alone, communication stability can be improved, allowing for balanced control of communication rate and stability.

[0028] In some further preferred embodiments, parsing the signal characteristics of the device signal to determine whether the acquired device signal is a one-line signal or a USART signal may include: parsing the synchronization signal characteristics, data level characteristics, and stop signal characteristics of the device signal to obtain the synchronization signal characteristics, data level characteristics, and stop signal characteristics of the device signal; after obtaining the synchronization signal characteristics, data level characteristics, and stop signal characteristics of the device signal, determining whether the acquired device signal is a one-line signal or a USART signal based on the synchronization signal characteristics, data level characteristics, and stop signal characteristics of the device signal. It should be noted that in this embodiment, the synchronization signal characteristics, data level characteristics, and stop signal characteristics of the device signal are analyzed to obtain the synchronization signal characteristics, data level characteristics, and stop signal characteristics of the device signal. After obtaining the synchronization signal characteristics, data level characteristics, and stop signal characteristics of the device signal, the acquired device signal is judged to be a one-line signal or a USART signal based on the synchronization signal characteristics, data level characteristics, and stop signal characteristics of the device signal. Compared with the analysis and judgment method based on the synchronization signal characteristics or data level characteristics alone, communication stability can be improved, and communication rate and stability can be balanced. Compared with the analysis and judgment method based on any two of the synchronization signal characteristics, data level characteristics, and stop signal characteristics of the device signal, optimal communication stability can be achieved, greatly reducing the communication error rate.

[0029] In some preferred embodiments, after obtaining that the device signal is a one-line signal, if it is determined that the one-line signal is a one-line signal with a baud rate of 9600, the device signal sending circuit of the device interface circuit is controlled to be turned on, and the one-line signal with a baud rate of 9600 is sent to the communication device; after obtaining that the device signal is a USART signal, if it is determined that the USART signal is a USART signal with a baud rate of 9600, the device signal sending circuit of the device interface circuit is controlled to be turned on, and the USART signal with a baud rate of 9600 is sent to the communication device. In some other preferred embodiments, after obtaining that the device signal is a one-line signal, if it is determined that the one-line signal is a one-line signal with a baud rate of 11520, the device signal sending circuit of the device interface circuit is controlled to be turned on, and the one-line signal with a baud rate of 11520 is sent to the communication device; after obtaining that the device signal is a USART signal, if it is determined that the USART signal is a USART signal with a baud rate of 11520, the device signal sending circuit of the device interface circuit is controlled to be turned on, and the USART signal with a baud rate of 11520 is sent to the communication device. It should be noted that, in this embodiment, by determining the specific baud rate of the device signal, and then controlling the device signal sending circuit of the device interface circuit to be turned on, a device signal of a specific baud rate is sent to the communication device. For example, a USART signal of 11520 baud rate is sent to the communication device, a USART signal of 9600 baud rate is sent to the communication device, a one-line signal of 11520 baud rate is sent to the communication device, a one-line signal of 9600 baud rate is sent to the communication device, etc., thereby realizing the communication needs of the specific device.

[0030] In some further preferred embodiments, the device interface circuit includes a device connection circuit, a short-circuit current limiting protection circuit, a device signal receiving circuit and a device signal sending circuit; the device connection circuit is electrically connected to the short-circuit current limiting protection circuit, and the short-circuit current limiting protection circuit is electrically connected to the device signal receiving circuit and the device signal sending circuit; after the device connection circuit is connected to the communication device, the device signal of the communication device passes through the short-circuit current limiting protection of the short-circuit current limiting protection circuit and is connected to the device signal receiving circuit. When the device signal receiving circuit is connected to the device signal of the communication device, the device signal sending circuit is disconnected according to the disconnection control signal issued by the microcontroller; the device signal sending circuit is turned on according to the conduction control signal issued by the microcontroller, and sends a one-line signal with a specific signal baud rate or a USART signal with a specific signal baud rate to the communication device through the short-circuit current limiting protection circuit and the device connection circuit. Specifically, the device connection circuit includes a pull-up resistor R6 and a diode D1; one end of the pull-up resistor R6 is connected to the power supply VDD, and the other end of the pull-up resistor R6 is connected to the anode of the diode D1 as the connection end for connecting to the communication device; the cathode of the diode D1 is electrically connected to the short-circuit current limiting protection circuit. The short-circuit current limiting protection circuit includes a fuse FUSE, one end of the fuse FUSE is electrically connected to the cathode of the diode D1, and the other end of the fuse FUSE is connected to the device signal receiving circuit and the device signal sending circuit; the device signal receiving circuit includes a resistor R4, an optocoupler U2B and a resistor R5; one end of the resistor R4 is connected to the device signal of the communication device, the other end of the resistor R4 is connected to the first end of the optocoupler U2B, the second end of the optocoupler U2B is connected to the power supply VCC, the third end of the optocoupler U2B is connected to the ground, the fourth end of the optocoupler U2B is connected to one end of the resistor R5 and the microcontroller, the microcontroller obtains the device signal through the connection end connected between the fourth end of the optocoupler U2B and the resistor R5, and the other end of the resistor R5 is grounded.The device signal sending circuit includes a resistor R2, a resistor R1, a transistor Q1, a resistor R3 and a photocoupler U1A; one end of the resistor R2 is connected to the microcontroller for receiving a disconnection control signal or a conduction control signal issued by the microcontroller; the other end of the resistor R2 is connected to one end of the resistor R1, the other end of the resistor R1 is connected to the base of the transistor Q1, the emitter of the transistor Q1 is connected to the power supply VCC, the collector of the transistor Q1 is connected to one end of the resistor R3, the other end of the resistor R3 is connected to the first end of the photocoupler U1A, the third end of the photocoupler U1A is grounded, the fourth end of the photocoupler U1A is grounded, and the second end of the photocoupler U1A is connected to the short-circuit current limiting protection circuit; after the resistor R2 receives the disconnection control signal issued by the microcontroller, the transistor Q1 is disconnected and the photocoupler U1A is disconnected; after the resistor R2 receives the conduction control signal issued by the microcontroller, the transistor Q1 is turned on and the photocoupler U1A is turned on. It should be noted that in this embodiment, by simultaneously being compatible with the one-line signal and the USART signal on the same interface, hardware resources, the number of ports, and PCB space can be greatly saved, reducing the cost of communication between the one-line signal and the USART signal. In addition, the microcontroller only needs to analyze the received signal in the initial stage to determine which communication protocol the current external device uses, without the need for manual or additional jumpers or switches to switch modes, greatly reducing the complexity of use. The compatibility of signals from devices with different baud rates can improve the compatibility and adaptability to different peripherals or different speed requirements when communicating with the one-line signal and the USART signal. The fuse can provide protection in the event of an abnormal short circuit to prevent damage to the subsequent circuit; combined with the electrical isolation of the optocoupler, the overall stability and safety are higher. The optocoupler can effectively block high voltage or noise from coupling to the core circuit, improving the system's anti-interference and reliability.

[0031] Example 2

[0032] See also Figure 1-Figure 2 This embodiment provides a two-in-one communication system based on a one-line communication and a USART, including:

[0033] The device interface circuit includes a device signal receiving circuit and a device signal transmitting circuit; the device signal receiving circuit is used to access the device signal of the communication device, and the device signal transmitting circuit is used to send a USART signal or a one-line signal with a specific signal baud rate to the communication device;

[0034] A microcontroller, configured to execute any one of the two-in-one communication methods based on a one-line communication and a USART in Example 1, controls the device signal transmitting circuit of the device interface circuit to be disconnected when a device signal receiving circuit of the device interface circuit receives a device signal of a communication device, obtains the device signal received by the device signal receiving circuit, analyzes the signal characteristics of the device signal after obtaining the device signal to determine whether the obtained device signal is a one-line communication signal or a USART signal, determines the signal baud rate of the one-line communication signal after determining the device signal is a one-line communication signal, and controls the device signal transmitting circuit of the device interface circuit to be turned on after obtaining the specific signal baud rate of the one-line communication signal, thereby transmitting the one-line communication signal with the specific signal baud rate to the communication device, and controls the device signal transmitting circuit of the device interface circuit to be turned on after determining the device signal is a USART signal, thereby transmitting the USART signal with the specific signal baud rate to the communication device, thereby achieving two-in-one communication of one-line communication and USART, simplifying communication mode switching, reducing resource usage, and improving data compatibility. The device interface circuit may further include a device connection circuit and a short-circuit current limiting protection circuit; the device connection circuit is electrically connected to the short-circuit current limiting protection circuit, which is electrically connected to the device signal receiving circuit and the device signal transmitting circuit; after the device connection circuit is connected to the communication device, the device signal of the communication device passes through the short-circuit current limiting protection of the short-circuit current limiting protection circuit and is connected to the device signal receiving circuit; when the device signal receiving circuit receives the device signal of the communication device, the device signal transmitting circuit is disconnected according to a disconnection control signal issued by the microcontroller; the device signal transmitting circuit is turned on according to a conduction control signal issued by the microcontroller, and transmits a one-line signal with a specific signal baud rate or a USART signal with a specific signal baud rate to the communication device through the short-circuit current limiting protection circuit and the device connection circuit. Specifically, the device connection circuit includes a pull-up resistor R6 and a diode D1; one end of the pull-up resistor R6 is connected to the power supply VDD, and the other end of the pull-up resistor R6 is connected to the anode of the diode D1 as the connection end for connecting to the communication device; the cathode of the diode D1 is electrically connected to the short-circuit current limiting protection circuit.The short-circuit current limiting protection circuit includes a fuse FUSE, one end of the fuse FUSE is electrically connected to the cathode of the diode D1, and the other end of the fuse FUSE is connected to the device signal receiving circuit and the device signal sending circuit; the device signal receiving circuit includes a resistor R4, a photocoupler U2B and a resistor R5; one end of the resistor R4 is connected to the device signal of the communication device, the other end of the resistor R4 is connected to the first end of the photocoupler U2B, the second end of the photocoupler U2B is connected to the power supply VCC, the third end of the photocoupler U2B is connected to the ground, the fourth end of the photocoupler U2B is connected to one end of the resistor R5 and the microcontroller, the microcontroller obtains the device signal through the connection end where the fourth end of the photocoupler U2B and the resistor R5 are connected, and the other end of the resistor R5 is grounded. The device signal sending circuit includes a resistor R2, a resistor R1, a transistor Q1, a resistor R3 and a photocoupler U1A; one end of the resistor R2 is connected to the microcontroller for receiving a disconnection control signal or a conduction control signal issued by the microcontroller; the other end of the resistor R2 is connected to one end of the resistor R1, the other end of the resistor R1 is connected to the base of the transistor Q1, the emitter of the transistor Q1 is connected to the power supply VCC, the collector of the transistor Q1 is connected to one end of the resistor R3, the other end of the resistor R3 is connected to the first end of the photocoupler U1A, the third end of the photocoupler U1A is grounded, the fourth end of the photocoupler U1A is grounded, and the second end of the photocoupler U1A is connected to the short-circuit current limiting protection circuit; after the resistor R2 receives the disconnection control signal issued by the microcontroller, the transistor Q1 is disconnected and the photocoupler U1A is disconnected; after the resistor R2 receives the conduction control signal issued by the microcontroller, the transistor Q1 is turned on and the photocoupler U1A is turned on. It should be noted that in this embodiment, by simultaneously being compatible with the one-line signal and the USART signal on the same interface, hardware resources, the number of ports, and PCB space can be greatly saved, reducing the cost of communication between the one-line signal and the USART signal. In addition, the microcontroller only needs to analyze the received signal in the initial stage to determine which communication protocol the current external device uses, without the need for manual or additional jumpers or switches to switch modes, greatly reducing the complexity of use. The compatibility of signals from devices with different baud rates can improve the compatibility and adaptability to different peripherals or different speed requirements when communicating with the one-line signal and the USART signal. The fuse can provide protection in the event of an abnormal short circuit to prevent damage to the subsequent circuit; combined with the electrical isolation of the optocoupler, the overall stability and safety are higher. The optocoupler can effectively block high voltage or noise from coupling to the core circuit, improving the system's anti-interference and reliability.

[0035] It should be pointed out that the above embodiments are only preferred specific implementation methods of the present invention, and the protection scope of the present invention is not limited thereto. Any changes or replacements that can be easily thought of by any technician familiar with this technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention. The protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A two-in-one communication method based on a one-line communication and USART, characterized in that: include: When a device signal receiving circuit of a device interface circuit receives a device signal of a communication device, the device signal sending circuit of the device interface circuit is controlled to be disconnected, and the device signal received by the device signal receiving circuit is obtained. After obtaining the device signal, a signal feature of the device signal is analyzed to determine whether the obtained device signal is a one-line signal or a USART signal. The signal characteristics of the device signal are parsed to determine whether the acquired device signal is a one-line signal or a USART signal, including: parsing the synchronization signal characteristics, data level characteristics and stop signal characteristics of the device signal to obtain the synchronization signal characteristics, data level characteristics and stop signal characteristics of the device signal; after obtaining the synchronization signal characteristics, data level characteristics and stop signal characteristics of the device signal, determining whether the acquired device signal is a one-line signal or a USART signal according to the synchronization signal characteristics, data level characteristics and stop signal characteristics of the device signal; the device interface circuit includes a device connection circuit, a short-circuit current limiting protection circuit, a device signal receiving circuit and a device signal sending circuit; the device connection circuit The short-circuit current limiting protection circuit is electrically connected to the device signal receiving circuit and the device signal sending circuit; after the device connection circuit is connected to the communication device, the device signal of the communication device passes through the short-circuit current limiting protection of the short-circuit current limiting protection circuit and is connected to the device signal receiving circuit. When the device signal receiving circuit is connected to the device signal of the communication device, the device signal sending circuit is disconnected according to the disconnection control signal issued by the microcontroller; the device signal sending circuit is turned on according to the conduction control signal issued by the microcontroller, and sends a one-line signal with a specific signal baud rate or a USART signal with a specific signal baud rate to the communication device through the short-circuit current limiting protection circuit and the device connection circuit; After obtaining that the device signal is a one-line signal, determining the signal baud rate of the one-line signal, and after obtaining the specific signal baud rate of the one-line signal, controlling the device signal sending circuit of the device interface circuit to be turned on, and sending the one-line signal with the specific signal baud rate to the communication device; After obtaining that the device signal is a USART signal, the signal baud rate of the USART signal is determined. After obtaining the specific signal baud rate of the USART signal, the device signal sending circuit of the device interface circuit is controlled to be turned on, and the USART signal with the specific signal baud rate is sent to the communication device.

2. The two-in-one communication method based on one-line communication and USART as claimed in claim 1, characterized in that: After obtaining that the device signal is a one-line signal, if it is determined that the one-line signal is a one-line signal with a baud rate of 9600, the device signal sending circuit of the device interface circuit is controlled to be turned on, and the one-line signal with a baud rate of 9600 is sent to the communication device; after obtaining that the device signal is a USART signal, if it is determined that the USART signal is a USART signal with a baud rate of 9600, the device signal sending circuit of the device interface circuit is controlled to be turned on, and the USART signal with a baud rate of 9600 is sent to the communication device.

3. The two-in-one communication method based on one-line communication and USART as claimed in claim 1, characterized in that: After obtaining that the device signal is a one-line signal, if it is determined that the one-line signal is a one-line signal with a baud rate of 11520, the device signal sending circuit of the device interface circuit is controlled to be turned on, and the one-line signal with a baud rate of 11520 is sent to the communication device; after obtaining that the device signal is a USART signal, if it is determined that the USART signal is a USART signal with a baud rate of 11520, the device signal sending circuit of the device interface circuit is controlled to be turned on, and the USART signal with a baud rate of 11520 is sent to the communication device.

4. A two-in-one communication system based on a one-line communication and USART, characterized in that: include: The device interface circuit includes a device signal receiving circuit and a device signal transmitting circuit; the device signal receiving circuit is used to access the device signal of the communication device, and the device signal transmitting circuit is used to send a USART signal or a one-line signal with a specific signal baud rate to the communication device; A microcontroller runs the two-in-one communication method based on one-line communication and USART according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Method and communication system compatible with integrated service digital network (SDN) communication and inter-integrated circuit (I2C) communication

    CN118740957A