Communication circuit, communication method and communication equipment

By designing circuits for multiple communication modules and chip selection in communication equipment and using MCU to control the selection of the appropriate communication module, the problem of wrong wiring when switching modes of communication equipment is solved, and automatic matching and efficient communication are achieved.

CN115268313BActive Publication Date: 2025-09-05GREE ELECTRIC APPLIANCE INC OF ZHUHAI
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210738010.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-27
Publication Date
2025-09-05
Estimated Expiration
2042-06-27

AI Technical Summary

Technical Problem

When switching communication modes, existing communication equipment is prone to misconnection due to unclear interface identification, resulting in communication failure.

Method used

A communication circuit is designed, which includes at least three communication modules and two selection chips. The microcontroller MCU controls the selection chip to select the appropriate communication module for communication, and automatically matches the module using test signals and feedback results.

Benefits of technology

This avoids the problem of wrong line connection when switching communication modes and improves communication efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115268313B_ABST
    Figure CN115268313B_ABST
Patent Text Reader

Abstract

The present invention discloses a communication circuit, a communication method, and a communication device. The communication circuit is arranged in a first communication device, and includes: at least three communication modules, one end of each communication module being connected to one end of a first selection chip and one end of a second selection chip, and the other end being connected to a communication bus; the first selection chip, the other end of which is connected to a communication terminal, the communication terminal being used to connect to a second communication device; the second selection chip, the other end of which is connected to the communication terminal; and a microcontroller MCU, which is respectively connected to the first selection chip, the second selection chip, and the communication bus, and is used to select one of the communication modules for communication through the first selection chip and the second selection chip. The present invention can avoid the problem of communication errors caused by wrong wiring when switching communication modes, thereby improving communication efficiency.
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 communication circuit, a communication method and a communication device. Background Art

[0002] Currently, communication between devices can be achieved using a variety of different communication modes. These modes vary in their coverage area, ranging from short-distance to long-distance. While these modes are compatible in software, they are not yet compatible in hardware. Furthermore, when switching modes, it is easy to misconnect cables due to confusion about interfaces, leading to communication failures, wasted time, and reduced efficiency.

[0003] Currently, no effective solution has been proposed to the problem that, when switching communication modes, communication equipment in the prior art is prone to incorrectly connecting wires due to unclear interfaces, resulting in communication failures. Summary of the Invention

[0004] The embodiments of the present invention provide a communication circuit, a communication method and a communication device to solve the problem in the prior art that when switching communication modes, the communication device is prone to misconnection due to unclear interface identification, resulting in communication failure.

[0005] To solve the above technical problems, the present invention provides a communication circuit, which is provided in a first communication device and includes:

[0006] At least three communication modules, one end of each communication module is connected to one end of the first selection chip and one end of the second selection chip, and the other end is connected to the communication bus;

[0007] The other end of the first selection chip is connected to a communication terminal, and the communication terminal is used to connect to a second communication device;

[0008] The second selection chip has its other end connected to the communication terminal;

[0009] The microcontroller MCU is connected to the first selection chip, the second selection chip, and the communication bus, and is used to select one of the communication modules for communication through the first selection chip and the second selection chip.

[0010] Furthermore, the MCU is specifically used for:

[0011] sending a test signal to the second communication device through each communication module respectively;

[0012] According to the feedback result received after each test signal is sent, it is determined whether to select the currently working communication module for communication.

[0013] Furthermore, the MCU is connected to the first input terminal of the first selection chip to control the on / off of the first pin of the first selection chip; the MCU is connected to the second input terminal of the first selection chip to control the on / off of the second pin of the first selection chip; the MCU is connected to the third input terminal of the first selection chip to control the on / off of the third pin of the first selection chip;

[0014] The MCU is connected to the first input end of the second selection chip to control the on and off of the first pin of the second selection chip; the MCU is connected to the second input end of the second selection chip to control the on and off of the second pin of the second selection chip; the MCU is connected to the third input end of the second selection chip to control the on and off of the third pin of the second selection chip.

[0015] Furthermore, the at least three communication modules include: a first communication module, which is a UART communication module, including:

[0016] a first communication unit, provided between a first pin of the first selection chip and a first line of the communication bus;

[0017] The second communication unit is arranged between the first pin of the second selection chip and the second line of the communication bus.

