TTL and RS232 intelligent automatic switching circuit
By designing an intelligent automatic switching circuit between TTL and RS232, and using a switch and signal acquisition circuit to determine the interface type, the problem of incorrect communication interface insertion was solved, and the reliability of electronic equipment was improved.
Patent Information
- Application Number
- CN202520763003.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2026-05-01
- Estimated Expiration
- 2035-04-21
AI Technical Summary
In the manufacturing process of electronic devices, it is easy to make a mistake by plugging the communication interface plug in the wrong position, which can cause the electronic device to malfunction.
A smart automatic switching circuit for TTL and RS232 was designed. The communication interface type is determined by a switch and a signal acquisition circuit, and the control switch is turned on or off to ensure that the RS232 communication interface is connected to the RS232 signal transceiver circuit and the TTL communication interface is connected to the TTL signal transceiver circuit.
It enables accurate connection of communication interfaces, avoids incorrect plug insertion, and improves the reliability and production efficiency of electronic equipment.
Smart Images

Figure CN224190496U_ABST
Abstract
Description
A circuit for intelligent automatic switching between TTL and RS232 Technical Field
[0001] This utility model relates to the field of electronic circuits. More specifically, this utility model relates to a circuit for intelligent automatic switching between TTL and RS232. Background Technology
[0002] Electronic devices are devices that utilize electronic components to perform specific functions and are widely used in various fields. During the production of electronic devices, various types of communication interfaces are typically installed on the circuit boards to enable data transmission and sending. A communication interface is a combination of hardware and software used for data transmission between devices. It defines how devices connect, the format, rate, and synchronization methods of the transmitted data.
[0003] In the manufacturing process of electronic devices, a single circuit board typically features multiple communication interfaces. These interfaces usually include several TTL communication interfaces and their corresponding TTL transceiver circuits, as well as several RS232 communication interfaces and their corresponding RS232 transceiver circuits. Production line workers need to plug the transceiver circuits into the corresponding communication interface sockets to ensure normal communication and operation of the electronic devices. However, incorrect plugging is common, such as plugging a TTL transceiver circuit into an RS232 communication interface socket, or vice versa, leading to malfunctions. Summary of the Invention
[0004] To address the technical problem in the prior art where the transceiver circuit plugs are easily inserted incorrectly during the manufacturing process of electronic devices, causing the electronic devices to malfunction, this utility model provides a solution in the following aspects.
[0005] In a first aspect, this utility model provides a circuit for intelligent automatic switching between TTL and RS232, comprising:
[0006] The changeover switch has a first moving contact for connecting to the transmit pin of the communication interface, a second moving contact for connecting to the receive pin of the communication interface, a first stationary contact and a second stationary contact for connecting to the receive end and the transmit end of the TTL signal transceiver circuit, respectively, and a third stationary contact and a fourth stationary contact for connecting to the receive end and the transmit end of the RS232 signal transceiver circuit, respectively.
[0007] A control switch is connected in series between the coil of the changeover switch and the voltage source. Its controlled end is connected to the output end of the signal acquisition circuit to control the operation of the changeover switch.
[0008] The signal acquisition circuit has its input terminal connected to the transmit pin of the communication interface. When a signal with a voltage level lower than the preset voltage is received, it continuously outputs a high-level signal to the controlled terminal of the control switch to control it to be in the off state.
[0009] Preferably, the third stationary contact is connected to the receiving end of the TTL signal transceiver circuit through the first current-limiting resistor, and the fourth stationary contact is connected to the transmitting end of the TTL signal transceiver circuit through the second current-limiting resistor.
[0010] Preferably, the signal acquisition circuit includes a latch and a comparator. The controlled terminal of the control switch is connected to the data output terminal of the latch, the data enable input terminal of the latch is connected to the output of the comparator, the non-inverting input terminal of the comparator is connected to the voltage divider point of the voltage divider branch, and the inverting input terminal of the comparator is used to connect to the receiving pin of the communication interface.
[0011] Preferably, the voltage divider branch includes a first voltage divider resistor and a second voltage divider resistor connected in series, with one end of the first voltage divider resistor connected to a voltage source and one end of the second voltage divider resistor connected to ground.
[0012] Preferably, the inverting input of the comparator is connected to one end of a third current-limiting resistor, and the other end of the third current-limiting resistor is used to connect to the receive pin of the communication interface.
[0013] Preferably, the inverting input of the comparator is connected to a voltage source via a pull-up resistor.
[0014] Preferably, it further includes a wire-to-board socket, wherein the second pin of the wire-to-board socket is connected to the first moving contact and is also used to connect to the receiving pin of the communication interface; and its third pin is connected to the second moving contact and is also used to connect to the transmitting pin of the communication interface.
[0015] Preferably, the RS232 signal transceiver circuit includes a TTL to RS232 chip. The input pin of the second transmitter of the TTL to RS232 chip is connected to the receiving end of the TTL signal transceiver circuit, and the output pin of the second transmitter is connected to the fourth stationary contact. The input pin of the second receiver of the TTL to RS232 chip is connected to the third stationary contact, and the output pin of the second receiver is connected to the transmitting end of the TTL signal transceiver circuit.
[0016] Preferably, the changeover switch is a double-pole double-throw signal relay, and the control switch is a transistor.
[0017] Preferably, the dual-pole dual-position signal relay is model G6K-2F-Y-TR DC5, and the TTL to RS232 converter chip is model SP232EEN-L / TR.
[0018] The technical advantages of this invention are as follows: By setting a changeover switch and connecting one set of moving contacts of the changeover switch to the transceiver pins of the communication interface, and connecting the two sets of stationary contacts of the changeover switch to the RS232 signal transceiver circuit and the TTL signal transceiver circuit respectively; and by using a signal acquisition circuit in conjunction with the voltage value of the low-level signal of the receiving pin of the communication interface connected to the changeover switch to accurately determine the type of communication interface connected to the changeover switch, and controlling the switching switch to turn on or off according to the type of communication interface, thereby controlling the action of the moving contacts of the changeover switch; therefore, the circuit of this invention can accurately connect the RS232 communication interface to the RS232 signal transceiver circuit and the TTL communication interface to the TTL signal transceiver circuit, thereby avoiding the problem of incorrect plugging of the communication interface in the production process of electronic equipment, thus improving the working reliability of the manufactured electronic equipment.
[0019] Furthermore, by connecting the third and fourth stationary contacts of the changeover switch to the TTL signal transceiver circuit through two current-limiting resistors, the communication interface can be protected and signal reflection can be prevented.
[0020] Furthermore, by setting a comparator in the signal acquisition circuit, the type of the connected communication interface can be accurately determined. When the connected communication interface is determined to be an RS232 communication interface, the register continuously outputs a high-level signal to the controlled terminal of the control switch; otherwise, the register outputs a low-level signal to the controlled terminal of the control switch, thereby greatly improving the working reliability of the circuit for intelligent automatic switching between TTL and RS232.
[0021] Furthermore, by connecting a third current-limiting resistor in series at the inverting input of the comparator, the current at the drive end can be reduced, preventing changes in the drive signal.
[0022] Furthermore, by connecting the inverting input of the comparator to a voltage source through a pull-up resistor, the inverting input of the comparator can be kept at a high potential when the comparator is not connected to an external communication interface, thus preventing it from outputting a high-level signal and preventing the changeover switch from malfunctioning.
[0023] Furthermore, by setting up a wire-to-board socket, the intelligent automatic switching circuit of this utility model can be easily connected to the communication interface. Attached Figure Description
[0024] The above and other objects, features, and advantages of the present invention will become readily understood by reading the following detailed description of exemplary embodiments with reference to the accompanying drawings. In the drawings, several embodiments of the present invention are shown by way of example and not limitation, and like or corresponding reference numerals denote like or corresponding parts, wherein:
[0025] Figure 1 is a circuit for intelligent automatic switching between TTL and RS232 according to an embodiment of the present invention. Detailed Implementation
[0026] The technical solutions of the present utility model will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of the present utility model, not all embodiments. Based on the embodiments of the present utility model, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the present utility model.
[0027] The specific embodiments of this utility model will now be described in detail with reference to the accompanying drawings.
[0028] Example of a circuit for intelligent automatic switching between TTL and RS232:
[0029] As shown in Figure 1, the intelligent automatic switching circuit for TTL and RS232 of this invention includes:
[0030] The changeover switch K1 has a first moving contact 6 for connecting to the transmit pin of the communication interface, a second moving contact 3 for connecting to the receive pin of the communication interface, a first stationary contact 5 and a second stationary contact 4 for connecting to the receive end and transmit end of the TTL signal transceiver circuit respectively, and a third stationary contact 7 and a fourth stationary contact 2 for connecting to the receive end and transmit end of the RS232 signal transceiver circuit respectively.
[0031] Control switch Q1 is connected in series between the coil of the changeover switch and the voltage source. Its controlled terminal is connected to the output terminal of the signal acquisition circuit to control the operation of the changeover switch.
[0032] The signal acquisition circuit has its input terminal connected to the transmit pin of the communication interface. When a voltage level signal lower than a preset voltage is received, it continuously outputs a high-level signal to the controlled terminal of the control switch to control it to be in the off state. The communication interface is an RS232 communication interface or a TTL communication interface.
[0033] In this embodiment, the preset voltage is 1.7V.
[0034] The working principle of this utility model is as follows: If the two moving contacts of the changeover switch K1 are connected to an RS232 communication interface, since the transmitting pin of the RS232 communication interface will output a low-level signal of less than 1.7V at a certain moment, the signal acquisition circuit will continuously output a high-level signal to the controlled end of the control switch, and the control switch will be in the off state, thereby disconnecting the power supply to the coil of the changeover switch K1. The first moving contact of the changeover switch K1 is connected to the third stationary contact, and the second moving contact is connected to the fourth stationary contact, thereby connecting the RS232 communication interface to the RS232 signal transceiver circuit. If the two moving contacts of the changeover switch K1 are connected to a TTL communication interface, since the level signal output by the transmitting pin of the TTL communication interface is always greater than 1.7V, the signal acquisition circuit will output a low-level signal to the controlled end of the control switch, and the control switch will be in the on state, thereby connecting the power supply to the coil of the changeover switch K1. The first moving contact of the changeover switch K1 is connected to the first stationary contact, and the second moving contact is connected to the second stationary contact, thereby connecting the TTL communication interface to the TTL signal transceiver circuit.
[0035] This invention relates to an intelligent automatic switching circuit for TTL and RS232 communication. A changeover switch is used, with one set of moving contacts connected to the transmit / receive pins of the communication interface. Two sets of stationary contacts are connected to the RS232 and TTL signal transceiver circuits, respectively. A signal acquisition circuit, combined with the voltage value of the receiving pins of the communication interface connected to the changeover switch, accurately determines the type of communication interface. Based on the type of communication interface, the circuit controls the switching on or off, thereby controlling the movement of the changeover switch's moving contacts. Therefore, this circuit can accurately connect the RS232 communication interface to the RS232 signal transceiver circuit and the TTL communication interface to the TTL signal transceiver circuit, thus avoiding the problem of incorrect plugging of the communication interface during the manufacturing process and improving the reliability of the manufactured electronic equipment.
[0036] In one embodiment, the first stationary contact 5 is connected to the receiving end of the TTL signal transceiver circuit through the first current-limiting resistor R6, and the second stationary contact 4 is connected to the transmitting end of the TTL signal transceiver circuit through the second current-limiting resistor R7.
[0037] By connecting the third and fourth stationary contacts of the changeover switch to the TTL signal transceiver circuit through two current-limiting resistors, the communication interface can be protected and signal reflection can be prevented.
[0038] In one embodiment, the signal acquisition circuit includes a latch U4 and a comparator U3. The controlled terminal of the control switch is connected to the data output terminal Q of the latch through the sixteenth resistor R16. The data enable input terminal OE of the latch is connected to the output terminal of the comparator. The non-inverting input terminal of the comparator is connected to the voltage divider point of the voltage divider branch, and the inverting input terminal of the comparator is used to connect to the transmit pin of the communication interface. The ground terminal GND of the latch U4 is grounded, the data input terminal D is connected to the voltage source VCC through the positive power supply pin, and the latch enable input pin LE is connected to the output enable input pin OE.
[0039] The working principle of the signal acquisition circuit in this embodiment is as follows: The voltage at the non-inverting input terminal of the comparator is 1.7V. If the inverting input terminal of the comparator is connected to the transmit pin of the RS232 communication interface, then at a certain moment, the voltage at the inverting input terminal of the comparator is lower than the voltage at its non-inverting input terminal. The comparator outputs a low-level signal to the latch, the latch latches the low-level signal and continuously outputs a high-level signal to the controlled terminal of the control switch, thereby keeping the control switch in the off state. If the inverting input terminal of the comparator is connected to the transmit pin of the TTL communication interface, since the voltage at the transmit pin of the TTL communication interface is greater than 1.7V, the voltage at the inverting input terminal of the comparator will always be greater than or equal to the voltage at its non-inverting input terminal. The comparator continuously outputs a high-level signal to the latch, and the latch continuously outputs a low-level signal to the controlled terminal of the control switch, thereby keeping the control switch in the on state.
[0040] Because the signal acquisition circuit in this embodiment is equipped with a comparator, it can accurately determine the type of the connected communication interface. When it is determined that the connected communication interface is an RS232 communication interface, the register continuously outputs a high-level signal to the controlled terminal of the control switch. Otherwise, the register outputs a low-level signal to the controlled terminal of the control switch, thereby greatly improving the working reliability of the circuit for intelligent automatic switching between TTL and RS232.
[0041] In one embodiment, the voltage divider branch includes a first voltage divider resistor R2 and a second voltage divider resistor R4 connected in series. One end of the first voltage divider resistor is connected to the voltage source VCC, and one end of the second voltage divider resistor is connected to ground.
[0042] In one embodiment, the inverting input of the comparator is connected to one end of a third current-limiting resistor R1, and the other end of the third current-limiting resistor is used to connect to the transmit pin of the communication interface.
[0043] By connecting a third current-limiting resistor in series at the inverting input of the comparator, the current at the drive end can be reduced, preventing changes in the drive signal.
[0044] In one embodiment, the inverting input of the comparator is connected to the voltage source VCC via a pull-up resistor R3.
[0045] By connecting the inverting input of the comparator to a voltage source through a pull-up resistor, the inverting input of the comparator can be kept at a high potential when the comparator is not connected to an external communication interface, thus preventing it from outputting a high-level signal and preventing the changeover switch from malfunctioning.
[0046] In one embodiment, the device further includes a wire-to-board socket CN3, wherein a second pin of the wire-to-board socket is connected to the first moving contact and is also used to connect to the transmit pin of the communication interface; and a third pin is connected to the second moving contact and is also used to connect to the receive pin of the communication interface.
[0047] A wire-to-board (FTB) connector is an electronic connector used to connect wires to a circuit board (PCB). It primarily achieves the connection between the wire and the circuit board through a plug and a socket, providing reliable electrical connection and mechanical support. A FTB connector typically consists of a plug, a socket, and a locking mechanism; the plug connects to one end of the wire and typically consists of metal leads and an insulating shell. The socket is mounted on the circuit board and typically consists of metal leads and an insulating shell. The locking mechanism ensures a secure connection between the plug and socket, preventing loosening due to vibration or external force. The FTB connector achieves electrical connection through the connection of the plug and socket. In this embodiment, the socket can be mounted on the circuit board where the communication interface is located, and the corresponding metal leads of the socket connect to the corresponding leads of the communication interface.
[0048] By setting up a wire-to-board socket, the switching circuit of this utility model can be easily connected to the communication interface.
[0049] In one embodiment, the TTL signal transceiver circuit is a microcontroller U2, and both the first stationary contact and the second stationary contact are connected to the microcontroller.
[0050] In one embodiment, the RS232 signal transceiver circuit includes a TTL to RS232 chip. The input pin of the second transmitter of the TTL to RS232 chip is connected to the receiving end of the TTL signal transceiver circuit, and the output pin of the second transmitter is connected to the fourth stationary contact. The input pin of the second receiver of the TTL to RS232 chip is connected to the third stationary contact, and the output pin of the second receiver is connected to the transmitting end of the TTL signal transceiver circuit.
[0051] In this embodiment, the TTL to RS232 converter chip is model SP232EEN-L / TR. In other embodiments, other suitable TTL to RS232 converter chips can also be used.
[0052] In one embodiment, the changeover switch is a double-pole double-throw signal relay, and the control switch is a transistor.
[0053] A double-pole double-throw signal relay is a type of relay with two sets of normally open contacts and two sets of normally closed contacts, capable of switching two switches simultaneously. A double-pole double-throw signal relay includes a contact system, an electromagnetic coil, and a mechanical structure. The contact system consists of two independent sets of contacts, each set comprising a common terminal (COM), a normally open terminal (NO), and a normally closed terminal (NC). When the coil is energized, it generates a magnetic field that attracts the armature, causing the contacts to switch. The mechanical structure includes components such as the armature and springs, used to physically switch the contacts. When the relay is not energized, the common terminals of the two sets of contacts are connected to their respective normally closed terminals, and the normally open terminals are in an open state. When the relay coil is energized, the coil generates a magnetic field that attracts the armature, causing the contacts to switch, connecting the common terminal to the normally open terminal and disconnecting the normally closed terminal.
[0054] In this embodiment, a transistor is used as the control switch. In other embodiments, other fully controllable switching devices such as IGBTs can also be used as the control switch.
[0055] PNP transistors can be used.
[0056] In one embodiment, the double-pole double-position signal relay is model G6K-2F-Y-TR DC5, and the TTL to RS232 converter chip is model SP232EEN-L / TR.
[0057] In the foregoing description of this specification, unless otherwise expressly specified and limited, the terms "connection" and similar terms should be interpreted broadly. For example, the term "connection" can refer to a direct link, an indirect link via an intermediate medium, or the internal connection or interaction between two elements. Therefore, unless otherwise expressly limited in this specification, those skilled in the art can understand the specific meaning of the above terms in this utility model based on the specific circumstances.
[0058] The terms "first" or "second," etc., used to designate numbers or ordinal numbers in this specification are for descriptive purposes only and should not be construed as indicating, explicitly or implicitly, relative importance or specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this specification, "a plurality of" means at least two, such as two, three, or more, unless otherwise explicitly specified.
[0059] While this specification has shown and described various embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will occur to those skilled in the art without departing from the spirit and essence of the present invention. It should be understood that various alternatives to the embodiments of the present invention described herein may be employed in the practice of the present invention.
Claims
1. A circuit for intelligent automatic switching between TTL and RS232, characterized in that, include: The selector switch has a first moving contact for connecting to the transmit pin of the communication interface, a second moving contact for connecting to the receive pin of the communication interface, a first stationary contact and a second stationary contact for connecting to the transmit and receive ends of the TTL signal transceiver circuit, respectively, and a third stationary contact and a fourth stationary contact for connecting to the transmit and receive ends of the RS232 signal transceiver circuit, respectively. A control switch is connected in series between the selector switch coil and the voltage source, and its controlled end is connected to the output end of the signal acquisition circuit to control the operation of the selector switch. The signal acquisition circuit has an input terminal for connecting to the receiving pin of the communication interface. When a voltage level signal lower than a preset voltage is received, it continuously outputs a low-level signal to the controlled terminal of the control switch to control its conduction. The communication interface is an RS232 communication interface or a TTL communication interface.
2. The circuit for intelligent automatic switching between TTL and RS232 as described in claim 1, characterized in that, The third stationary contact is connected to the receiving end of the TTL signal transceiver circuit through the first current-limiting resistor, and the fourth stationary contact is connected to the transmitting end of the TTL signal transceiver circuit through the second current-limiting resistor.
3. The circuit for intelligent automatic switching between TTL and RS232 as described in claim 1, characterized in that, The signal acquisition circuit includes a latch and a comparator. The controlled terminal of the control switch is connected to the data output terminal of the latch, the data enable input terminal of the latch is connected to the output of the comparator, the non-inverting input terminal of the comparator is connected to the voltage divider point of the voltage divider branch, and the inverting input terminal of the comparator is used to connect to the receiving pin of the communication interface.
4. The circuit for intelligent automatic switching between TTL and RS232 as described in claim 3, characterized in that, The voltage divider branch includes a first voltage divider resistor and a second voltage divider resistor connected in series. One end of the first voltage divider resistor is connected to a voltage source, and one end of the second voltage divider resistor is connected to ground.
5. The circuit for intelligent automatic switching between TTL and RS232 as described in claim 3, characterized in that, The inverting input of the comparator is connected to one end of the third current-limiting resistor, and the other end of the third current-limiting resistor is used to connect to the receive pin of the communication interface.
6. The circuit for intelligent automatic switching between TTL and RS232 as described in claim 3, characterized in that, The inverting input of the comparator is connected to a voltage source via a pull-up resistor.
7. The circuit for intelligent automatic switching between TTL and RS232 as described in claim 1, characterized in that, It also includes a wire-to-board socket, wherein the second pin of the wire-to-board socket is connected to the first moving contact and is also used to connect the receiving pin of the communication interface; its third pin is connected to the second moving contact and is also used to connect the transmitting pin of the communication interface.
8. The circuit for intelligent automatic switching between TTL and RS232 as described in claim 1, characterized in that, The RS232 signal transceiver circuit includes a TTL to RS232 chip. The input pin of the second transmitter of the TTL to RS232 chip is connected to the receiving end of the TTL signal transceiver circuit, and the output pin of the second transmitter is connected to the fourth stationary contact. The input pin of the second receiver of the TTL to RS232 chip is connected to the third stationary contact, and the output pin of the second receiver is connected to the transmitting end of the TTL signal transceiver circuit.
9. The circuit for intelligent automatic switching between TTL and RS232 as described in any one of claims 1 to 8, characterized in that, The changeover switch uses a double-pole double-position signal relay, and the control switch uses a transistor.
10. The circuit for intelligent automatic switching between TTL and RS232 as described in claim 9, characterized in that, The model of the dual-pole dual-position signal relay is G6K-2F-Y-TR DC5, and the model of the TTL to RS232 converter chip is SP232EEN-L / TR.
