Search

CN-224203689-U - RS232 and RS485 switching circuit shared by source end and interface end

CN224203689UCN 224203689 UCN224203689 UCN 224203689UCN-224203689-U

Abstract

The utility model provides an RS232 and RS485 switching circuit shared by a source end and an interface end, which can enable the two communication modes of RS232 and RS485 to share the source end and the interface end under the condition of meeting the simultaneous demands of RS232 and RS485, thereby not only improving the utilization rate of MCU resources and saving the structural space, but also saving the project cost; the device comprises an isolation module, an RS232-RS485 communication module, a logic module and a communication switching module, wherein the isolation module is connected with a singlechip MCU and used for realizing digital signal isolation, the RS232-RS485 communication module is used for realizing RS232 communication and RS485 communication, the logic module is connected between the isolation module and the RS232-RS485 communication module so as to realize RS485 signal receiving and sending, and the communication switching module is connected with the singlechip MCU, the RS232-RS485 communication module and an output module and used for realizing RS232 or RS485 communication according to the output of the singlechip MCU and outputting through the output module.

Inventors

  • LI JIAN
  • HE JIANWEI
  • LI XIAOBING
  • CHEN XIAOBING
  • XIN DAYONG

Assignees

  • 江苏嘉擎信息技术有限公司

Dates

Publication Date
20260505
Application Date
20250722

