CN220064804U - Single-wire-controlled RS485-RS232 switching circuit - Google Patents

Single-wire-controlled RS485-RS232 switching circuit Download PDF

Info

Publication number
CN220064804U
CN220064804U CN202321526863.3U CN202321526863U CN220064804U CN 220064804 U CN220064804 U CN 220064804U CN 202321526863 U CN202321526863 U CN 202321526863U CN 220064804 U CN220064804 U CN 220064804U
Authority
CN
China
Prior art keywords
chip
inverting
unit
uart
gate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202321526863.3U
Other languages
Chinese (zh)
Inventor
沈伟宏
童振龙
廖兴剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Xingzhong Wulian Technology Co ltd
Original Assignee
Xiamen Xingzhong Wulian Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Xingzhong Wulian Technology Co ltd filed Critical Xiamen Xingzhong Wulian Technology Co ltd
Priority to CN202321526863.3U priority Critical patent/CN220064804U/en
Application granted granted Critical
Publication of CN220064804U publication Critical patent/CN220064804U/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Semiconductor Integrated Circuits (AREA)

Abstract

The utility model discloses a single-wire controlled RS485-RS232 switching circuit, which comprises an RS232 chip, an RS485 chip, a mode switching unit, a UART transmitting end, a UART receiving end and a control end at the chip side, and a first differential signal end and a second differential signal end at the equipment side; when the control terminal inputs a high level, the RS485 chip is enabled; the RS232 chip is enabled when the control terminal inputs a low level. Through the control of the mode switching unit, the RS232 chip and the RS485 chip can work alternatively under the control of a single control line without mutual interference, thereby realizing the following steps: the RS232 chip and the RS485 chip share a group of UART interfaces, and the switching of the RS485 communication circuit and the RS232 communication circuit is realized through a single control signal, so that the occupation of MCU resources can be reduced; and the RS232 chip and the RS485 chip use the same interface to the outside, so that the structural space can be saved.

Description