[0018] Furthermore, the first communication unit includes:

[0019] a first resistor, a first end of which is connected to the first pin of the first selection chip, and a second end of which is connected to a voltage source;

[0020] a first switch tube, a first end of which is connected between the first resistor and the first pin of the first selection chip, a second end of which is grounded, and a third end of which is connected to the second end of the second switch tube via a second resistor;

[0021] The second switch tube has a first end connected to the voltage source, and a third end connected to the first line of the communication bus via a third resistor;

[0022] A first capacitor is provided between the first end and the second end of the first switch tube;

[0023] A transient suppression tube is connected in parallel at both ends of the first capacitor;

[0024] a fourth resistor, provided between the second terminal and the third terminal of the first switch tube;

[0025] a second capacitor, connected in parallel at both ends of the fourth resistor;

[0026] The fifth resistor is arranged between the first terminal and the third terminal of the second switch tube.

[0027] Furthermore, the second communication unit includes:

[0028] a sixth resistor, a first end of which is connected to the first pin of the second selection chip, and a second end of which is connected to the voltage source;

[0029] a seventh resistor, a first end of which is connected between the sixth resistor and the first pin of the second selection chip, and a second end of which is connected to the second line of the communication bus;

[0030] A third capacitor has a first end connected between the sixth resistor and the seventh resistor, and a second end grounded.

[0031] Furthermore, the at least three communication modules include: a second communication module, which is an I2C communication module, including:

[0032] an eighth resistor, a first end of which is connected to the second pin of the first selection chip, and a second end of which is connected to the first line of the communication bus;

[0033] a ninth resistor, a first end of which is connected to the second pin of the second selection chip, and a second end of which is connected to the second line of the communication bus;

[0034] a tenth resistor, a first end of which is connected between the eighth resistor and the second pin of the first selection chip, and a second end of which is connected to the voltage source;

[0035] An eleventh resistor has a first end connected between the ninth resistor and the second pin of the second selection chip, and a second end connected to the voltage source.

[0036] Furthermore, the at least three communication modules include: a third communication module, which is a 485 communication module, including:

[0037] A signal transceiver chip, a first end of which is connected to the third pin of the first selection chip through a twelfth resistor, a second end of which is connected to the second line of the communication bus, a third end of which is connected to the third pin of the second selection chip through a thirteenth resistor, and a fourth end of which is connected to the first line of the communication bus.

[0038] Furthermore, the third communication module further includes:

[0039] a fourteenth resistor, a first end of which is connected between the twelfth resistor and the first end of the signal transceiver chip, and a second end of which is grounded;

[0040] A fifteenth resistor has a first end connected between the thirteenth resistor and the third end of the signal transceiver chip, and a second end connected to a voltage source.

[0041] Furthermore, the third communication module further includes:

[0042] a sixteenth resistor, a first end of which is connected to the second end of the signal transceiver chip, and a second end of which is connected to a voltage source;

[0043] A seventeenth resistor has a first end connected to the fourth end of the signal transceiver chip, and a second end connected to a voltage source.

[0044] Furthermore, the third communication module further includes:

[0045] an eighteenth resistor, a first end of which is connected to the fifth terminal of the signal transceiver chip, and a second end of which is connected to the voltage source;

[0046] A nineteenth resistor has a first end connected to the sixth end of the signal transceiver chip, and a second end connected to the voltage source.

[0047] Furthermore, the communication circuit further includes:

[0048] A first isolation module is provided between the fifth terminal of the signal transceiver chip and the MCU;

[0049] The second isolation module is arranged between the sixth end of the signal transceiver chip and the MCU.

[0050] Furthermore, the communication circuit further includes:

[0051] a third isolation module, provided between the first communication line and the MCU;

[0052] The fourth isolation module is provided between the second communication line and the MCU.

[0053] The present invention also provides a communication device, comprising the above-mentioned communication circuit.

[0054] The present invention also provides a communication method, which is applied to the above-mentioned communication circuit, and the method comprises:

[0055] Sending a test signal to the second communication device through each communication module in turn;

[0056] According to the feedback result received after each test signal is sent, it is determined whether to select the currently working communication module for communication.

[0057] Furthermore, sending a test signal to the second communication device through each communication module in sequence includes:

[0058] If the MCU sends a UART test signal, the MCU controls the first input terminal of the first selection chip and the second selection chip U2 to be turned on, so that the first pins of the first selection chip and the second selection chip U2 are turned on, and then controls the first communication module to be turned on;

[0059] If the MCU sends a 485 test signal, the MCU controls the third input terminals of the first selection chip and the second selection chip to be turned on, so that the third pins of the first selection chip and the second selection chip are turned on, and then controls the third communication module to be turned on;

[0060] If the MCU sends an I2C test signal, the MCU controls the second input terminals of the first selection chip and the second selection chip U2 to be turned on, so that the second pins of the first selection chip and the second selection chip are turned on, thereby controlling the second communication module to be turned on.

[0061] Furthermore, according to the feedback result received after each test signal is sent, determining whether to select the currently working communication module for communication includes:

[0062] determining whether a response signal sent by the second communication device is received;

[0063] If yes, the currently working communication module is selected for communication;

[0064] If not, continue to send the test signal to the second communication device through the next communication module until a response signal is received, and then select the currently working communication module to communicate.

[0065] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the program implements the above-mentioned communication method when executed by a processor.

[0066] By applying the technical solution of the present invention, multiple communication modules are set up, and the multiple communication modules are connected to the same communication terminal. The communication mode is automatically matched by selecting the chip, thereby avoiding the problem of communication errors caused by wrong wiring when switching the communication mode, and improving communication efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] Figure 1 is a structural diagram of a communication circuit according to an embodiment of the present invention;

[0068] Figure 2 is a flow chart of a communication method implemented according to the present invention;

[0069] Figure 3 FIG. 4 is a flow chart of a communication method according to another embodiment of the present invention. DETAILED DESCRIPTION

[0070] To make the objectives, technical solutions, and advantages of the present invention more apparent, the present invention will be further described in detail below with reference to the accompanying drawings. It is apparent that the embodiments described are only some, not all, of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without creative effort are intended to fall within the scope of protection of the present invention.

[0071] The terms used in the embodiments of the present invention are for the purpose of describing specific embodiments only and are not intended to limit the present invention. The singular forms "a," "an," "the," and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, and unless the context clearly indicates otherwise, "a plurality" generally includes at least two.

[0072] It should be understood that the term "and / or" as used herein is merely a description of the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the associated objects are in an "or" relationship.

[0073] It should be understood that although the terms "first," "second," "third," etc. may be used to describe communication modules in embodiments of the present invention, these communication modules should not be limited to these terms. These terms are merely used to distinguish different communication modules. For example, a first communication module may also be referred to as a second communication module, and similarly, a second communication module may also be referred to as a first communication module without departing from the scope of embodiments of the present invention.

[0074] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to the determination" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)," depending on the context.

[0075] It should also be noted that the terms "include," "comprises," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a product or device comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such product or device. In the absence of further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the product or device comprising the element.

[0076] The optional embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0077] Example 1

[0078] This embodiment provides a communication circuit, which is provided in a first communication device. Figure 1 FIG. 1 is a structural diagram of a communication circuit according to an embodiment of the present invention. Figure 1 As shown, it includes: at least three communication modules, one end of each communication module is connected to one end of a first selection chip U1 and one end of a second selection chip U2, and the other end is connected to a communication bus; the first selection chip U1, the other end of which is connected to a communication terminal CN1, and the communication terminal CN1 is used to connect to a second communication device (not shown in the figure); the second selection chip U2, the other end of which is connected to the communication terminal CN1;

[0079] The microcontroller MCU is connected to the first selection chip U1, the second selection chip U2, and the communication bus, and is used to select one of the communication modules for communication through the first selection chip U1 and the second selection chip U2.

[0080] The communication circuit of this embodiment is provided with multiple communication modules, and the multiple communication modules are connected to the same communication terminal. The communication mode is automatically matched by selecting a chip, thereby avoiding the problem of communication errors caused by wrong connection when switching the communication mode, thereby improving communication efficiency.

[0081] In this embodiment, in order to select a suitable communication module, the MCU is specifically used to: send a test signal to the second communication device through each communication module respectively; and determine whether to select the currently working communication module for communication based on the feedback result received after each test signal is sent.

