CN112799989B - Interface switching circuit and communication device - Google Patents

Interface switching circuit and communication device Download PDF

Info

Publication number
CN112799989B
CN112799989B CN202011637919.3A CN202011637919A CN112799989B CN 112799989 B CN112799989 B CN 112799989B CN 202011637919 A CN202011637919 A CN 202011637919A CN 112799989 B CN112799989 B CN 112799989B
Authority
CN
China
Prior art keywords
interface
circuit
pin
switching
transmission
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
CN202011637919.3A
Other languages
Chinese (zh)
Other versions
CN112799989A (en
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.)
Shenzhen Xbrother Technology Co ltd
Original Assignee
Shenzhen Xbrother 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 Shenzhen Xbrother Technology Co ltd filed Critical Shenzhen Xbrother Technology Co ltd
Priority to CN202011637919.3A priority Critical patent/CN112799989B/en
Publication of CN112799989A publication Critical patent/CN112799989A/en
Application granted granted Critical
Publication of CN112799989B publication Critical patent/CN112799989B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4004Coupling between buses
    • G06F13/4022Coupling between buses using switching circuits, e.g. switching matrix, connection or expansion network

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Computer Hardware Design (AREA)
  • General Physics & Mathematics (AREA)
  • Dc Digital Transmission (AREA)

Abstract

The invention provides an interface switching circuit and a communication device, wherein the interface switching circuit is used for being connected with a main control circuit and an RS485 interface or an RS232 interface and comprises an isolating circuit, a switching circuit, a driving circuit, an interface circuit, an RS485 transmission circuit and an RS232 transmission circuit, the RS485 interface or the RS232 interface accessed by the interface circuit outputs an identification signal to the RS232 transmission circuit according to the type of the accessed interface, the RS232 transmission circuit outputs a switching signal to the driving circuit and the switching circuit according to the identification signal, the driving circuit outputs a driving signal to the interface circuit according to the switching signal, and the interface circuit is switched to the RS485 transmission circuit or the RS232 transmission circuit according to the driving signal; the switching circuit switches the RS485 transmission circuit or the RS232 transmission circuit according to the switching signal and accesses the isolation circuit, the isolation circuit performs isolation transmission communication with the main control circuit for the RS485 interface or the RS232 interface and performs power isolation transmission, and identification and communication switching of the RS232 interface and the RS485 interface are achieved.

Description

