Circuit for switching transmitting and receiving directions of half-duplex serial communication
By designing a combination of input circuit, level delay circuit and output circuit, the problem of high cost and insufficient applicability in sending and receiving direction control in half-duplex communication is solved, and reliable data transmission at high baud rate is achieved.
Patent Information
- Application Number
- CN202420291130.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-12
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2034-02-12
AI Technical Summary
The cost of controlling the sending and receiving directions in existing half-duplex communications is high and is not suitable for high baud rate situations, resulting in data transmission errors.
A switching half-duplex serial communication transceiver direction circuit including an input circuit, a level delay circuit and an output circuit is designed. The low-level holding time of the single-ended signal is extended through the level delay circuit, and in the output circuit Set logic to automatically switch the sending and receiving directions to ensure reliable transmission of data signals at high baud rates.
It realizes automatic switching of reliable sending and receiving directions for half-duplex communication at high baud rates, reduces hardware costs, and avoids data transmission errors. It is suitable for occasions with high and low baud rates.
Smart Images

Figure CN221862847U_ABST
Abstract
Description
Technical Field
[0001] The utility model relates to the technical field of communication, in particular to a circuit for switching the receiving and sending directions of half-duplex serial communication. Background Art
[0002] Half-duplex communication, especially half-duplex communication based on RS485 interface technology, is widely used because of its advantages such as strong anti-interference ability, long transmission distance, simple wiring, and suitability for multi-machine networking communication. However, half-duplex communication involves switching the direction of sending and receiving data, which also brings additional troubles to users.
[0003] Existing solutions include:
[0004] Solution 1, by programming and controlling the pins of the microprocessor to switch the sending and receiving direction of the half-duplex communication chip, this solution requires a program to detect and determine the sending status of the communication, which increases the cost of software and hardware.
[0005] Solution 2, by connecting an inverter in series between the single-ended data receiving pin and the direction control pin of the half-duplex communication chip, and then controlling the receiving and sending direction of the half-duplex communication chip by inverting the single-ended data level. This solution will cause the receiving and sending direction of the half-duplex communication chip to switch too frequently, so it is easily interfered and is only suitable for occasions with low baud rates.
[0006] Solution 3, based on Solution 2, adds an RC integration circuit between the inverter and the single-ended data receiving pin. Although this solution can keep the half-duplex communication chip in the sending state during the communication process, the RC integration circuit will cause signal delay, resulting in the direction control signal arriving at the corresponding pin of the duplex communication chip later than the single-ended data signal, especially in the case of high baud rate, which will cause data transmission errors. Summary of the invention
[0007] In order to solve the problems in the prior art that the control cost of the receiving and sending direction in half-duplex communication is high and it is not suitable for occasions with high baud rates, the purpose of the utility model is to provide a circuit for switching the receiving and sending direction of half-duplex serial communication.
[0008] The circuit for switching the receiving and sending direction of half-duplex serial communication includes: an input circuit, a level delay circuit, and an output circuit;
[0009] The input circuit is used to increase the driving capability of the input single-ended signal and isolate the influence of the level delay circuit on the input single-ended signal. The input circuit is provided with an input port and an output port;
[0010] The level delay circuit is used to extend the low level holding time of the input single-ended signal, and the level delay circuit is provided with at least one input port and one output port;
[0011] The output circuit is used to set the direction of the circuit for the half-duplex serial communication receiving and sending direction. The output circuit is provided with at least two input ports and one output port. The working logic of the output circuit is: when all its input ports input high level, its output port outputs low level, otherwise its output port outputs high level;
[0012] The connection relationship between the input circuit, the level delay circuit, and the output circuit is as follows:
[0013] Two input port states are set for the level delay circuit: the input port of the input circuit, one of the input ports of the level delay circuit, and one of the input ports of the output circuit are connected to each other, the output port of the input circuit is connected to another input port of the level delay circuit, and the output port of the level delay circuit is connected to another input port of the output circuit;
[0014] When the level delay circuit sets an input port state: the input port of the input circuit is connected to one of the input ports of the output circuit, the output port of the input circuit is connected to an input port of the level delay circuit, and the output port of the level delay circuit is connected to another input port of the output circuit.
[0015] Preferably: the input circuit can be, but is not limited to, any one of a voltage / current driver, a voltage follower, a voltage / current amplifier, a buffer gate circuit, an OC gate circuit, a push-pull output circuit, a Smith trigger, a photoelectric isolator, and a magnetic coupling isolator.
[0016] Preferably: the level delay circuit comprises a diode D1, a resistor R1 and a capacitor C1;
[0017] For the level delay circuit, two input port states are set:
[0018] The cathode of the diode D1 serves as an input port of the level delay circuit and is connected to the output port of the input circuit. The anode of the diode D1 is connected to one end of the resistor R1 and one end of the capacitor C1 as the output port of the level delay circuit. The other end of the resistor R1 serves as another input port of the level delay circuit and is connected to the input port of the input circuit. The other end of the capacitor C1 is grounded.
[0019] For the level delay circuit, an input port state is set:
[0020] The cathode of the diode D1 serves as an input port of the level delay circuit and is connected to the output port of the input circuit. The anode of the diode D1 is connected to one end of the resistor R1 and one end of the capacitor C1 as the output port of the level delay circuit. The other end of the resistor R1 is connected to a power supply or the cathode of the diode D1, and the other end of the capacitor C1 is grounded.
[0021] Preferably, the output circuit is a NAND gate circuit or other circuits that can meet the working logic of the output circuit.
[0022] Further preferably, a waveform hysteresis circuit is connected in series between the single-ended serial receiving data line and the single-ended data receiving end of the half-duplex transceiver chip, the function of which is to lag the waveform in time for a certain period of time, thereby ensuring that the transmitted data signal arrives at the corresponding pin of the half-duplex transceiver chip later than the transmit and receive direction control signal.
[0023] The waveform hysteresis circuit is a circuit that has the function of delaying the time for generating the rising / falling edge of a digital signal, and may be, but is not limited to, a low-pass filter, a gate circuit, or a programmable logic circuit. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the utility model or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the utility model. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 The utility model provides a schematic diagram of waveforms involved in the circuit for switching the receiving and transmitting direction of half-duplex serial communication.
[0026] Figure 2 The invention provides an example of using the circuit for switching the receiving and transmitting direction of half-duplex serial communication provided by the utility model in the conversion between LVDS and single-ended signals.
[0027] Figure 3 The invention provides an example of using the circuit for switching the receiving and sending direction of half-duplex serial communication provided by the utility model in RS485 communication.
[0028] Figure 4 The expansion circuit for switching the receiving and transmitting direction of half-duplex serial communication provided by the utility model involves a fourth waveform schematic diagram.
[0029] Figure 5 This is an implementation example of a circuit expansion waveform hysteresis circuit for switching the receiving and transmitting directions of half-duplex serial communication provided by the utility model.
[0030] Figure 6 This is the first level delay circuit implementation case provided by the utility model.
[0031] Figure 7 This is an implementation example of the second level delay circuit provided by the utility model.
[0032] Figure 8 This is an example of using a voltage follower to implement an input circuit provided by the utility model.
[0033] Fig. 9 The utility model provides an example of using a Smith trigger to implement an input circuit and a NOR gate to implement an output circuit. DETAILED DESCRIPTION
[0034] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the description of these embodiments is intended to help understand the present invention, but does not constitute a limitation on the present invention. The specific structural and functional details disclosed herein are only used to describe the embodiments of the present invention. However, the present invention can be embodied in many alternative forms, and it should not be understood that the present invention is limited to the embodiments described herein.
[0035] It should be understood that although the terms first and second, etc. may be used herein to describe various objects, these objects should not be limited by these terms. These terms are only used to distinguish one object from another object. For example, a first object can be referred to as a second object, and similarly, a second object can be referred to as a first object without departing from the scope of the exemplary embodiments of the present utility model.
[0036] It should be understood that the term "and / or" that may appear in this article is merely a description of the association relationship between associated objects, indicating that there may be three relationships. For example, A and / or B can represent three situations: A exists alone, B exists alone, or A and B exist at the same time; the term " / and" that may appear in this article describes another type of association object relationship, indicating that there may be two relationships. For example, A / and B can represent two situations: A exists alone or A and B exist at the same time; in addition, the character " / " that may appear in this article generally indicates that the previous and next associated objects are in an "or" relationship.
[0037] like Figure 1As shown, the waveform and level schematic diagram involved in the circuit for switching the receiving and sending direction of half-duplex serial communication provided in this embodiment is used to describe the control signal generation principle and process of switching the receiving and sending direction of half-duplex serial communication. It can be but not limited to being executed in digital circuits, analog circuits, mixed digital and analog circuits, microprocessors, programmable logic devices and computer equipment with certain computing resources and data acquisition functions, so as to realize automatic switching of the receiving and sending direction of half-duplex serial communication, especially in situations where the communication rate is high, the reliability of communication can be guaranteed!
[0038] like Figure 1 As shown, the waveforms involved in the circuit for switching the receiving and transmitting direction of half-duplex serial communication may include, but are not limited to, a first waveform, a second waveform, and a third waveform;
[0039] like Figure 2 The circuit for switching the receiving and sending direction of half-duplex serial communication provided by the first aspect of the present embodiment is used to switch the receiving and sending direction of the LVDS differential signal and single-ended signal conversion chip SN65MLVD200A based on half-duplex communication.
[0040] like Figure 2 As shown: SN65MLVD200A chip U3 has two data ports, single-ended and differential, and transceiver control pins, wherein the single-ended port includes DI (driver input) pin and RO (Receive output) pin; the differential port includes two LVDS input and output pins A and B; the transceiver control pins include RE (Receiver Output Enable Active Low) pin and DE (Driver Output Enable Active HIGH) pin.
[0041] like Figure 2 The circuit shown in the figure switches the receiving and transmitting direction of half-duplex serial communication: includes an input circuit implemented by a buffer chip U1 (the input circuit can also be but is not limited to being implemented by a voltage / current driver, a voltage follower, a voltage / current amplifier, an OC gate circuit, a push-pull output circuit, a Smith trigger, a photoelectric isolator, and a magnetic coupling isolator), a level delay circuit composed of a resistor R1, a capacitor C1, and a diode D1, and an output circuit implemented by a NAND gate U2 (the output circuit can also be a NOR gate (NOR gate: each input signal is logically inverted and then a logical OR operation is performed) circuit or other circuits that can meet the working logic of the output circuit).
[0042] The circuit for switching the receiving and transmitting direction of half-duplex serial communication is connected to the SN65MLVD200A chip U3 in the following manner: the DI (driver input) pin of U3, the input pin of U1, and one input pin of U2 are short-circuited to each other, and the short-circuit point is set as node A (node A is Figure 1 The first waveform collection point shown in the figure); short-circuit the output pin of U2, the RE (Receiver OutputEnable Active Low) pin of U3, and the DE (Driver Output Enable Active HIGH) pin to each other, and set this short-circuit point as node C (node C is Figure 1 The third waveform acquisition point is shown).
[0043] In addition, the anode of the diode D1, the capacitor C1, the resistor R1 and the input port of the output circuit are short-circuited to form a node B (node B is Figure 1 The second waveform acquisition point is shown).
[0044] The working principle of this circuit embodiment is as follows:
[0045] 1. Data to be sent ( Figure 1 The first waveform shown in the figure is serially input to the node A. When the data is in the idle state: the node A is at a high level, the output of the buffer U1 is at a high level, the diode D1 is in a cut-off state, the capacitor C1 is charged through the resistor R1, the node B is at a high level, and the output pin (node C) of the NAND gate U2 is at a low level, so that the U3 chip state is in a receiving state.
[0046] 2. When the data stream to be sent ( Figure 1 When the first waveform shown in FIG. 1 is the start bit (low level), the input pin of the NAND gate U2 connected to the node A is low level, and the output of the NAND gate U2 (node C) is high level, so that the U3 chip state is in the sending state; at the same time, the output of the buffer U1 is low level, and the capacitor C1 is discharged through the diode D1.
[0047] 3. When the data stream to be sent sends payload data: if the data is at a low level, the capacitor C1 continues to discharge through the diode D1; if the data is at a high level, the diode D1 is cut off, and the capacitor C1 is charged through the resistor R1. Here, the resistance value of the resistor R1 is set to be greater than or equal to 8 times the forward conduction resistance of the diode, so that the charging time of the capacitor C1 is greater than or equal to 8 times the discharge time, that is, it can be ensured that in the process of sending data, only the low level holding time of the start bit is needed to discharge the capacitor C1, that is, it can be ensured that the voltage of the node B in the communication byte cycle (except the start bit) is maintained within the low level threshold range, and the input pin of the NAND gate U2 connected to the node B is input with a low level, and the output of the NAND gate U2 (node C) is high, so that the U3 chip state is in the sending state.
[0048] 4. When the data to be sent is sent, that is, the data is in an idle state: the node A is high level, the output of the buffer U1 is high level, the diode D1 is in a cut-off state, and the capacitor C1 is charged through the resistor R1; the node B returns to a high level, and the output pin (node C) of the NAND gate U2 is low level, so that U3 automatically switches to the receiving state.
[0049] The advantage of using this embodiment is that it can realize automatic switching of the receiving and sending directions when the communication baud rate of the LVDS differential signal and the single-ended signal is greater than 500K. When the node A receives data, the delay of the node C switching from the low level to the high level is small, and only a low level of the data start bit is required to ensure the entire data sending cycle. The state of the node C always remains in a high level state, ensuring that the LVDS differential signal is in a sending state during the entire sending cycle.
[0050] like Figure 3 The circuit for switching the receiving and sending direction of half-duplex serial communication provided by the second aspect of the embodiment is used to switch the receiving and sending direction of the RS485 communication interface chip MAX485 based on half-duplex communication.
[0051] like Figure 3 As shown: MAX485 chip U3 has two data ports, single-ended and differential, and transceiver control pins, wherein the single-ended port includes DI (driver input) pin and RO (Receive output) pin; the differential port includes two RS485 differential signal input and output pins A and B; the transceiver control pins include RE (Receiver Output Enable Active Low) pin and DE (Driver Output Enable Active HIGH) pin.
[0052] like Figure 3The circuit shown in the figure switches the receiving and transmitting direction of half-duplex serial communication: includes an input circuit composed of a voltage follower implemented by U1 (the input circuit can also be but is not limited to being implemented by a voltage / current driver, a voltage / current amplifier, a buffer gate circuit, an OC gate circuit, a push-pull output circuit, a Smith trigger, a photoelectric isolator, and a magnetic coupling isolator), a level delay circuit composed of a resistor R1, a capacitor C1, and a diode D1, and an output circuit implemented by a NAND gate U2 (the output circuit can also be a NOR gate (NOR gate: each input signal is logically inverted and then a logical OR operation is performed) circuit or other circuits that can meet the working logic of the output circuit).
[0053] The circuit for switching the receiving and transmitting direction of half-duplex serial communication is connected to the MAX485 chip U3 in the following manner: the DI (driver input) pin of U3, the input pin of U1, and one input pin of U2 are short-circuited to each other, and the short-circuit point is set as node A (node A is Figure 1 The first waveform collection point shown in the figure); short-circuit the output pin of U2, the RE (Receiver Output Enable Active Low) pin of U3, and the DE (Driver Output Enable Active HIGH) pin to each other, and set this short-circuit point as node C (node C is Figure 1 The third waveform acquisition point is shown).
[0054] In addition, the anode of the diode D1, the capacitor C1, the resistor R1 and the input port of the output circuit are short-circuited to form a node B (node B is Figure 1 The second waveform acquisition point is shown).
[0055] The working principle of this circuit embodiment is as follows:
[0056] 1. The data to be sent (single-ended signal to differential signal) is serially input to the node A. When the data is in an idle state: the node A is at a high level, the output of the buffer U1 is at a high level, the diode D1 is in a cut-off state, the capacitor C1 is charged through the resistor R1, the node B is at a high level, and the output pin (node C) of the NAND gate U2 is at a low level, so that the RS485 transceiver chip is in a receiving state.
[0057] 2. When the data stream to be sent is the start bit (low level): the input pin of the NOT gate U2 connected to the node A is low level, and the output of the NOT gate U2 (node C) is high level, so that the RS485 transceiver chip is in the sending state; at the same time, the output of the buffer U1 is low level, and the capacitor C1 is discharged through the diode D1.
[0058] 3. When the data stream to be sent sends payload data: if the data is at a low level, the capacitor C1 continues to discharge through the diode D1; if the data is at a high level, the diode D1 is cut off, and the capacitor C1 is charged through the resistor R1. Here, the resistance of the resistor R1 is set to be greater than or equal to 8 times the forward conduction resistance of the diode, so that the charging time of the capacitor C1 is greater than or equal to 8 times the discharge time, that is, it can be ensured that in the process of sending data, only the low level holding time of the start bit is needed to discharge the capacitor C1, that is, it can be ensured that the voltage of the node B in the communication byte cycle (except the start bit) is maintained within the low level threshold range, and the input pin of the NAND gate U2 connected to the node B is input with a low level, and the output of the NAND gate U2 (node C) is high, so that the RS485 transceiver chip state is in the sending state.
[0059] 4. When the data to be sent is sent, that is, the data is in an idle state: the node A is at a high level, the output of the buffer U1 is at a high level, the diode D1 is in a cut-off state, and the capacitor C1 is charged through the resistor R1; the node B returns to a high level, and the output pin (node C) of the NAND gate U2 is at a low level, so that the RS485 transceiver chip automatically switches to a receiving state.
[0060] The advantage of using this circuit is that it can realize automatic switching of the receiving and sending directions when the RS485 communication baud rate is greater than 500K. When the node A receives data, the node C switches from a low level to a high level with a small delay, and only a low level of the data start bit is required to ensure that the state of the node C always remains at a high level during the entire data transmission cycle, ensuring that the RS485 is in a sending state during the entire transmission cycle.
[0061] Further, when the RS485 communication baud rate is less than or equal to 500K, this circuit is also applicable. When the entire data transmission (single-ended signal to differential signal) cycle is greater than the charging cycle of the capacitor C1, during the data transmission process, the node B and the node A are both in a high level state, making the node C in a low level state. At this time, the RS485 transceiver chip is in a receiving state, and the RS485 A and B are in an input high-impedance input state. A is pulled to a high level by the pull-up resistor, and B is pulled to a low level by the pull-down resistor, satisfying AB>0, the 485 bus is in a logic 1 state, and the 485 end differential level output is a logic 1 working state when the single-ended level sent is high.
[0062] Based on the technical solutions of the first and second aspects, this embodiment further provides a possible design three, such as Figure 5 As shown, in Figure 2 , Figure 3Based on the circuit for switching the receiving and transmitting direction of half-duplex serial communication shown in FIG, at the DI (driver input) pin of the half-duplex chip (assuming that the DI pin is node D, node D is Figure 4 At least one signal hysteresis chip U4 is connected in series before the fourth waveform collection point shown in the figure) (a plurality of signal hysteresis chips are cascaded, and the signal hysteresis chip can be implemented by, but not limited to, a voltage / current driver, a voltage follower, a voltage / current amplifier, an OC gate circuit, a push-pull output circuit, a Smith trigger, a photoelectric isolator, a magnetic coupling isolator, or a combination of the above chips)
[0063] Based on the technical solutions of the first and second aspects, this embodiment further provides a possible design 4, such as Figure 6 As shown, a circuit for switching the receiving and transmitting direction of half-duplex serial communication: a delay circuit composed of a resistor R1, a capacitor C1, and a diode D1, one end of the resistor R1 is connected to the node B, and the other end can also be connected to the node A, so that when point A is at a low level, the resistor R1 serves as a discharge path for the capacitor C1.
[0064] Based on the technical solutions of the first and second aspects, this embodiment further provides a possible design 5, such as Figure 7 As shown, a circuit for switching the receiving and sending direction of half-duplex serial communication: a delay circuit composed of a resistor R1, a capacitor C1, and a diode D1, wherein the resistor R1 can also be directly connected in parallel with the diode D1, so that when the output of U1 is at a low level, the resistor R1 serves as a discharge path for the capacitor C1.
[0065] Based on the technical solutions of the first and second aspects, this embodiment further provides a possible design six, such as Figure 8 As shown, the circuit for switching the receiving and transmitting direction of half-duplex serial communication: wherein the input circuit is implemented by a voltage follower formed by an operational amplifier U1.
[0066] Based on the technical solutions of the first and second aspects, this embodiment further provides a possible design seven, such as Fig. 9 As shown, the circuit for switching the receiving and transmitting direction of half-duplex serial communication: wherein the input circuit is implemented by a Smith trigger U1, and the output circuit is implemented by a NOT-OR gate U2.
[0067] Finally, it should be noted that the utility model is not limited to the above optional implementation methods. Anyone can derive other various forms of products under the inspiration of the utility model. The above specific implementation methods should not be understood as limiting the scope of protection of the utility model. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the utility model should be included in the scope of protection of the utility model. The scope of protection of the utility model shall be based on the definition in the claims, and the description can be used to interpret the claims.
Claims
1. A circuit for switching the receiving and sending direction of half-duplex serial communication, characterized in that The circuit comprises: an input circuit, a level delay circuit, and an output circuit; The input circuit is used to increase the driving capability of the input single-ended signal and isolate the influence of the level delay circuit on the input single-ended signal. The input circuit is provided with an input port and an output port; The level delay circuit is used to extend the low level holding time of the input single-ended signal, and the level delay circuit is provided with at least one input port and one output port; The output circuit is used to set the direction of the circuit for the half-duplex serial communication receiving and sending direction. The output circuit is provided with at least two input ports and one output port. The working logic of the output circuit is: when all its input ports input high level, its output port outputs low level, otherwise its output port outputs high level; The connection relationship between the input circuit, the level delay circuit, and the output circuit is as follows: Two input port states are set for the level delay circuit: the input port of the input circuit, one of the input ports of the level delay circuit, and one of the input ports of the output circuit are connected to each other, the output port of the input circuit is connected to another input port of the level delay circuit, and the output port of the level delay circuit is connected to another input port of the output circuit; When the level delay circuit sets an input port state: the input port of the input circuit is connected to one of the input ports of the output circuit, the output port of the input circuit is connected to an input port of the level delay circuit, and the output port of the level delay circuit is connected to another input port of the output circuit.
2. The circuit for switching the receiving and transmitting direction of half-duplex serial communication as claimed in claim 1, characterized in that , the input circuit can be any one of but not limited to a voltage / current driver, a voltage follower, a voltage / current amplifier, a buffer gate circuit, an OC gate circuit, a push-pull output circuit, a Smith trigger, a photoelectric isolator, and a magnetic coupling isolator.
3. The circuit for switching the receiving and transmitting direction of half-duplex serial communication as claimed in claim 1, characterized in that , the level delay circuit includes a diode D1, a resistor R1 and a capacitor C1; For the level delay circuit, two input port states are set: The cathode of the diode D1 serves as an input port of the level delay circuit and is connected to the output port of the input circuit. The anode of the diode D1 is connected to one end of the resistor R1 and one end of the capacitor C1 as the output port of the level delay circuit. The other end of the resistor R1 serves as another input port of the level delay circuit and is connected to the input port of the input circuit. The other end of the capacitor C1 is grounded. For the level delay circuit, an input port state is set: The cathode of the diode D1 serves as an input port of the level delay circuit and is connected to the output port of the input circuit. The anode of the diode D1 is connected to one end of the resistor R1 and one end of the capacitor C1 as the output port of the level delay circuit. The other end of the resistor R1 is connected to a power supply or the cathode of the diode D1, and the other end of the capacitor C1 is grounded.
4. The circuit for switching the receiving and transmitting direction of half-duplex serial communication as claimed in claim 1, characterized in that: The output circuit is specifically a NAND gate circuit or other circuits that can meet the working logic of the output circuit.
5. The circuit for switching the receiving and transmitting direction of half-duplex serial communication as claimed in claim 1, characterized in that: A waveform hysteresis circuit is connected in series between the single-ended serial receiving data line and the single-ended data receiving end of the half-duplex transceiver chip, which is used to lag the waveform for a certain time in time to ensure that the transmitted data signal arrives at the corresponding pin of the half-duplex transceiver chip later than the transmitting and receiving direction control signal.