[0082] The MCU is connected to the first input terminal A of the first selection chip U1 to control the on / off of the first pin X10 of the first selection chip U1; the MCU is connected to the second input terminal B of the first selection chip U1 to control the on / off of the second pin X11 of the first selection chip U1; the MCU is connected to the third input terminal C of the first selection chip U1 to control the on / off of the third pin X12 of the first selection chip U1;

[0083] The MCU is connected to the first input terminal A of the second selection chip U2 to control the on and off of the first pin X20 of the second selection chip U2; the MCU is connected to the second input terminal B of the second selection chip U2 to control the on and off of the second pin X21 of the second selection chip U2; the MCU is connected to the third input terminal C of the second selection chip U2 to control the on and off of the third pin X22 of the second selection chip U2.

[0084] The above-mentioned at least three communication modules include: a first communication module 10, which is a UART communication module. In order to achieve two-way communication, the first communication module 10 includes: a first communication unit 101, which is arranged between the first pin X10 of the first selection chip U1 and the first line of the communication bus; a second communication unit 102, which is arranged between the first pin X20 of the second selection chip U2 and the second line of the communication bus.

[0085] The first communication unit 101 includes: a first resistor R1, a first end of which is connected to the first pin X10 of the first selection chip U1, and a second end of which is connected to the voltage source +VCC; a first switch tube Q1, a first end of which is connected between the first resistor R1 and the first pin X10 of the first selection chip U1, a second end of which is grounded, and a third end of which is connected to the second end of the second switch tube Q2 through a second resistor R2; a second switch tube Q2, a first end of which is connected to the voltage source +VCC, and a third end of which is connected to the first line of the communication bus through a third resistor R3; a first capacitor C1, which is arranged between the first and second ends of the first switch tube Q1; a transient suppression tube TVS1, which is arranged in parallel at both ends of the first capacitor C1; a fourth resistor R4, which is arranged between the second and third ends of the first switch tube Q1; a second capacitor C2, which is arranged in parallel at both ends of the fourth resistor R4; and a fifth resistor R5, which is arranged between the first and third ends of the second switch tube Q2.

[0086] The second communication unit 102 includes: a sixth resistor R6, a first end of which is connected to the first pin X20 of the second selection chip U2, and a second end of which is connected to the voltage source +VCC; a seventh resistor R7, a first end of which is connected between the sixth resistor R6 and the first pin X20 of the second selection chip U2, and a second end of which is connected to the second line of the communication bus; a third capacitor C3, a first end of which is connected between the sixth resistor R6 and the seventh resistor R7, and a second end of which is grounded.

[0087] The at least three communication modules also include: a second communication module 20, the second communication module 20 is an I2C communication module, which includes: an eighth resistor R8, a first end of which is connected to the second pin X11 of the first selection chip U1, and a second end of which is connected to the first line of the communication bus; a ninth resistor R9, a first end of which is connected to the second pin X21 of the second selection chip U2, and a second end of which is connected to the second line of the communication bus; a tenth resistor R10, a first end of which is connected between the eighth resistor R8 and the second pin X11 of the first selection chip U1, and a second end of which is connected to the voltage source +VCC; an eleventh resistor R11, a first end of which is connected between the ninth resistor R9 and the second pin X21 of the second selection chip U2, and a second end of which is connected to the voltage source +VCC.

[0088] At least three communication modules include: a third communication module 30, the third communication module 30 is a 485 communication module, which includes: a signal transceiver chip U3, a first end of which is connected to the third pin X12 of the first selection chip U1 through the twelfth resistor R12, a second end of which is connected to the second line of the communication bus, a third end of which is connected to the third pin X22 of the second selection chip U2 through the thirteenth resistor R13, and a fourth end of which is connected to the first line of the communication bus.

[0089] The third communication module 30 further includes: a fourteenth resistor R14, whose first end is connected between the twelfth resistor R12 and the first end of the signal transceiver chip U3, and whose second end is grounded; a fifteenth resistor R15, whose first end is connected between the thirteenth resistor R13 and the third end of the signal transceiver chip U3, and whose second end is connected to the voltage source +VCC. The third communication module 30 further includes: a sixteenth resistor R16, whose first end is connected to the second end of the signal transceiver chip U3, and whose second end is connected to the voltage source +VCC; a seventeenth resistor R17, whose first end is connected to the fourth end of the signal transceiver chip U3, and whose second end is connected to the voltage source +VCC. The third communication module 30 further includes: an eighteenth resistor R18, whose first end is connected to the fifth end of the signal transceiver chip U3, and whose second end is connected to the voltage source +VCC; and a nineteenth resistor R19, whose first end is connected to the sixth end of the signal transceiver chip U3, and whose second end is connected to the voltage source +VCC.