Interface switching circuit and communication device
Technical Field
The present invention relates to the field of communications, and in particular, to an interface switching circuit and a communications apparatus.
Background
At present, the communication interfaces RS232 and RS485 are common communication interfaces, and a corresponding electrical interface is output by a UART (TTL) level of an MCU through a special RS232 or RS485 level conversion chip. However, different physical interfaces (i.e., RS232 or RS485) are required to be connected to the corresponding electrical interfaces respectively due to different electrical characteristics of the different electrical interfaces.
If the existing scheme needs to be compatible with two communication interfaces, the wiring needs to be manually exchanged manually or two paths of UART resources corresponding to the MCU need to be occupied according to the characteristics of the electrical interfaces.
Thus, the prior art has yet to be improved and enhanced.
Disclosure of Invention
In view of the above disadvantages of the prior art, the present invention is to provide an interface switching circuit and a communication device, which implement identification and communication switching of an RS232 interface and an RS485 interface.
In order to achieve the purpose, the invention adopts the following technical scheme:
the invention provides an interface switching circuit, which is used for being connected with a master control circuit and an RS485 interface or an RS232 interface and comprises an isolation circuit, a switching circuit, a driving circuit, an interface circuit, an RS485 transmission circuit and an RS232 transmission circuit, wherein the RS485 interface or the RS232 interface accessed by the interface circuit outputs an identification signal to the RS232 transmission circuit according to the type of the accessed interface, the RS232 transmission circuit outputs a switching signal to the driving circuit and the switching circuit according to the identification signal, the driving circuit outputs a driving signal to the interface circuit according to the switching signal, and the interface circuit switches to the RS485 transmission circuit or the RS232 transmission circuit according to the driving signal; and the switching circuit switches the RS485 transmission circuit or the RS232 transmission circuit according to the switching signal and accesses the isolation circuit, and the isolation circuit performs isolation transmission communication with the main control circuit for the RS485 interface or the RS232 interface and performs power isolation transmission.
The interface circuit comprises a first interface which is used for being connected with the RS232 interface or the RS485 interface; and the interface switching unit is used for being connected with the first interface and connecting the RS232 interface or the RS485 interface into the RS485 transmission circuit or the RS232 transmission circuit.
The isolation circuit comprises a power isolation unit for performing power isolation power supply; and the signal isolation unit is used for carrying out signal isolation transmission.
The RS232 transmission circuit comprises an RS232 chip unit, a first trigger and an OR gate, the RS232 chip unit outputs a corresponding first selection signal to the first trigger according to the identification signal, the first trigger outputs a first switching signal to the switching circuit for mode switching after passing through the OR gate, and the RS232 chip unit performs communication transmission between the RS232 interface and the mainboard when the first interface is connected to the RS232 interface.
The RS485 transmission circuit comprises an RS485 chip unit and a second trigger, and the RS485 chip unit is used for carrying out communication transmission between the RS485 interface and the mainboard when being connected into the isolation circuit and the interface circuit.
The driving circuit comprises a first resistor and a first transistor, one end of the first resistor and the control end of the first transistor are connected with the first trigger and the RS232 chip unit, the input end of the first transistor is connected with the interface circuit, and the other end of the first resistor and the output end of the first transistor are grounded.
The interface switching unit includes first relay and third diode, the 1 st foot of first relay with the output of power isolation unit and third diode D3's output are connected, the 8 th foot of first relay with drive circuit and third diode D3's input are connected, the 2 nd foot and the 7 th foot of first relay all are connected with RS485 transmission circuit, the 4 th foot and the 5 th foot of first relay all with RS232 transmission circuit connects, the 3 rd foot of first relay with the 1 st foot of first interface is connected, the 6 th foot of first relay with the 2 nd foot of first interface is connected.
The switching circuit comprises an analog switch chip, the 1 st pin and the 5 th pin of the analog switch chip are connected with the driving circuit, the 2 nd pin and the 4 th pin of the analog switch chip are connected with the RS232 chip unit, the 7 th pin and the 9 th pin of the analog switch chip are connected with the RS485 chip unit, the 6 th pin and the 10 th pin of the analog switch chip are connected with the signal isolation unit, the 8 th pin of the analog switch chip is connected with the power isolation unit, and the 3 rd pin of the analog switch is grounded.
The interface circuit further comprises an electrostatic protection unit which is connected with the first interface and the interface switching unit and used for performing electrostatic protection.
Based on the interface switching circuit, the invention also provides a communication device, which comprises a device body, wherein the device body is internally provided with a circuit board, and the circuit board is provided with the interface switching circuit.
Compared with the prior art, the interface switching circuit and the communication device provided by the invention have the advantages that the interface switching circuit is used for being connected with the main control circuit and the RS485 interface or the RS232 interface, and comprises the isolation circuit, the switching circuit, the driving circuit, the interface circuit, the RS485 transmission circuit and the RS232 transmission circuit, the RS485 interface or the RS232 interface accessed by the interface circuit outputs the identification signal to the RS232 transmission circuit according to the type of the accessed interface, the RS232 transmission circuit outputs the switching signal to the driving circuit and the switching circuit according to the identification signal, the driving circuit outputs the driving signal to the interface circuit according to the switching signal, and the interface circuit switches to the RS485 transmission circuit or the RS232 transmission circuit according to the driving signal; the switching circuit switches the RS485 transmission circuit or the RS232 transmission circuit according to the switching signal and accesses the isolation circuit, the isolation circuit performs isolation transmission communication with the main control circuit for the RS485 interface or the RS232 interface, and performs power isolation transmission, so that the identification and communication switching of the RS232 interface and the RS485 interface are realized.
Drawings
Fig. 1 is a block diagram of an interface switching circuit according to the present invention;
fig. 2 is a schematic structural diagram of an interface switching circuit according to the present invention;
FIG. 3 is a circuit diagram of an isolation circuit provided by the present invention;
fig. 4 is a circuit diagram of an interface switching circuit provided in the present invention.
Detailed Description
The invention provides an interface switching circuit and a communication device, which realize the identification and communication switching of an RS232 interface and an RS485 interface.
The embodiments of the present invention are intended to explain technical concepts of the present invention, technical problems to be solved, technical features constituting technical solutions, and technical effects to be brought about in more detail. The embodiments are explained below, but the scope of the present invention is not limited thereto. Further, the technical features of the embodiments described below may be combined with each other as long as they do not conflict with each other.
According to the existing scheme, if two communication interfaces of RS485 and RS232 need to be compatible, the wiring needs to be manually exchanged manually or two paths of UART resources corresponding to an MCU need to be occupied according to the characteristics of an electrical interface.
In view of the above problems in the prior art, referring to fig. 1, the present invention provides an interface switching circuit 200 for connecting with a main control circuit 700 and an RS485 interface or an RS232 interface, including an isolation circuit 100, a switching circuit 200, a driving circuit 500, an interface circuit 600, an RS485 transmission circuit 300, and an RS232 transmission circuit 400. The RS485 transmission circuit 300 and the RS232 transmission circuit 400 are both connected with the switching circuit 200 and the interface circuit 600, the RS232 transmission circuit 400 is also connected with the driving circuit 500, the switching circuit 200 is also connected with the isolation circuit 100, the isolation circuit 100 is also connected with the main control circuit 700, and the interface circuit 600 is also used for being connected with an external RS485 interface or an external RS232 interface.
The RS485 interface or the RS232 interface accessed by the interface circuit 600 outputs an identification signal to the RS232 transmission circuit 400 according to the type of the accessed interface. When the RS232 transmission circuit 400 receives the identification signal, the identification signal is converted into a switching signal, and the switching signal is output to the driving circuit 500 and the switching circuit 200. After receiving the switching signal, the driving circuit 500 outputs a driving signal to the interface circuit 600 according to the switching signal, and drives the interface circuit 600 to switch to the RS485 transmission circuit 300 or the RS232 transmission circuit 400 according to the driving signal; that is, when the interface circuit 600 is connected to the RS232 interface, the interface circuit 600 is connected to the RS232 transmission circuit 400 according to the driving signal, and when the interface circuit 600 is connected to the RS485 interface, the interface circuit 600 is connected to the RS485 transmission circuit 300 according to the driving signal. Finally, after the switching circuit 200 receives the switching signal, the switching circuit 200 switches the RS485 transmission circuit 300 or the RS232 transmission circuit 400 according to the switching signal and accesses the isolation circuit 100, and then the isolation circuit 100 performs isolation transmission communication with the main control circuit 700 for the RS485 interface or the RS232 interface, and performs power isolation transmission. The mode switching of the RS485 interface or the RS232 interface is realized, the two interfaces are compatible, and manual wire replacement is not needed.
Specifically, the main control circuit 700 may be a main control device such as an MCU, a controller, a CPU, a PLC, or an FPGA.
Further, referring to fig. 2, the interface circuit 600 includes a first interface J1 for connecting with the RS232 interface or the RS485 interface; and an interface switching unit 610 for connecting the first interface J1 and connecting the RS232 interface or the RS485 interface to the RS485 transmission circuit 300 or the RS232 transmission circuit 400.
In specific implementation, in this embodiment, the first interface J1 is connected to an RS232 interface or an RS485 interface, and when the first interface J1 is connected to the RS232 interface, an identification signal is output to the RS232 transmission circuit 400 according to characteristics of the RS232 interface, the RS232 transmission circuit 400 outputs a switching signal, and the driving circuit 500 connects the RS232 interface to the corresponding RS232 transmission circuit 400 for communication transmission. Similarly, when the first interface J1 is connected with the RS485 interface, the RS485 interface is connected with the RS485 transmission circuit 300 for communication transmission, so that matching between two different electrical interfaces and physical interfaces is realized, and manual wire replacement is not needed.
Further, referring to fig. 1 and fig. 3, the isolation circuit 100 includes a power isolation unit 110 for performing power isolation power supply; and a signal isolation unit 120 for signal isolation transmission.
In specific implementation, in this embodiment, the power isolation unit 110 is configured to access a power supply and transmit the power supply to each circuit in an isolated manner to supply power, so as to meet a power supply requirement. The signal isolation unit 120 is used for performing signal isolation transmission for communication between the main control circuit 700 and the RS232 interface or the RS485 interface. The signal isolation is realized, and the anti-interference capability of the whole circuit is improved.
Further, referring to fig. 2 and 4, the RS232 transmission circuit 400 includes an RS232 chip unit 410, a first flip-flop U2 and an or gate 620, the RS232 chip unit 410 outputs a corresponding first selection signal to the first flip-flop U2 according to the identification signal, the first flip-flop U2 outputs a first switching signal to the switching circuit 200 through the or gate 620 for mode switching, and the RS232 chip unit 410 performs communication transmission between the RS232 interface and a motherboard when the first interface J1 is connected to the RS232 interface.
In specific implementation, in this embodiment, when the first interface J1 is connected to the RS232 interface, the RS232 chip unit 410 receives a first identification signal, converts the first identification signal into a corresponding first selection signal, outputs the first selection signal to the first flip-flop U2, performs a corresponding or operation on the first flip-flop U2 to obtain a first switching signal, and outputs the first switching signal to the driving circuit 500 and the switching circuit 200. Finally, the driving circuit 500 outputs a first driving signal to the interface switching unit 610, the RS232 interface is accessed to the RS232 chip unit 410, and the RS232 chip unit 410 performs corresponding data processing to implement communication transmission between the RS232 interface and the main control circuit 700.
Specifically, as shown in fig. 4, the RS232 chip unit 410 includes an RS232 chip U1, a first capacitor C1, a second capacitor C2, a third capacitor C3, a fourth capacitor C4, and a fifth capacitor C5; the RS232 transmission circuit 400 further includes a sixth capacitor C6, a seventh capacitor C7, a second resistor R2, a third resistor R3, a fourth resistor R4 and a fifth resistor R5, and the or gate 620 includes a first diode D1 and a second diode D2;
the first pin 1 of the RS232 chip U1 is connected to one end of the first capacitor C1, the first pin 3 of the RS232 chip U1 is connected to the other end of the first capacitor C1, the second pin 2 of the RS232 chip U1 is connected to one end of the second capacitor C2, the other end of the second capacitor C2 is connected to the power isolation unit 110, the first pin 4 of the RS232 chip U1 is connected to one end of the third capacitor C3, the first pin 5 of the RS232 chip U1 is connected to the other end of the third capacitor C3, the sixth pin of the RS232 chip U1 is connected to one end of the fourth capacitor C4, the other end of the fourth capacitor C4 is grounded, the first pin 8 of the RS232 chip U1 is connected to the first pin of the first interface J1 and the interface switching unit 610, the first pin 9 and the input end of the first diode D1 of the RS232 chip U6 are connected to the first pin 2, and the first pin receiving terminal (RS 3611) of the switching circuit U2 is connected to the first pin (3611) and the first pin receiving circuit (3611) and the switching circuit U3611) and the first pin receiving terminal (3611) and the switching circuit A 13 th pin (a receiving pin) and a 14 th pin (a transmitting pin) of the RS232 chip U1 are both connected to the RS485 transmission circuit 300, a sixteenth pin (a power pin) of the RS232 chip U1 is connected to the output terminal of the power isolation unit 110 and one end of the fifth capacitor C5, and a fifteenth pin of the RS232 chip U1 and the other end of the fifth capacitor C5 are both grounded; a pin 2 of the first flip-flop U2 is connected to one end of the second resistor R2, a pin 3 of the first flip-flop U2 is connected to one end of the third resistor R3, the other ends of the second resistor R2 and the third resistor R3 are both connected to an output terminal of the power isolation unit 110, a pin 16 of the first flip-flop U2 is connected to one end of the sixth capacitor C6, one end of the fourth resistor R4, and one end of the fifth resistor R5, the other end of the fourth resistor R4 is connected to a pin 15 of the first flip-flop U2 and one end of a seventh capacitor C7, the other end of the fifth resistor R5 is connected to a pin 13 of the first flip-flop U2 and an input terminal of the second diode D2, the other end of the seventh capacitor C7 is connected to a pin 14 of the first flip-flop U2, and the other ends of the first capacitor C2, the first diode 1, the second diode 2 and the output terminal of the first diode 2 are both connected to ground.
Further, referring to fig. 2 and fig. 4, the RS485 transmission circuit 300 includes an RS485 chip unit 310 and a second flip-flop U4, and when the RS485 chip unit 310 is connected to the isolation circuit 100 and the interface circuit 600, the RS485 interface communicates with the motherboard.
In specific implementation, in this embodiment, when the first interface J1 is connected to the RS485 interface, the RS232 chip unit 410 receives a second identification signal, outputs a second selection signal corresponding to the second identification signal to the first flip-flop U2, performs corresponding or operation on the first flip-flop U2 to obtain a second switching signal, and outputs the second switching signal to the driving circuit 500 and the switching circuit 200, the driving circuit 500 outputs a corresponding second driving signal to drive the interface switching unit 610, the RS485 interface is connected to the RS485 chip unit 310, and the RS485 chip unit 310 performs corresponding data processing, so as to implement communication transmission between the RS485 interface and the main control circuit 700.
Specifically, referring to fig. 4, the RS485 chip unit 310 includes an RS485 chip U3, a sixth resistor R6, a seventh resistor R7, an eighth resistor R8, a ninth resistor R9, an eighth capacitor C8, and a ninth capacitor C9, and the RS485 transmission circuit 300 further includes a tenth resistor R10, an eleventh resistor R11, a twelfth resistor R12, a thirteenth resistor R13, and a tenth capacitor C10. The 1 st pin and the 4 th pin of the RS485 chip U3 are both connected to the switching circuit 200, the 5 th pin of the RS485 chip U3 is grounded, the 6 th pin of the RS485 chip U3 is connected to one end of the sixth resistor R6 and one end of the seventh resistor R7, the other end of the sixth resistor R6 is connected to the output end of the power isolation unit 110, the other end of the seventh resistor R7 is connected to the interface switching unit 610, the 7 th pin of the RS485 chip U3 is connected to one end of the eighth resistor R8 and one end of the ninth resistor R9, the eighth pin of the RS485 chip U3 is connected to the output end of the power isolation unit 110 and one end of the eighth capacitor C8, the other end of the eighth resistor R8 and the other end of the eighth resistor R8 are both grounded, and the other end of the ninth resistor R9 is connected to the interface switching unit 610; the 1 st pin of the second flip-flop U4 is connected to the 4 th pin of the RS485 chip U3 and the switching circuit 200, the 2 nd pin of the second flip-flop U4 is connected to one end of the tenth resistor R10, the 3 rd pin of the second flip-flop U4 is connected to one end of the eleventh resistor R11, the other end of the tenth resistor R10 and the other end of the eleventh resistor R11 are both connected to the output terminal of the power isolation unit 110, the 13 th pin of the second flip-flop U4 is connected to one end of the twelfth resistor R12 and the 2 nd pin and the 3 rd pin of the RS485 chip U3, the 14 th pin of the second flip-flop U4 is connected to one end of the ninth capacitor C9, the 15 th pin of the second flip-flop U4 and the other end of the ninth capacitor C9 are both connected to one end of the thirteenth resistor R13, and the second pin 16 of the second flip-flop U4 is connected to one end of the twelfth resistor R12, the twelfth pin R92, the twelfth pin of the twelfth capacitor R638, and the other end of the resistor R638, The other end of the thirteenth resistor R13 is connected to the output terminal of the power isolation unit 110, and the 8 th pin of the second flip-flop U4 and the other end of the tenth capacitor C10 are both grounded.
Further, with reference to fig. 4, the driving circuit 500 includes a first resistor R1 and a first transistor Q1, wherein one end of the first resistor R1 and a control end of the first transistor Q1 are both connected to the first flip-flop U2 and the RS232 chip unit 410, an input end of the first transistor Q1 is connected to the interface circuit 600, and the other end of the first resistor R1 and an output end of the first transistor Q1 are grounded.
In this embodiment, in a specific implementation, the driving circuit 500 outputs corresponding switching signals to the first transistor Q1 through the first diode D1 and the second diode D2, so that the first transistor Q1 is turned on, and the interface switching unit 610 is controlled to switch the physical interface accessed by the first interface J1 to a corresponding electrical interface for connection, that is, when the first interface J1 is accessed to the RS232 interface, the RS232 interface is switched to the RS232 chip unit 410 through the interface switching unit 610, and when the first interface J1 is accessed to the RS485 interface, the RS485 interface is switched to the RS485 chip unit 310 through the interface switching unit 610. Specifically, the first transistor Q1 is a MOS transistor.
Further, referring to fig. 4, the interface switching unit 610 includes a first relay K1 and a third diode D3, a 1 st pin of the first relay K1 is connected to the output terminal of the power isolation unit 110 and the output terminal of the third diode D3, an 8 th pin of the first relay K1 is connected to the input terminals of the driving circuit 500 and the third diode D3 (an 8 th pin of the first relay K1 is connected to the input terminal of the first transistor Q1), a 2 nd pin and a 7 th pin of the first relay K1 are connected to the RS485 transmission circuit 300 (a 2 nd pin of the first relay K1 is connected to the other end of the ninth resistor R9, a 7 th pin of the first relay K1 is connected to the other end of the seventh resistor R7), a 4 th pin and a 5 th pin of the first relay K1 are connected to the RS232 transmission circuit 400 (a 4 th pin of the first relay K1 is connected to the RS chip 1, the 5 th pin of the first relay K1 is connected with the 14 th pin of the RS232 chip U1), the 3 rd pin of the first relay K1 is connected with the 1 st pin of the first interface J1, and the 6 th pin of the first relay K1 is connected with the 2 nd pin of the first interface J1.
In specific implementation, in this embodiment, after receiving the first switching signal, the first relay K1 attracts and connects the first interface J1 with the RS232 chip unit 410; and when the first relay K1 is turned off after receiving the second switching signal, the first interface J1 is connected with the RS485 chip unit 310.
Further, with continued reference to fig. 4, the switching circuit includes an analog switch chip U5, wherein the 1 st pin and the 5 th pin of the analog switch chip U5 are both connected to the driving circuit 500 (the 1 st pin and the 5 th pin of the analog switch chip U5 are specifically connected to the output terminals of the first diode D1 and the second diode D2), the 2 nd pin and the 4 th pin of the analog switch chip U5 are connected to the RS232 chip unit 410 (the 2 nd pin and the 4 th pin of the analog switch chip U5 are respectively connected to the 12 th pin and the 11 th pin of the RS232 chip U1), the 7 th pin and the 9 th pin of the analog switch chip U5 are connected to the RS485 chip unit 310 (the 7 th pin and the 9 th pin of the analog switch chip U5 are respectively connected to the 1 st pin and the 4 th pin of the RS485 chip U3), the 6 th pin and the 6 th pin of the analog switch chip U5 are connected to the isolation unit 120, the 8 th pin of the analog switch chip U5 is connected to the power isolation unit 110, and the 3 rd pin of the analog switch is grounded.
In specific implementation, in this embodiment, the analog switch chip U5 receives the first switching signal and the second switching signal, and switches the RS232 transmission circuit 400 or the RS485 transmission circuit 300 to the isolation circuit 100 according to the first switching signal or the second switching signal to communicate with the main control circuit 700, so that the switching of the electrical interface is realized without manual wire switching.
Further, with reference to fig. 3, the power isolation unit 110 includes an eleventh capacitor C11, a twelfth capacitor C12 and a thirteenth capacitor C13 of the power isolation chip U6. A pin 2 (power input pin) of the power isolation chip U6 and one end of the eleventh capacitor C11 are both connected with a 5V power supply, and a pin 4 (power output pin) of the power isolation chip U6 is connected with one end of the twelfth capacitor C12 and one end of the thirteenth capacitor C13, and outputs of the power isolation chip U6 are connected with each circuit to supply power; the other end of the eleventh capacitor C11, the other end of the twelfth capacitor C12, the other end of the thirteenth capacitor C13, and the 1 st pin and the 3 rd pin of the power isolation chip U6 are all grounded.
Further, with reference to fig. 3, the signal isolation unit 120 includes a signal isolation chip U7, a fourteenth capacitor C14 and a fifteenth capacitor C15. The 1 st pin of the signal isolation chip U7 is connected to one end of the fourteenth capacitor C14 and the 4 th pin of the power isolation chip U6, the other end of the fourteenth capacitor C14, the 4 th pin and the 5 th pin of the signal isolation chip U7 are both grounded, the 2 nd pin (receiving pin) and the 3 rd pin (transmitting pin) of the signal isolation chip U7 are respectively connected to the main control circuit 700, the 6 th pin and the 7 th pin of the signal isolation chip U7 are respectively connected to the 6 th pin and the 10 th pin of the analog switch chip U5, the 8 th pin of the signal isolation chip U7 is connected to one end of the fifteenth capacitor C15 and the 4 th pin of the power isolation chip U6, and the other end of the fifteenth capacitor C15 is grounded.
Further, referring to fig. 4, the interface circuit 600 further includes an electrostatic protection unit connected to the first interface J1 and the interface switching unit 610 for performing electrostatic protection. The first interface J1 is subjected to electrostatic protection by the electrostatic protection unit, so as to prevent electrostatic breakdown from damaging other circuit devices.
The electrostatic protection unit comprises a first electrostatic protection tube D4 and a second electrostatic protection tube D5, wherein the first end of the first electrostatic protection tube D4 is connected with the 2 nd pin of the first interface J1 and the 6 th pin of the first relay K1, the first end of the second electrostatic protection tube D5 is connected with the 1 st pin of the first interface J1 and the 3 rd pin of the first relay K1, and the second end of the first electrostatic protection tube D4 and the second end of the second electrostatic protection tube D5 are both grounded.
Specifically, for the technical solution of the present invention to be clearer, please refer to fig. 1 to 4, the following explains the principle of the overall circuit:
first, the first interface J1 accesses an external interface, and if the external interface is an RS232 interface, a first identification signal is generated to the 8 th pin of the RS232 chip U1. According to the transmission characteristics of RS232, when no data is transmitted (idle state), the 8 th pin of the RS232 chip U1 is default-5V, after passing through the RS232 chip U1, the voltage is converted to 1 of TTL level from pin 9 of the RS232 chip U1 (high level 5V, i.e. the first selection signal), and after passing through the first flip-flop U2 (default output level is 0), still at high level, the first switching signal at high level is obtained through the or gate 620, the analog switch chip U5 is controlled to be switched to the RS232 chip U1, namely, the common terminal of the analog switch chip U5 is connected to the normally open NO terminal (the No. 2 pin and the No. 4 pin of the analog switch chip U5), the common terminal and the normally closed NC point (the No. 7 terminal and the No. 8 terminal of the analog switch chip U5) are disconnected, the 6 th pin and the 10 th pin of the analog switch chip U5 are connected with the signal isolation chip U7, and serial port transmission is carried out between the signal isolation chip U7 and the main control circuit 700. Meanwhile, the first relay K1 is controlled by the first transistor Q1 to be switched to an RS232 chip U1, so that the RS232 chip U1 is connected with the first interface J1. When the RS232 has data transmission, the first selection signal also changes with the data change, and at this time, the SMIT _ IN signal with the changed high and low levels is branched to the first flip-flop U2 to output the delayed high level, and then the delayed high level is output after being subjected to the or gate 620 operation with the original SMIT _ IN signal, so as to maintain the RS232 state.
Further, when the external interface is switched to the RS485 interface, the first interface J1 outputs a second identification signal to the RS232 chip U1. According to the transmission characteristics of the RS485, when no data is transmitted (in an idle state), the second identification signal is at a high level, passes through the RS232 chip U1, is converted into 0 at a TTL level by the RS232 chip U1, and is output from the 9 th pin. After passing through the first flip-flop U2 (the default output level is "0"), the output level is still low, and then the or operation is performed through the or gate 620 to obtain the second switching signal of low level. The analog switch chip U5 and the first relay K1 are simultaneously switched to the RS485 state. And switching and outputting the RS485 signal to a first interface J1. When the RS485 has data communication, since the voltage of the 1 st pin of the first interface J1 is all positive (0V < VA <5V), according to the characteristics of the RS232 interface chip, the 9 th pin SMIT _ IN of the U6 is always low, i.e., the RS485 state is maintained.
The UART (TTL level) signal of the main control circuit 700 is electrically isolated, and then is connected to the common terminal of the analog switch chip U5U3, passes through the analog switch chip U5, then passes through the RS232 or RS485 interface chip, performs level conversion, and then reaches the first interface J1 through the first relay K1. According to the invention, the switching signal is generated by the RS232 chip U1, the communication mode is switched by the analog switch chip U5, the identification and communication switching of the RS232 interface and the RS485 interface are realized, two different electrical interfaces are matched with the physical interface, and manual line changing is not needed.
Based on the interface switching circuit, the invention also provides a communication device, which comprises a device body, wherein the device body is internally provided with a circuit board, and the circuit board is provided with the interface switching circuit. Since the interface switching circuit has been described in detail above, it is not described herein again.
In summary, the interface switching circuit and the communication device provided by the present invention are used for connecting with a main control circuit and an RS485 interface or an RS232 interface, and include an isolation circuit, a switching circuit, a driving circuit, an interface circuit, an RS485 transmission circuit and an RS232 transmission circuit, wherein the RS485 interface or the RS232 interface accessed by the interface circuit outputs an identification signal to the RS232 transmission circuit according to the type of the accessed interface, the RS232 transmission circuit outputs a switching signal to the driving circuit and the switching circuit according to the identification signal, the driving circuit outputs a driving signal to the interface circuit according to the switching signal, and the interface circuit switches to the RS485 transmission circuit or the RS232 transmission circuit according to the driving signal; the switching circuit switches the RS485 transmission circuit or the RS232 transmission circuit according to the switching signal and accesses the isolation circuit, the isolation circuit performs isolation transmission communication with the main control circuit for the RS485 interface or the RS232 interface, and performs power isolation transmission, so that the identification and communication switching of the RS232 interface and the RS485 interface are realized.
It should be understood that equivalents and modifications of the technical solution and inventive concept thereof may occur to those skilled in the art, and all such modifications and alterations should fall within the scope of the appended claims.