Single-wire-controlled RS485-RS232 switching circuit
Technical Field
The utility model relates to the field of serial communication, in particular to a single-wire control RS485-RS232 switching circuit.
Background
RS232 or RS485 communication is commonly used in industrial environments, and many applications often use only one interface. The existing products are basically designed with RS232 or RS485 independently. This is not applicable in case of limited MCU or CPU resources. And the independent interface design can lead to the size of the product becoming larger, which is not beneficial to the installation in the space limit place.
Disclosure of Invention
In view of the above-mentioned drawbacks of the prior art, the present utility model aims to provide a single-wire controlled RS485-RS232 switching circuit, wherein the RS232 and RS485 chips share a set of UART interfaces, so as to reduce the occupation of MCU resources; and the same interface is used for the RS232 and the RS485, so that the structural space is saved.
In order to achieve the above purpose, the utility model provides a single-wire controlled RS485-RS232 switching circuit, which comprises an RS232 chip, an RS485 chip, a mode switching unit, a UART transmitting end, a UART receiving end and a control end at the chip side, and a first differential signal end and a second differential signal end at the equipment side; wherein:
the RS232 chip is provided with an enabling end and a switching-off end;
the RS485 chip is provided with a transmitting enabling end and a receiving enabling end;
the chip side data receiving ends of the RS232 chip and the RS485 chip are commonly connected to the UART receiving end;
the chip side data transmitting ends of the RS232 chip and the RS485 chip are commonly connected to the UART transmitting end;
the equipment side data receiving end of the RS232 chip and the non-inverting signal end of the RS485 chip are commonly connected to the first differential signal end;
the equipment side data receiving end of the RS232 chip and the inverting signal end of the RS485 chip are commonly connected to a second differential signal end;
the control end is connected with the turn-off end of the RS232 chip and is connected with the enabling end of the RS232 chip through the first inverting unit;
the mode switching unit comprises an AND gate unit, an OR gate unit and three inverting units;
the control end is connected with the input end of the second inverting unit and the first input end of the OR gate unit;
the output end of the second inverting unit is connected with one input end of the AND gate unit; the second input end of the AND gate unit is connected with the UART transmitting end, the output end of the AND gate unit is connected with the input end of the third inverting unit, and the output end of the third inverting unit is connected with the receiving enabling end of the RS485 chip;
the second input end of the OR gate unit is connected with the UART transmitting end, and the output end of the OR gate unit is connected with the input end of the fourth inverting unit; the output end of the fourth inverting unit is connected with the transmitting enabling end of the RS485 chip.
Further, the first inverting unit, the second inverting unit, the third inverting unit and the fourth inverting unit comprise a single-channel logic NOT circuit chip or a MOS switch circuit; the MOS switch circuit comprises an NMOS tube, wherein the grid electrode of the NMOS tube is an input end, the drain electrode of the NMOS tube is an output end, the NMOS tube is pulled up to a power supply through a resistor, and the source electrode of the NMOS tube is grounded.
Further, the first inverting unit comprises a MOS switch circuit, and the second inverting unit, the third inverting unit and the fourth inverting unit comprise single-channel logic NOT gate chips.
Further, the AND gate unit is a single-channel logic AND gate circuit chip.
Further, the or gate unit is a single-channel logic or gate circuit chip.
Further, the power supply voltage of the single-wire control RS485-RS232 switching circuit is 3.3V.
Further, the non-inverting signal end of the RS485 chip is pulled up to a power supply through a resistor, and the inverting signal end of the RS485 chip is grounded through the resistor; the non-inverting signal terminal and the inverting signal terminal are connected with a 120 ohm resistor.
Further, the equipment side data transmitting end of the RS232 chip is connected with the non-inverting signal end of the RS485 chip through a first resistor; the device side data receiving end of the RS232 chip is connected with the opposite-phase signal end of the RS485 chip through a second resistor, and the resistance values of the first resistor and the second resistor are equal and smaller than 30 ohms.
The utility model realizes the following technical effects:
according to the utility model, the RS232 chip and the RS485 chip share a group of UART interfaces, and the switching of the RS485 communication circuit and the RS232 communication circuit is realized through a single control signal, so that the occupation of MCU resources can be reduced; and the RS232 chip and the RS485 chip use the same interface to the outside, so that the structural space can be saved.
Drawings
Fig. 1 is a circuit schematic diagram of a single-wire controlled RS485-RS232 switching circuit of the present utility model.
Detailed Description
For further illustration of the various embodiments, the utility model is provided with the accompanying drawings. The accompanying drawings, which are incorporated in and constitute a part of this disclosure, illustrate embodiments and together with the description, serve to explain the principles of the embodiments. With reference to these matters, one of ordinary skill in the art will understand other possible embodiments and advantages of the present utility model.
The utility model will now be further described with reference to the drawings and detailed description.
As shown in FIG. 1, the utility model provides a single-wire control RS485-RS232 switching circuit, wherein an RS232 chip U4 and an RS485 chip U7 share a group of UART interfaces, so that the occupation of MCU resources is reduced; and the same interface is externally used by the RS232 chip U4 and the RS485 chip U7, so that the structural space is saved.
Specifically, the single-wire controlled RS485-RS232 switching circuit comprises two serial communication signals UART_TXD and UART_RXD at the chip sides, two differential signals RS485_ A, RS485_B at the equipment sides and a control signal RS232_SHDN; the system also comprises an RS232 chip U4, an RS485 chip U7 and a mode switching unit.
In the embodiment, the model of the RS232 chip U4 is SP3222EEY-L/TR; the model of the RS485 chip U7 is SN65HVD72DR.
The RS232 chip U4 is provided with an enabling end RS232 EN and a shutoff end RS232 SHDN;
the 15 th pin of the RS232 chip U4, the 485 chip U7 and the 1 st pin are commonly connected to the UART_RXD;
the 13 th pin of the RS232 chip U4 and the 4 th pin of the RS485 chip U7 are commonly connected to the UART_TXD;
the 16 th pin (RS 232_RXD) of the RS232 chip U4 and the 7 th pin (RS 485_D-) of the RS485 chip U7 are commonly connected to RS485_B;
the 17 th pin (RS232_TXD) of the RS232 chip U4 and the 6 th pin (RS485_D+) of the RS485 chip U7 are commonly connected to the RS485_A.
Specifically, in order to realize impedance matching, a resistor R3 of 120Ω is also bridged between the RS 485_D-and RS485_D+ signal lines, RS 485_D-is connected with RS232_RXD through a resistor R1, and RS232_RXD is connected to RS485_B through a fuse F1; the RS485_D+ is connected with the RS232_TXD through a resistor R4, and the RS232_TXD is connected with the RS485_A through a fuse F2. The resistances of the resistors R1, R4 are generally less than 30Ω, and preferably the resistances of the resistors R1, R4 are 10Ω or 22Ω.
Preferably, an equal protection device for a transient voltage suppression tube for overvoltage protection, such as D1 and D3, is also arranged between the RS232_RXD and the ground and between the RS232_TXD and the ground; a three-terminal discharge tube or the like, such as D2, is arranged between the rs485_ A, RS485_b and the ground.
The RS232_SHDN signal line of the RS232 chip U4 is a single control signal line connected with the MCU, and the RS232_SHDN is connected with the RS232_EN of the RS232 chip U4 through an inverting unit. In this embodiment, the inverting unit is implemented by a MOS switch circuit. The MOS switch circuit comprises a MOS tube Q1, wherein the grid electrode of the MOS tube Q1 is connected with an RS232_SHDN, the drain electrode of the MOS tube Q1 is connected with an RS232_EN, and the source electrode of the MOS tube Q1 is grounded.
In this embodiment, the mode switching unit includes one and gate unit U2, one or gate unit U5, and three inversion units U1, U3, U6;
the RS232_SHDN is connected with the input end of the inverting unit U1 and the first input end of the OR gate unit U5;
the output end of the inverting unit U1 is connected with one input end of the AND gate unit U2; the second input end of the AND gate unit U2 is connected with the UART_TXD, the output end of the AND gate unit U2 is connected with the input end of the inverting unit U3, and the output end of the inverting unit U3 is connected with the RS485_RE of the RS485 chip U7;
the second input end of the OR gate unit U5 is connected with the UART_TXD of the RS232, the output end of the OR gate unit U5 is connected with the input end of the NOT gate U6, and the output end of the inverter unit U6 is connected with the RS485_DE of the RS485 chip U7.
In this embodiment, in order to optimize product design and reduce product size, all logic gate units such as U1, U2, U3, U5, and U6 are single-channel logic gate chips.
The working principle of the circuit is as follows:
1. RS485 is enabled when RS232 SHDN is pulled low:
when RS232_SHDN is pulled low, Q1 is not conducted, RS232_EN is at high level, U4 cannot enter into working state, RS232_TXD and RS232_RXD are in high resistance state, and differential signals A and B on a shared interface are not affected.
At the same time: the RS232_SHDN is pulled down, the inverted output 1 of U1, the signals with the same level as the TXD are output through U2 and the upper UART_TXD, and the inverted output of U3 is carried out to obtain an RS485_RE control signal; the low level of the RS232_SHDN outputs a signal with the same level as TXD through U5 or upper UART_TXD, and then the signal is subjected to U6 inversion output to obtain an RS485_DE control signal.
When data is transmitted: when the UART_TXD transmits a state 0, the RS485_RE and the RS485_DE are controlled to be in a high level according to the logic control, the RS485 chip enters a transmission mode, and the A/B pin transmits logic '0'; when transmitting state 1, RS485 RE and RS485 DE are low, the chip will enter the receive mode, because R6 pulls a high and R5 pulls B low, so the a/B pin transmits a logic "1".
When receiving data: the UART_RXD pin of the MCU is used, the UART_TXD signal line is always in a high level in the receiving process, the signal lines of the RS485_RE and the RS485_DE are in a low level according to logic control, the U7 chip can enter a receiving mode, and the U7 chip receives signals on the A/B pin.
2. RS232 SHDN is enabled when RS232 is pulled high:
and (3) pulling RS232_SHDN high to enable Q1 to be conducted, enabling RS232_EN to be in a low level, and enabling U4 to enter a working state. At the same time: outputting 0 through U1 inversion, outputting 0 through U2, and outputting 1 through U3 inversion, namely RS485_RE is high level; after U5 outputs 1, U6 inverts to output 0, namely RS485_DE is low level. This makes the a/B pin of U7 in a high-impedance state, and has no effect on the RS232 TXD and the RS232 RXD on the common interface, and U4 can transmit and receive data normally.
The RS232 chip and the RS485 chip of the circuit share a group of UART interfaces, and the switching of the RS485 communication circuit and the RS232 communication circuit is realized through a single control signal, so that the occupation of MCU resources can be reduced; and the RS232 chip and the RS485 chip use the same interface to the outside, so that the structural space can be saved.
While the utility model has been particularly shown and described with reference to a preferred embodiment, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the utility model as defined by the appended claims.