[0090] In order to achieve isolation between communication signals and strong electric signals, the above-mentioned communication circuit also includes: a first isolation module, which is arranged between the fifth end of the signal transceiver chip U3 and the first pin INV of the MCU, and the first isolation module includes a first transformer UND1, a third switch tube Q3 and a fourth switch tube Q4 arranged in series, and a twentieth resistor R20; a second isolation module, which is arranged between the sixth end of the signal transceiver chip U3 and the second pin DE of the MCU, and includes: a second transformer UND2, a diode D is arranged in series on the primary side of the second transformer UND2, and a fourth capacitor C4 is connected in parallel, a fifth switch tube Q5 and a sixth switch tube Q6 are arranged in series, and a twenty-first resistor R21. A third isolation module is provided between the first communication line and the third pin TXD / SCK of the MCU, and includes a third transformer UND3, a seventh switch tube Q7 and an eighth switch tube Q8 arranged in series, and a twenty-second resistor R22. A fourth isolation module is provided between the second communication line and the fourth pin RXD / SDA of the MCU, and includes a fourth transformer UND4. A twenty-third resistor R23 and a twenty-fourth resistor R24 ​​are arranged in series on the secondary side of the fourth transformer UND4. The line between the twenty-third resistor R23 and the second fourth resistor R24 ​​is connected to the base of the ninth switch tube Q9. The collector of the ninth switch tube Q9 is connected to the voltage source +VCC through the twenty-fifth resistor R25, and the emitter is grounded.

[0091] The idle pin of the first selection chip U1 is grounded via the fifth capacitor C5, and the idle pin of the second selection chip U2 is grounded via the sixth capacitor C6. The fifth capacitor C5 and the sixth capacitor C6 are used to filter the voltage input to the selection chips U1 and U2 respectively.

[0092] To summarize, the above communication circuit is composed of MCU, capacitors C1, C2, C3, C4, C5, C6, resistors R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R22, R23, R24, R25, transistors Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, transient suppression tube TVS1, diode D, transformers UND1, UND2, UND3, UND4, communication terminal CN1, signal transceiver chip U3, and channel selection chips U1 and U2.

[0093] During communication, the MCU first sends a UART test signal, and at the same time, the MCU controls the A pins of the first selection chip U1 and the second selection chip U2 to be connected, so that the first pins of U1 and U2 are turned on, and the UART communication module is turned on. If the MCU receives a response, the UART communication module is used for communication; if no response is received, the 485 test signal continues to be sent, and the MCU controls the C pins of the first selection chip U1 and the second selection chip U2 to be connected, so that the third pins of U1 and U2 are turned on, and the 485 communication module is turned on. If a response is received, the 485 communication module is used for communication; if no response is received, the software automatically switches the I / O port configuration to I2C communication, and the MCU controls the B pins of the first selection chip U1 and the second selection chip U2 to be connected, so that the second pins of U1 and U2 are turned on, the I2C communication module is turned on, and I2C communication is used.

[0094] The 22nd resistor R22, the 7th switch Q7, the 8th switch Q8, and the 3rd transformer UND3 form a transformer isolation circuit that isolates the MCU's 3rd pin TXD / SCK network. Resistor R23 acts as a current limiter. When TXD / SCK outputs a high level, switch Q7 turns on, the primary side of transformer UND3 is high, and the high level is output through the isolated secondary side. When TXD / SCK outputs a low level, transistor Q7 turns off, and the energy stored in the primary side of transformer UND3 is released through transistor Q8, becoming low, and the low level is output through the isolated secondary side. Similarly, the 20th resistor R20, the 3rd switch Q3, the 4th switch Q4, and the 1st transformer UND1 form a transformer isolation circuit that isolates the MCU's 1st pin INV network. The 21st resistor R21, the 5th switch Q5, the 6th switch Q6, the 2nd transformer UND2, the diode D, and the 3rd capacitor C3 form a transformer isolation circuit that isolates the MCU's 2nd pin DE network. Diode D and the 3rd capacitor C3 ensure a unidirectional and stable voltage on the chip enable pin.