Claims (6)

  1. 1. The RS232 and RS485 switching circuit shared by a source end and an interface end is characterized by comprising the following components: the isolation module is connected with the MCU and is used for realizing digital signal isolation; the RS232-RS485 communication module is used for realizing RS232 communication and RS485 communication; The logic module is connected between the isolation module and the RS232-RS485 communication module to realize the receiving and transmitting of RS485 signals; And the communication switching module is connected with the MCU, the RS232-RS485 communication module and the output module, and is used for realizing the communication of RS232 or RS485 according to the output of the MCU and outputting the communication through the output module.
  2. 2. The RS232 and RS485 switching circuit shared by a source end and an interface end according to claim 1, wherein the isolation module comprises an isolator U1, resistors R1-R4 and capacitors C1-C2, the isolator U1 is a digital isolation chip with a model NSi8121N1, a 1 pin of the isolator U1 is connected with one end of the resistor R1, the resistor R2 and one end of the capacitor C2 and then is connected with a system voltage of 3.3V, a 2 pin of the isolator U1 is connected with the other end of the resistor R2 and then is connected with the MCU through a port UART_RX, a 3 pin of the isolator U1 is connected with the other end of the resistor R1 and then is connected with the MCU through a port UART_TX, a 4 pin of the isolator U1 is connected with the other end of the capacitor C2 and then is grounded, an 8 pin of the isolator U1 is connected with one end of the capacitor C1 and then is connected with a voltage of 5V, a 2 pin of the isolator U1 is connected with one end of the resistor U1 and then is connected with the other end of the resistor U1, and then is connected with the other end of the resistor U1 is connected with the resistor R7.
  3. 3. The RS232 and RS485 switching circuit shared by a source end and an interface end according to claim 2, wherein the logic module comprises a NOT gate U2, resistors R5-R6 and a capacitor C3, the NOT gate U2 adopts a model SGM7SZ00YC5G logic chip, one end of the resistor R5 is connected with the other end of the resistor R3, the other end of the resistor R5 is connected with both pins 1 and 2 of the NOT gate U2, one end of the capacitor C3 is connected with pin3 of the NOT gate U2 and then grounded, the other end of the capacitor C3 is connected with pin5 of the NOT gate U2 and then connected with a power supply voltage 5V, and pin 4 of the NOT gate U2 is connected with one end of the resistor R6.
  4. 4. The RS232 and RS485 switching circuit shared by a source end and an interface end according to claim 3, wherein the RS232-RS485 communication module comprises an RS232 transceiver U3, an RS485 transceiver U4, capacitors C4-C9, resistors R7-R12 and TVS tubes D1-D4; the RS232 transceiver U3 adopts a model TI MAX3232IPW chip, the RS485 transceiver U4 adopts a model SN65HVD3082EDR chip, the other end of the resistor R6 is connected with the 2 pin and the 3 pin of the RS485 transceiver U4, the other end of the resistor R3 is connected with the 4 pin of the RS485 transceiver U4, the 1 pin of the RS485 transceiver U4 is connected with a power supply voltage 5V after passing through the resistor R7, the 8 pin of the RS485 transceiver U4 is connected with one end of the capacitor C9 and one end of the resistor R8 and then is connected with the power supply voltage 5V, the other end of the capacitor C9 is grounded, the 7 pin of the RS485 transceiver U4 is connected with one end of the resistor R9, the R10 and the R11 and one end of a uniform phase resistor R12 and one end of a TVS tube D3, the 6 pin of the RS485 transceiver U4 is connected with the other end of the resistor R8 and the other end of the uniform phase resistor R12, and the other end of the TVS tube D3 are connected with the TVS 4 and the TVS 4; the capacitor C4 is connected between the 1 and 3 pins of the RS232 transceiver U3, the 2 pin of the RS232 transceiver U3 is grounded after being connected with the capacitor C5, the capacitor C6 is connected between the 4 and 5 pins of the RS232 transceiver U3, the 6 pin of the RS232 transceiver U3 is grounded after being connected with the capacitor C7, the 16 pin of the RS232 transceiver U3 is connected with one end of the capacitor C13 and then is connected with the power supply voltage 5V, the 15 pin of the RS232 transceiver U3 is connected with the other end of the capacitor C13 and one end of the TVS tube D1 and D2 and then is grounded, the 14 pin of the RS232 transceiver U3 is connected with the other end of the TVS tube D2, and a 13 pin of the RS232 transceiver U3 is connected with the other end of the TVS tube D1, and a 11 pin of the RS232 transceiver U3 is connected with the other end of the resistor R3.
  5. 5. The RS232 and RS485 switching circuit shared by a source end and an interface end according to claim 4, wherein the communication switching module comprises an optocoupler U5, relays RL1 and RL2, resistors R13-R23, triodes Q1-Q2, a voltage regulator D5 and a voltage regulator D6, the output module comprises an interface CN1, the optocoupler U5 adopts a model 6N137S-TA1-L chip, 3 pins of the optocoupler U5 are connected with one ends of the resistors R13 and R14 through a port F00 EN, the other ends of the resistors R14 are grounded, 2 pins of the optocoupler U5 are connected with one end of the resistor R15, the other ends of the resistor R13 are connected with a system voltage 3.3V, 8 pins of the optocoupler U5 are connected with one ends of the resistors R16 and R17, the other ends of the optocoupler U5 are connected with a voltage 5V 5, the other ends of the pins of the optocoupler RL 16 are connected with the corresponding pins of the resistor R1, the other ends of the resistor RL1 and R1 are connected with the other ends of the resistor R1, the resistor RL 4 are connected with the other ends of the resistor R1, the other ends of the resistor RL1 and R14 are connected with the resistor R1, the other ends of the resistor RL1 and R1, the other ends of the resistor R1 and R14 are connected with the other ends of the resistor R1 and R1, the resistor R1 and R14 are connected with the other ends of the resistor 1, the resistor R1 and the resistor 1 and the other ends of the resistor R17 are connected with the resistor respectively, the resistor 1 and the other ends of the resistor is connected with the resistor 1, the resistor is connected with the resistor 1V 3V, the other end of the resistor R20 is connected to the base electrode of the triode Q2, the emitting electrode of the triode Q2 is grounded, the collecting electrode of the triode Q2 is connected with the positive electrode of the voltage stabilizing tube D6 and the 12 pins of the relay RL2, the negative electrode of the voltage stabilizing tube D6 is connected with the 1 pin of the relay RL2 and then is connected with the power supply voltage 5V, the 3 pin, the 4 pin and the 5 pin of the relay RL2 are respectively connected with one ends of the resistors R21, R22 and R23 correspondingly, the other end of the resistor R21 is connected with the 12 pin of the RS232 transceiver U3, the other end of the resistor R22 is connected with the other end of the resistor R4, and the other end of the resistor R23 is connected with the 1 pin of the RS485 transceiver U4.
  6. 6. The RS232 and RS485 switching circuit shared by a source end and an interface end, which is characterized by further comprising a voltage isolation circuit, wherein the voltage isolation circuit is connected with the isolation module, the logic module, the RS232-RS485 communication module and the communication switching module and is used for realizing power supply, the voltage isolation circuit comprises an isolation power module U6 and capacitors C10-C16, the isolation power module U6 adopts a type F0505S-1WR3 chip, a pin 1 of the isolation power module U6 is connected with one end of each of the capacitors C10, C11 and C12 and then is connected with a power supply voltage 5V, a pin 2 of the isolation power module U6 is connected with the other end of each of the capacitors C10, C11 and C12 and then is grounded, a pin 7 of the isolation power module U6 is connected with one end of each of the capacitors C14, C15 and C16, and a pin 5 of the isolation power module U6 is connected with the other end of each of the capacitors C13, C14, C15 and C16 and then is grounded.