Claims (7)

1. An interface switching circuit is characterized by being used for being connected with a master control circuit and an RS485 interface or an RS232 interface, and comprising an isolation circuit, a switching circuit, a driving circuit, an interface circuit, an RS485 transmission circuit and an RS232 transmission circuit, wherein the interface circuit outputs an identification signal to the RS232 transmission circuit according to an accessed interface type, the RS232 transmission circuit outputs a switching signal to the driving circuit and the switching circuit according to the identification signal, the driving circuit outputs a driving signal to the interface circuit according to the switching signal, and the interface circuit switches to the RS485 transmission circuit or the RS232 transmission circuit according to the driving signal; the switching circuit switches the RS485 transmission circuit or the RS232 transmission circuit according to the switching signal and is connected to the isolation circuit, and the isolation circuit performs isolation transmission communication with the main control circuit for the RS485 interface or the RS232 interface and performs power isolation transmission;
the interface circuit comprises a first interface which is used for being connected with the RS232 interface or the RS485 interface; the interface switching unit is used for being connected with the first interface and connecting the RS232 interface or the RS485 interface into the RS232 transmission circuit or the RS485 transmission circuit;
the isolation circuit comprises a power isolation unit for power isolation and power supply and a signal isolation unit for signal isolation and transmission;
the interface switching unit comprises a first relay and a third diode D3, the 1 st pin of the first relay is connected with the output end of the power isolation unit and the output end of the third diode D3, the 8 th pin of the first relay is connected with the input ends of the driving circuit and the third diode D3, the 2 nd pin and the 7 th pin of the first relay are connected with the RS485 transmission circuit, the 4 th pin and the 5 th pin of the first relay are connected with the RS232 transmission circuit, the 3 rd pin of the first relay is connected with the 1 st pin of the first interface, and the 6 th pin of the first relay is connected with the 2 nd pin of the first interface.
2. The interface switching circuit according to claim 1, wherein the RS232 transmission circuit includes an RS232 chip unit, a first flip-flop and an or gate, the RS232 chip unit outputs a corresponding first selection signal to the first flip-flop according to the identification signal, the first flip-flop outputs a first switching signal to the switching circuit for mode switching after passing through the or gate, and the RS232 chip unit performs communication transmission between the RS232 interface and the motherboard when the first interface is connected to the RS232 interface.
3. The interface switching circuit according to claim 2, wherein the RS485 transmission circuit comprises an RS485 chip unit and a second trigger, and when the RS485 chip unit is connected to the isolation circuit and the interface circuit, the RS485 interface is in communication transmission with the motherboard.
4. The interface switching circuit according to claim 3, wherein the driving circuit comprises a first resistor and a first transistor, one end of the first resistor and a control end of the first transistor are both connected to the first flip-flop and the RS232 chip unit, an input end of the first transistor is connected to the interface circuit, and the other end of the first resistor and an output end of the first transistor are grounded.
5. The interface switching circuit according to claim 3, wherein the switching circuit includes an analog switch chip, the 1 st pin and the 5 th pin of the analog switch chip are both connected to the driving circuit, the 2 nd pin and the 4 th pin of the analog switch chip are connected to the RS232 chip unit, the 7 th pin and the 9 th pin of the analog switch chip are connected to the RS485 chip unit, the 6 th pin and the 10 th pin of the analog switch chip are connected to the signal isolation unit, the 8 th pin of the analog switch chip is connected to the power isolation unit, and the 3 rd pin of the analog switch chip is grounded.
6. The interface switching circuit according to claim 1, further comprising an electrostatic protection unit connected to the first interface and the interface switching unit for performing electrostatic protection.
7. A communication apparatus comprising an apparatus body, wherein a circuit board is disposed in the apparatus body, and the circuit board is provided with an interface switching circuit according to any one of claims 1 to 6.
CN202011637919.3A 2020-12-31 2020-12-31 Interface switching circuit and communication device Active CN112799989B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011637919.3A CN112799989B (en) 2020-12-31 2020-12-31 Interface switching circuit and communication device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011637919.3A CN112799989B (en) 2020-12-31 2020-12-31 Interface switching circuit and communication device