[0095] The isolation circuit composed of the 23rd resistor R23, the 24th resistor R24, the 25th resistor R25, the ninth switch tube Q9, and the transformer UND4 is a transformer isolation circuit for the MCU's fourth pin RXD / SDA network. When a high level is sent from the communication terminal, the fourth transformer UND4 isolates the high level and outputs the high level. The ninth switch tube Q9 is turned on, and RXD / SDA receives a low level. When a low level is sent from the communication terminal, the fourth transformer UND4 isolates the high level and outputs the high level. The ninth switch tube Q9 is turned on and off, +VCC is connected to the RXD / SDA pin, the RXD / SDA pin outputs a high level, and the 24th resistor R24 ​​releases the power stored in the transformer.

[0096] The UART communication module consists of the first resistor R1, the second resistor R2, the third resistor R3, the fourth resistor R4, the fifth resistor R5, the sixth resistor R6, and the seventh resistor R7, the first capacitor C1, the second capacitor C2, the third capacitor C3, the first switching transistor Q1, the second switching transistor Q2, and the transient suppression diode TVS1. The first resistor R1, the fifth resistor R5, and the sixth resistor R6 are pull-up resistors, which default the signal to a high level. The fourth resistor R4 has both current limiting and pull-down functions. Current limiting limits the loop current of the first switching transistor Q1, while pull-down defaults the signal to a low level. The third resistor R3 also has a current limiting function, protecting the second switching transistor Q2. The second resistor R2 and the second capacitor C2 form a resistor-capacitor filter circuit to filter out any noise or interference in the circuit. The transient suppression diode TVS1 primarily protects the first switching transistor Q1. Interference first passes through the transient suppression diode TVS1 and then to the protected device. The first capacitor C1 filters the circuit. When TXD / SCK is low, the second switch tube Q2 and the first switch tube Q1 are turned on in sequence, and the communication terminal outputs a low level; when TXD / SCK is high, the second switch tube Q2 and the first switch tube Q1 are turned off, and the communication terminal outputs a high level.

[0097] Resistors R8, R9, R10, and R11 form the I2C communication module. Resistors R10 and R11 act as pull-up resistors, while R8 and R9 act as current-limiting resistors. When TXD / SCK and RXD / SDA are high, +VCC is connected to the communication terminals, and the communication terminals output a high level. When TXD / SCK and RXD / SDA are low, +VCC is pulled low, and the communication terminals output a low level.

[0098] The 12th resistor R12, the 13th resistor R13, the 14th resistor R14, the 15th resistor R15, the 16th resistor R16, the 17th resistor R17, the 18th resistor R18, the 19th resistor R19, and the signal transceiver chip U3 form the 485 communication module. The 15th resistor R15, the 16th resistor R16, and the 17th resistor R17 are pull-up resistors, while the 14th resistor R14, the 18th resistor R18, and the 19th resistor R19 are pull-down resistors. The 12th resistor R12 and the 13th resistor R13 provide current limiting, protecting the signal transceiver chip U3. The transient suppressor (TVS1) is a bidirectional diode that clamps voltage in both directions, protecting the signal transceiver chip U3. After selecting communication via the 485 communication module, the signal transceiver chip U3 begins operation when the MCU's first pin INV, second pin DE, and third pin TXD / SCK emit high or low level signals.

[0099] Example 2

[0100] This embodiment provides a communication device, including the communication circuit in the above embodiment, which is used to realize automatic matching of communication modes, avoiding the problem of wrong connection when switching communication modes in the prior art, which leads to communication errors, and improves communication efficiency.

[0101] Example 3

[0102] This embodiment provides a communication method, which is applied to the communication circuit in the above embodiment. Figure 2 is a flow chart of a communication method according to the present invention, such as Figure 2 As shown, the method includes:

[0103] S101: Send a test signal to a second communication device through each communication module in sequence.

[0104] S102: Determine whether to select the currently working communication module for communication according to the feedback result received after each test signal is sent.

[0105] In this embodiment, in order to select a suitable communication module, the MCU sends a test signal to the second communication device through each communication module respectively; based on the feedback result received after each test signal is sent, it is determined whether to select the currently working communication module for communication.