Description

RS232 and RS485 switching circuit shared by source end and interface end Technical Field The utility model relates to the technical field of interface communication, in particular to an RS232 and RS485 switching circuit shared by a source end and an interface end. Background The RS485 and the RS232 are two communication interfaces which are widely applied in the industrial and electronic fields at present, the RS485 is half-duplex differential, multi-node communication and differential signal output are adopted to support long-distance multi-point communication, the RS232 is full-duplex single-ended and suitable for short-distance point-to-point communication, and because the two interfaces have different voltage definitions, the two interfaces can have mutual interference, so that the design of industrial control product equipment is mainly designed to be the RS232 interface or the RS485 interface separately according to the wish of manufacturers, but the design is a burden under the condition that MCU resource allocation and structural space are increasingly tense, namely 2 groups of UART are required to be allocated at the source end of the MCU, and the communication output end also needs respective corresponding interfaces, so that MCU resources cannot be effectively utilized, the project cost is increased, and the configuration of 2 functions cannot be realized simultaneously under the condition that the structural space is very tense. Disclosure of utility model In order to solve the problems, the utility model provides the RS232 and RS485 switching circuit shared by the source end and the interface end, which can enable the two communication modes of the RS232 and the RS485 to share the source end and the interface end under the condition of meeting the simultaneous demands of the RS232 and the RS485, thereby not only improving the utilization rate of MCU resources and saving the structural space, but also saving the project cost. The utility model adopts the following technical scheme that the RS232 and RS485 switching circuit shared by a source end and an interface end comprises: the isolation module is connected with the MCU and is used for realizing digital signal isolation; the RS232-RS485 communication module is used for realizing RS232 communication and RS485 communication; The logic module is connected between the isolation module and the RS232-RS485 communication module to realize the receiving and transmitting of RS485 signals; And the communication switching module is connected with the MCU, the RS232-RS485 communication module and the output module, and is used for realizing the communication of RS232 or RS485 according to the output of the MCU and outputting the communication through the output module. The isolation module further comprises an isolator U1, resistors R1-R4 and capacitors C1-C2, wherein the isolator U1 is a digital isolation chip with the model NSi8121N1, a pin 1 of the isolator U1 is connected with one end of the resistor R1, the resistor R2 and one end of the capacitor C2 and then connected with the system voltage 3.3V, a pin 2 of the isolator U1 is connected with the other end of the resistor R2 and then connected with the MCU through a port UART_RX, a pin 3 of the isolator U1 is connected with the other end of the resistor R1 and then connected with the MCU through a port UART_TX, a pin 4 of the isolator U1 is connected with the other end of the capacitor C2 and then connected with the ground, a pin 8 of the isolator U1 is connected with one end of the capacitor C1 and then connected with the power supply voltage 5V, a pin 5 of the isolator U1 is connected with the other end of the capacitor C1 and then connected with the MCU, and a pin 7 of the isolator U1 is connected with one end of the resistor R4 and then connected with one end of the resistor R3; further, the logic module comprises a NOT gate U2, resistors R5-R6 and a capacitor C3, wherein the NOT gate U2 adopts a model SGM7SZ00YC5G logic chip, one end of the resistor R5 is connected with the other end of the resistor R3, the other end of the resistor R5 is connected with both pins 1 and 2 of the NOT gate U2, one end of the capacitor C3 is connected with pin 3 of the NOT gate U2 and then grounded, the other end of the capacitor C3 is connected with pin 5 of the NOT gate U2 and then connected with a power supply voltage 5V, and pin 4 of the NOT gate U2 is connected with one end of the resistor R6; Further, the RS232-RS485 communication module comprises an RS232 transceiver U3, an RS485 transceiver U4, capacitors C4-C9, resistors R7-R12 and TVS tubes D1-D4; the RS232 transceiver U3 adopts a model TI_MAX3232IPW chip, the RS485 transceiver U4 adopts a model SN65HVD3082EDR chip, the other end of the resistor R6 is connected with the 2 pin and the 3 pin of the RS485 transceiver U4, the other end of the resistor R3 is connected with the 4 pin of the RS485 transceiver U4, the 1 pin of the RS485 transceiver U4 is connecte