Publications (2)

Publication Number Publication Date
CN112799989A CN112799989A (en) 2021-05-14
CN112799989B true CN112799989B (en) 2022-02-18

Family

ID=75808844

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011637919.3A Active CN112799989B (en) 2020-12-31 2020-12-31 Interface switching circuit and communication device

Country Status (1)

Country Link
CN (1) CN112799989B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117909276A (en) * 2024-03-19 2024-04-19 四川华鲲振宇智能科技有限责任公司 Method for constructing RS232-RS485 switching circuit based on discrete device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101827209A (en) * 2009-11-27 2010-09-08 云南金隆伟业科技有限公司 High-definition video-circulating memory IP camera
CN102004714A (en) * 2010-12-10 2011-04-06 南京科远自动化集团股份有限公司 General type serial bus communication device
CN102110067A (en) * 2009-12-29 2011-06-29 深圳市金博联电力技术有限公司 Highly reliable RS232/RS485/RS422 mixing module for electric power FTU

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090128357A1 (en) * 2007-11-19 2009-05-21 Twsafe Inc. Network audio/video rescue system
DE102009044172A1 (en) * 2009-10-02 2011-04-07 Schneider Electric Automation Gmbh Communication converter for connecting an automation device with a personal computer and method for controlling the communication converter
CN106874234A (en) * 2017-04-11 2017-06-20 成都特斯拉云网络技术有限公司 Generating set multi-interface data Transmission system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101827209A (en) * 2009-11-27 2010-09-08 云南金隆伟业科技有限公司 High-definition video-circulating memory IP camera
CN102110067A (en) * 2009-12-29 2011-06-29 深圳市金博联电力技术有限公司 Highly reliable RS232/RS485/RS422 mixing module for electric power FTU
CN102004714A (en) * 2010-12-10 2011-04-06 南京科远自动化集团股份有限公司 General type serial bus communication device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《直流微电网关键技术研究综述》;李霞林 等;《中国电机工程学报》;20151222;第36卷(第1期);第2-17页 *