[0106] The communication method of this embodiment sequentially sends a test signal to the second communication device through each communication module. Based on the feedback received after each test signal transmission, the method determines whether to select the currently active communication module for communication. This enables automatic matching of communication modes, avoiding communication errors caused by incorrect wiring when switching communication modes, and improving communication efficiency.

[0107] Based on the feedback results received after each test signal is sent, determine whether to select the currently working communication module for communication, including: judging whether a response signal sent by the second communication device is received; if so, select the currently working communication module for communication; if not, continue to send the test signal to the second communication device through the next communication module until a response signal is received, and then select the currently working communication module for communication.

[0108] In specific implementation, the above steps can be executed in a loop until a response signal is received, and the currently working communication module is selected for communication. Alternatively, a preferred communication module can be set, and when no response is received when a test signal is sent through other communication modules, the preferred communication module is selected for communication.

[0109] The following combination Figure 3 Another alternative embodiment of the present invention will be described in detail. Figure 3 is a flow chart of a communication method according to another embodiment of the present invention. Figure 3 As shown, the method includes:

[0110] S1, starting the UART communication module, and at the same time, the MCU of the first communication device sends a UART test signal to the second communication device through the communication terminal.

[0111] S2, determine whether a response signal from the second communication device is received; if yes, execute step S3, if not, execute step S4.

[0112] S3, select the UART communication module for communication.

[0113] S4, starting the 485 communication module, and at the same time, the MCU of the first communication device sends a 485 test signal to the second communication device through the communication terminal.

[0114] S5, determining whether a response signal from the second communication device is received; if yes, executing step S6, if not, executing step S7.

[0115] S6, select 485 communication module for communication.

[0116] S7, the software automatically switches the I / O port configuration to I2C communication and selects the I2C communication module for communication.

[0117] This embodiment provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the communication method in the above embodiment is implemented.

[0118] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.

[0119] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.

[0120] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A communication circuit, characterized in that: The communication circuit is provided in the first communication device, and includes: At least three communication modules, one end of each communication module is connected to one end of the first selection chip and one end of the second selection chip, and the other end is connected to the communication bus; the at least three communication modules include: a first communication module, the first communication module is a UART communication module, including: a first communication unit, which is arranged between the first pin of the first selection chip and the first line of the communication bus; a second communication unit is arranged between the first pin of the second selection chip and the second line of the communication bus; a second communication module, the second communication module is an I2C communication module, including: an eighth resistor, a first end of which is connected to the second pin of the first selection chip, and a second end of which is connected to the first line of the communication bus; a ninth resistor, a first end of which is connected to the a tenth resistor, a first end of which is connected between the eighth resistor and the second pin of the first selection chip, and a second end of which is connected to a voltage source; an eleventh resistor, a first end of which is connected between the ninth resistor and the second pin of the second selection chip, and a second end of which is connected to the voltage source; a third communication module, the third communication module being a 485 communication module, comprising: a signal transceiver chip, a first end of which is connected to the third pin of the first selection chip through a twelfth resistor, a second end of which is connected to the second line of the communication bus, a third end of which is connected to the third pin of the second selection chip through a thirteenth resistor, and a fourth end of which is connected to the first line of the communication bus; The other end of the first selection chip is connected to a communication terminal, and the communication terminal is used to connect to a second communication device; The second selection chip, the other end of which is connected to the communication terminal; The microcontroller MCU is connected to the first selection chip, the second selection chip, and the communication bus, and is used to select one of the communication modules for communication through the first selection chip and the second selection chip.

2. The communication circuit according to claim 1, wherein: The MCU is specifically used for: sending a test signal to the second communication device through each communication module respectively; According to the feedback result received after each test signal is sent, it is determined whether to select the currently working communication module for communication.

3. The communication circuit according to claim 1, wherein: The MCU is connected to the first input terminal of the first selection chip to control the on / off of the first pin of the first selection chip; the MCU is connected to the second input terminal of the first selection chip to control the on / off of the second pin of the first selection chip; the MCU is connected to the third input terminal of the first selection chip to control the on / off of the third pin of the first selection chip; The MCU is connected to the first input end of the second selection chip to control the on / off of the first pin of the second selection chip; the MCU is connected to the second input end of the second selection chip to control the on / off of the second pin of the second selection chip; the MCU is connected to the third input end of the second selection chip to control the on / off of the third pin of the second selection chip.

4. The communication circuit according to claim 1, wherein: The first communication unit includes: a first resistor, a first end of which is connected to the first pin of the first selection chip, and a second end of which is connected to a voltage source; a first switch tube, a first end of which is connected between the first resistor and the first pin of the first selection chip, a second end of which is grounded, and a third end of which is connected to the second end of the second switch tube via a second resistor; The second switch tube has a first end connected to the voltage source, and a third end connected to the first line of the communication bus via a third resistor; A first capacitor is provided between the first end and the second end of the first switch tube; A transient suppression tube is connected in parallel at both ends of the first capacitor; a fourth resistor, provided between the second terminal and the third terminal of the first switch tube; a second capacitor, connected in parallel at both ends of the fourth resistor; The fifth resistor is arranged between the first terminal and the third terminal of the second switch tube.

5. The communication circuit according to claim 1, wherein: The second communication unit includes: a sixth resistor, a first end of which is connected to the first pin of the second selection chip, and a second end of which is connected to a voltage source; a seventh resistor, a first end of which is connected between the sixth resistor and the first pin of the second selection chip, and a second end of which is connected to the second line of the communication bus; A third capacitor has a first end connected between the sixth resistor and the seventh resistor, and a second end grounded.

6. The communication circuit according to claim 1, wherein: The third communication module further includes: a fourteenth resistor, a first end of which is connected between the twelfth resistor and the first end of the signal transceiver chip, and a second end of which is grounded; A fifteenth resistor has a first end connected between the thirteenth resistor and the third end of the signal transceiver chip, and a second end connected to a voltage source.

7. The communication circuit according to claim 1, wherein: The third communication module further includes: a sixteenth resistor, a first end of which is connected to the second end of the signal transceiver chip, and a second end of which is connected to a voltage source; A seventeenth resistor has a first end connected to the fourth end of the signal transceiver chip, and a second end connected to a voltage source.

8. The communication circuit according to claim 6, characterized in that: The third communication module further includes: an eighteenth resistor, a first end of which is connected to the fifth terminal of the signal transceiver chip, and a second end of which is connected to the voltage source; A nineteenth resistor has a first end connected to the sixth end of the signal transceiver chip, and a second end connected to the voltage source.

9. The communication circuit according to claim 8, characterized in that: The communication circuit further includes: A first isolation module is provided between the fifth terminal of the signal transceiver chip and the MCU; The second isolation module is arranged between the sixth end of the signal transceiver chip and the MCU.

10. The communication circuit according to claim 1, wherein: The communication circuit further includes: a third isolation module, provided between the first communication line and the MCU; A fourth isolation module is provided between the second communication line and the MCU.

11. A communication device, characterized in that: A communication circuit comprising the communication circuit according to any one of claims 1 to 10.

12. A communication method, applied to the communication circuit according to any one of claims 1 to 10, characterized in that: The method comprises: Sending a test signal to the second communication device through each communication module in turn; According to the feedback result received after each test signal is sent, it is determined whether to select the currently working communication module for communication.

13. The communication method according to claim 12, wherein: Sending a test signal to the second communication device through each communication module in sequence includes: If the MCU sends a UART test signal, the MCU controls the first input terminal of the first selection chip and the second selection chip U2 to be turned on, so that the first pins of the first selection chip and the second selection chip U2 are turned on, and then controls the first communication module to be turned on; If the MCU sends a 485 test signal, the MCU controls the third input terminals of the first selection chip and the second selection chip to be turned on, so that the third pins of the first selection chip and the second selection chip are turned on, and then controls the third communication module to be turned on; If the MCU sends an I2C test signal, the MCU controls the second input terminals of the first selection chip and the second selection chip U2 to be turned on, so that the second pins of the first selection chip and the second selection chip are turned on, thereby controlling the second communication module to be turned on.

14. The communication method according to claim 12, wherein: Based on the feedback received after each test signal is sent, it is determined whether the currently working communication module is selected for communication, including: determining whether a response signal sent by the second communication device is received; If yes, the currently working communication module is selected for communication; If not, continue to send the test signal to the second communication device through the next communication module until a response signal is received, and then select the currently working communication module to communicate.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the communication method according to any one of claims 12 to 14 is implemented.

Citation Information

Patent Citations

  • Communication circuit and communication equipment

    CN217954942U