Claims (8)

1. A single-wire control RS485-RS232 switching circuit is characterized in that: the device comprises an RS232 chip, an RS485 chip, a mode switching unit, a UART transmitting end, a UART receiving end and a control end on the chip side, and a first differential signal end and a second differential signal end on the equipment side; wherein:
the RS232 chip is provided with an enabling end and a switching-off end;
the RS485 chip is provided with a transmitting enabling end and a receiving enabling end;
the chip side data receiving ends of the RS232 chip and the RS485 chip are commonly connected to the UART receiving end;
the chip side data transmitting ends of the RS232 chip and the RS485 chip are commonly connected to the UART transmitting end;
the equipment side data receiving end of the RS232 chip and the non-inverting signal end of the RS485 chip are commonly connected to the first differential signal end;
the equipment side data receiving end of the RS232 chip and the inverting signal end of the RS485 chip are commonly connected to a second differential signal end;
the control end is connected with the turn-off end of the RS232 chip and is connected with the enabling end of the RS232 chip through the first inverting unit;
the mode switching unit comprises an AND gate unit, an OR gate unit and three inverting units;
the control end is connected with the input end of the second inverting unit and the first input end of the OR gate unit;
the output end of the second inverting unit is connected with one input end of the AND gate unit; the second input end of the AND gate unit is connected with the UART transmitting end, the output end of the AND gate unit is connected with the input end of the third inverting unit, and the output end of the third inverting unit is connected with the receiving enabling end of the RS485 chip;
the second input end of the OR gate unit is connected with the UART transmitting end, and the output end of the OR gate unit is connected with the input end of the fourth inverting unit; the output end of the fourth inverting unit is connected with the transmitting enabling end of the RS485 chip.
2. The single-wire controlled RS485-RS232 switching circuit according to claim 1, wherein: the first inverting unit, the second inverting unit, the third inverting unit and the fourth inverting unit comprise a single-channel logic NOT circuit chip or a MOS switch circuit; the MOS switch circuit comprises an NMOS tube, wherein the grid electrode of the NMOS tube is an input end, the drain electrode of the NMOS tube is an output end, the NMOS tube is pulled up to a power supply through a resistor, and the source electrode of the NMOS tube is grounded.
3. The single-wire controlled RS485-RS232 switching circuit according to claim 2, wherein: the first inverting unit comprises a MOS switch circuit, and the second inverting unit, the third inverting unit and the fourth inverting unit comprise single-channel logic NOT circuit chips.
4. The single-wire controlled RS485-RS232 switching circuit according to claim 1, wherein: the AND gate unit is a single-channel logic AND gate circuit chip.
5. The single-wire controlled RS485-RS232 switching circuit according to claim 1, wherein: the OR gate unit is a single-channel logic OR gate circuit chip.
6. The single-wire controlled RS485-RS232 switching circuit according to claim 1, wherein: the power supply voltage of the single-wire control RS485-RS232 switching circuit is 3.3V.
7. The single-wire controlled RS485-RS232 switching circuit according to claim 1, wherein: the non-inverting signal end of the RS485 chip is pulled up to a power supply through a resistor, and the inverting signal end of the RS485 chip is grounded through the resistor; the non-inverting signal terminal and the inverting signal terminal are connected with a 120 ohm resistor.
8. The single-wire controlled RS485-RS232 switching circuit according to claim 1, wherein: the device side data transmitting end of the RS232 chip is connected with the non-inverting signal end of the RS485 chip through a first resistor; the device side data receiving end of the RS232 chip is connected with the opposite-phase signal end of the RS485 chip through a second resistor, and the resistance values of the first resistor and the second resistor are equal and smaller than 30 ohms.
CN202321526863.3U 2023-06-15 2023-06-15 Single-wire-controlled RS485-RS232 switching circuit Active CN220064804U (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202321526863.3U CN220064804U (en) 2023-06-15 2023-06-15 Single-wire-controlled RS485-RS232 switching circuit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202321526863.3U CN220064804U (en) 2023-06-15 2023-06-15 Single-wire-controlled RS485-RS232 switching circuit

Publications (1)

Publication Number Publication Date
CN220064804U true CN220064804U (en) 2023-11-21

Family

ID=88788246

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202321526863.3U Active CN220064804U (en) 2023-06-15 2023-06-15 Single-wire-controlled RS485-RS232 switching circuit

Country Status (1)

Country Link
CN (1) CN220064804U (en)

Similar Documents

Publication Publication Date Title
CN101719112A (en) Half-duplex automatic receiving-transmitting switching circuit of RS485
CN105141491B (en) RS485 communication circuit and method for realizing spontaneous self-receiving
CN102169472B (en) RS485 bus interface circuit
CN207010674U (en) A kind of single-wire communication circuit
CN201557127U (en) RS485 half-duplex transmit-receive automatic switch circuit
CN107395243A (en) A kind of single-wire communication circuit
CN109600288B (en) Isolation circuit and electronic control unit of controller area network CAN signal
CN220064804U (en) Single-wire-controlled RS485-RS232 switching circuit
CN203191768U (en) Digital signal input circuit
CN204314873U (en) A kind of I2C buffer circuit and I2C bus system
CN203416256U (en) Differential balance MIL-STD-1553A/B signal repeater
CN111404504B (en) RS485 bus differential signal amplifier
CN206835123U (en) A kind of RS485 automatic receiving-transmitting switching circuits
CN210804414U (en) Circuit with reusable communication interface
CN112954534B (en) Full-integrated multifunctional charging pin control circuit and wireless earphone
CN209949101U (en) 485 communication is from receiving and dispatching circuit
CN204256735U (en) The nonpolarity RS-485 interface chip of the inner upper pull down resistor of band
CN210721160U (en) Temperature control circuit and temperature control device
CN106325187A (en) Digital output board, remote input output module and train control system
CN209767567U (en) Multi-master RS485 bus system
CN218633934U (en) High-speed 485 isolation self-transmitting and receiving circuit
CN207135081U (en) A kind of RS 485 communicates isolation protective circuit
CN201569170U (en) Communication system of gas water heater with function of stagger joint and remedy
CN104298212A (en) RS232 and RS485 compatible system
CN104375966A (en) Isolation control device and isolation control method for processor interface

Legal Events

Date Code Title Description
GR01 Patent grant
GR01 Patent grant