Also Published As

Publication number Publication date
CN112799989A (en) 2021-05-14

Similar Documents

Publication Publication Date Title
CN101916959B (en) Laser switching-off device and switching-off method thereof
CN101751368B (en) Single-board communication method, device and system
CN101404001B (en) Serial port signal and USB signal compatible control circuit board and communication data cable
CN109525475B (en) Single bus communication signal isolation circuit
CN112799989B (en) Interface switching circuit and communication device
CN208241832U (en) A kind of communication system
CN108963673B (en) Data line and data transmission system capable of being set based on OTG function charge and discharge
CN219552984U (en) Serial port multiplexing and protecting circuit
CN210490838U (en) Isolated communication circuit and system
CN113722259A (en) RS-485 and RS-232 shared interface circuit
JP2023502704A (en) Slave computers, connectors, slave computer assemblies and communication systems
CN114661646A (en) Serial port switching control circuit
CN108234262A (en) A kind of data/address bus based on optical fiber transmission extends device and method
CN114839897A (en) Multi-interface, input and output configurable wiegand communication expansion board
CN209543335U (en) A kind of circuit of the address HRP-configured slave device I2C
CN203149564U (en) Serial-port automatic switching device
CN102546841B (en) Multimode serial port communication system and implementation method thereof
CN201199349Y (en) Serial port level changer
CN212009319U (en) Bi-pass downloader circuit and communication system
CN216719086U (en) Electric energy meter communication isolation circuit, device and electric energy meter
CN215496017U (en) Power supply device of solid state disk and electronic equipment
CN214311370U (en) Multi-interface, input and output configurable wiegand communication expansion board
CN218482773U (en) Compatible circuit of power supply based on RS485 interface
CN219322401U (en) Half-duplex optical communication module and multi-device communication system thereof
CN113688079B (en) Multi-level switching circuit for realizing communication flow control

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant