Multi-channel serial port communication switching device

By designing a multi-channel serial port communication switching device, the MCU and logic gate control chip realize automatic switching of RS232, RS485, and RS422 signals, solving the problems of interference and cumbersome operations in the existing technology, and achieving flexible and simple Communication switching and low-cost solutions.

CN109376109BActive Publication Date: 2024-11-26LOOTOM TELCOVIDEO NETWORK WUXI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201811502996.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2018-12-10
Publication Date
2024-11-26
Estimated Expiration
2038-12-10

AI Technical Summary

Technical Problem

In the prior art, the multi-channel serial communication RS232, RS485, and RS422 cannot access the RXD data port and TXD data port of the MCU at the same time, resulting in serious mutual interference and abnormal data transmission. Traditional methods require manual disconnection and connection of the communication line. Temporary operation.

Method used

Design a multi-channel serial communication switching device, including an MCU, a data input switching circuit and a data transmission and reception control circuit, and realize automatic switching of RS232, RS485, and RS422 signals through RS232 conversion chip and RS485/422 conversion chip, and use AND gate and OR gate Logic implements signal control.

Benefits of technology

It realizes intelligent automatic switching of RS232, RS485, and RS422 signals, is flexible in use, simple and practical in circuit, and is low in cost, solving the problem of simultaneous multi-channel serial communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN109376109B_ABST
    Figure CN109376109B_ABST
Patent Text Reader

Abstract

The present invention provides a multi-channel serial port communication switching device, including an MCU, a data input switching circuit, a data transceiver control circuit, an RS232 conversion chip U5, and RS485 / 422 conversion chips U3 and U4; each input end of the data input switching circuit is respectively connected to the RXD data output end of the RS232 conversion chip U5 and the RXD data output end of the RS485 / 422 conversion chip U3; the output end of the data input switching circuit is connected to the RXD data port of the MCU; the MCU realizes the switching of RS232 / RS485 / RS422 serial port communication data reception by controlling the data input switching circuit; the RS485 / 422 conversion chip U3 is used for RS485 serial port communication data transceiver, U3 also serves as RS422 serial port communication data reception, and the RS485 / 422 conversion chip U4 is used for RS422 serial port communication data transmission; the MCU realizes the control of the RS485 / 422 conversion chips U3 and U4 through the control end and the data transceiver control circuit. The present invention is flexible and convenient to use.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of industrial communications, and in particular to a multi-channel serial port communication switching device. Background Art

[0002] In the prior art, multi-channel serial communication RS232, RS485, and RS422 cannot be connected to the circuit and the RXD data port and TXD data port of the MCU for communication at the same time. When connected at the same time, there is serious interference between them and data cannot be transmitted normally. The traditional method requires manual disconnection and connection of each serial communication line, which is inconvenient and cumbersome. Summary of the invention

[0003] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a multi-channel serial port communication switching device, which can realize automatic switching of multi-channel serial port communications, is flexible and convenient to use, and has a simple and practical circuit. The technical solution adopted by the present invention is:

[0004] A multi-channel serial port communication switching device, including an MCU, a data input switching circuit, a data transceiver control circuit, an RS232 conversion chip U5, and RS485 / 422 conversion chips U3 and U4;

[0005] The input terminals of the data input switching circuit are respectively connected to the RXD data output terminal of the RS232 conversion chip U5 and the RXD data output terminal of the RS485 / 422 conversion chip U3; the output terminal of the data input switching circuit is connected to the RXD data port of the MCU; the MCU realizes the switching of RS232 / RS485 / RS422 serial communication data reception by controlling the data input switching circuit;

[0006] The RS485 / 422 conversion chip U3 is used for data transmission and reception of RS485 serial communication. The MCU controls the RS485 / 422 conversion chip U3 to perform data transmission and reception of RS485 serial communication through the control terminal and the data transmission and reception control circuit; the TXD data port of the MCU is respectively connected to the TXD data input terminal of the RS232 conversion chip U5, the TXD data input terminal of the RS485 / 422 conversion chip U3, and the TXD data input terminal of the RS485 / 422 conversion chip U4;

[0007] The RS485 / 422 conversion chip U3 also serves as the data receiver of the RS422 serial communication, and the RS485 / 422 conversion chip U4 is used for the data transmitter of the RS422 serial communication; the MCU controls the RS485 / 422 conversion chips U3 and U4 through the control terminal and the data transceiver control circuit.

[0008] Specifically, the data input switching circuit includes AND gates U1A, U1B, or gates U2A, U2B;

[0009] The A input terminal of AND gate U1A is connected to the RXD data output terminal of RS232 conversion chip U5, the B input terminal of AND gate U1A is connected to the RS232 control terminal of MCU, and the Y output terminal of AND gate U1A is connected to the A input terminal of OR gate U2A; the A input terminal and B input terminal of OR gate U2B are respectively connected to the EN485 enable terminal and RS422 control terminal of MCU, the Y output terminal of OR gate U2B is connected to the A input terminal of AND gate U1B, the B input terminal of AND gate U1B is connected to the RXD data output terminal of RS485 / 422 conversion chip U3, the Y output terminal of AND gate U1B is connected to the B input terminal of OR gate U2A; the Y output terminal of OR gate U2A is connected to the RXD data port of MCU.

[0010] Specifically, the data transceiver control circuit includes an AND gate U1C; the A input terminal of the AND gate U1C is connected to the RS485 control terminal of the MCU, the B input terminal of the AND gate U1C is connected to the EN485 enable terminal of the MCU, and the output terminal of the AND gate U1C is connected to the receiving control terminal and the sending control terminal of the RS485 / 422 conversion chip U3;

[0011] The receiving control terminal of the RS485 / 422 conversion chip U4 is connected to a high level through a resistor R2, and the sending control terminal of the RS485 / 422 conversion chip U4 is connected to the RS422 control terminal of the MCU;

[0012] The receiving control terminals of the RS485 / 422 conversion chips U3 and U4 are both valid at low levels, and the sending control terminals are both valid at high levels.

[0013] Further,

[0014] When the signals of the RS232 control terminal, RS485 control terminal, RS422 control terminal, and EN485 enable terminal of the MCU are 1, 0, 0, and 0 respectively, it switches to RS232 serial port communication;

[0015] When the signals of the RS232 control terminal, RS422 control terminal, and EN485 enable terminal of the MCU are 0, 0, and 1 respectively, the communication is switched to RS485 serial port communication; the signal of the RS485 control terminal of the MCU controls the data transmission and reception of RS485 serial port communication;

[0016] When the signals of the RS232 control terminal, RS485 control terminal, RS422 control terminal, and EN485 enable terminal of the MCU are 0, 0, 1, and 0 respectively, it switches to RS422 serial port communication.

[0017] The advantages of the present invention are:

[0018] 1) It is convenient to carry out intelligent automatic switching of three signals: RS232, RS485 and RS422. It can also be set to a single communication mode through MCU, which is flexible and convenient to use.

[0019] 2) The circuit is simple, practical and low cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 The electrical block diagram of the present invention.

[0021] Figure 2 It is a schematic diagram of the present invention. DETAILED DESCRIPTION

[0022] The present invention will be further described below in conjunction with specific drawings and embodiments.

[0023] like Figure 1 As shown, a multi-channel serial port communication switching device proposed by the present invention includes an MCU, a data input switching circuit, a data transceiver control circuit, an RS232 conversion chip U5, and RS485 / 422 conversion chips U3 and U4;

[0024] The input terminals of the data input switching circuit are respectively connected to the RXD data output terminal of the RS232 conversion chip U5 and the RXD data output terminal of the RS485 / 422 conversion chip U3; the output terminal of the data input switching circuit is connected to the RXD data port of the MCU; the MCU realizes the switching of RS232 / RS485 / RS422 serial communication data reception by controlling the data input switching circuit;

[0025] The RS485 / 422 conversion chip U3 is used for data transmission and reception of RS485 serial communication. The MCU controls the RS485 / 422 conversion chip U3 to perform data transmission and reception of RS485 serial communication through the control terminal and the data transmission and reception control circuit; the TXD data port of the MCU is respectively connected to the TXD data input terminal of the RS232 conversion chip U5, the TXD data input terminal of the RS485 / 422 conversion chip U3, and the TXD data input terminal of the RS485 / 422 conversion chip U4;

[0026] The RS485 / 422 conversion chip U3 also serves as the data receiver of the RS422 serial communication, and the RS485 / 422 conversion chip U4 is used for the data transmitter of the RS422 serial communication; the MCU controls the RS485 / 422 conversion chips U3 and U4 through the control terminal and the data transceiver control circuit.

[0027] like Figure 2 As shown, the data input switching circuit includes AND gates U1A, U1B, and OR gates U2A, U2B;

[0028] The A input terminal of AND gate U1A is connected to the RXD data output terminal of RS232 conversion chip U5, the B input terminal of AND gate U1A is connected to the RS232 control terminal of MCU, and the Y output terminal of AND gate U1A is connected to the A input terminal of OR gate U2A; the A input terminal and B input terminal of OR gate U2B are respectively connected to the EN485 enable terminal and RS422 control terminal of MCU, the Y output terminal of OR gate U2B is connected to the A input terminal of AND gate U1B, the B input terminal of AND gate U1B is connected to the RXD data output terminal of RS485 / 422 conversion chip U3, and the Y output terminal of AND gate U1B is connected to the B input terminal of OR gate U2A; the Y output terminal of OR gate U2A is connected to the RXD data port of MCU;

[0029] The data receiving and transmitting control circuit includes an AND gate U1C; the A input terminal of the AND gate U1C is connected to the RS485 control terminal of the MCU, the B input terminal of the AND gate U1C is connected to the EN485 enable terminal of the MCU, and the output terminal of the AND gate U1C is connected to the receiving control terminal and the sending control terminal of the RS485 / 422 conversion chip U3;

[0030] The receiving control terminal of the RS485 / 422 conversion chip U4 is connected to a high level through a resistor R2, and the sending control terminal of the RS485 / 422 conversion chip U4 is connected to the RS422 control terminal of the MCU;

[0031] RS485 / 422 conversion chip U3, U4 receiving control end ( Figure 2 The 2nd pins of U3 and U4 in the above table are both low level valid, and the control terminal ( Figure 2 The 3 pins of U3 and U4 in the RS485 / 422 converter chip U3 are both valid at high level; the A and B interface ends of the RS485 / 422 converter chip U3 can be used as the transceiver end of RS485 serial communication, and can also be used as the receiving end of RS422 serial communication; the A and B interface ends of the RS485 / 422 converter chip U4 are used as the sending end of RS422 serial communication;

[0032] In the above circuit, RS232 conversion chip U5 adopts MAX232, and RS485 / 422 conversion chips U3 and U4 both adopt SP485EEN;

[0033] When the signals of the RS232 control terminal, RS485 control terminal, RS422 control terminal, and EN485 enable terminal of the MCU are 1, 0, 0, and 0 respectively (1 represents high level, and 0 represents low level), it switches to RS232 serial port communication; the OR gate U2B outputs 0, and the AND gate U1B also outputs 0. At this time, the OR gate U2A only accepts the data from the RXD data output terminal of the RS232 conversion chip U5 received through the AND gate U1A; the sending data of the TXD data port of the MCU enters the TXD data input terminal of the RS232 conversion chip U5;

[0034] When the signals of the RS232 control end, RS422 control end, and EN485 enable end of the MCU are 0, 0, and 1 respectively, it switches to RS485 serial communication; the signal of the RS485 control end of the MCU controls the data transmission and reception of RS485 serial communication. When the signal of the RS485 control end of the MCU is 1, it is the data transmission of RS485 serial communication. When the signal of the RS485 control end of the MCU is 0, it is the data reception of RS485 serial communication. The data transmission and reception of RS485 serial communication is realized through the RS485 / 422 conversion chip U3; the data receiving function of the RS485 / 422 conversion chip U4 is turned off by the high level connected by the resistor R2. Since the 3rd pin of U4 is connected to the low level at this time, its data transmission function is also turned off; the turning off of the AND gate U1A also cuts off the data reception of RS232 serial communication;

[0035] When the signals of the RS232 control end, RS485 control end, RS422 control end, and EN485 enable end of the MCU are 0, 0, 1, and 0 respectively, it switches to RS422 serial port communication; at this time, the RS485 / 422 conversion chip U3 is responsible for data reception, and the RS485 / 422 conversion chip U4 is responsible for data transmission.

[0036] The multi-channel serial port communication switching device proposed in the present invention facilitates the intelligent automatic switching of three signals of RS232, RS485 and RS422, and can also be set to a single communication mode through the MCU; the data input switching circuit and the data transceiver control circuit are composed of simple and commonly used logic AND gate and logic OR gate chips. The circuit is simple and practical, with good versatility, and solves the problem of simultaneous multi-channel serial port communications.

[0037] Finally, it should be noted that the above specific implementation methods are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to examples, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.

Claims

1. A multi-channel serial port communication switching device, characterized in that: It includes MCU, data input switching circuit, data transceiver control circuit, RS232 conversion chip U5, RS485 / 422 conversion chips U3 and U4; The input terminals of the data input switching circuit are respectively connected to the RXD data output terminal of the RS232 conversion chip U5 and the RXD data output terminal of the RS485 / 422 conversion chip U3; the output terminal of the data input switching circuit is connected to the RXD data port of the MCU; the MCU realizes the switching of RS232 / RS485 / RS422 serial communication data reception by controlling the data input switching circuit; The RS485 / 422 conversion chip U3 is used for data transmission and reception of RS485 serial communication. The MCU controls the RS485 / 422 conversion chip U3 to perform data transmission and reception of RS485 serial communication through the control terminal and the data transmission and reception control circuit; the TXD data port of the MCU is respectively connected to the TXD data input terminal of the RS232 conversion chip U5, the TXD data input terminal of the RS485 / 422 conversion chip U3, and the TXD data input terminal of the RS485 / 422 conversion chip U4; RS485 / 422 conversion chip U3 also serves as the data receiver of RS422 serial communication, and RS485 / 422 conversion chip U4 serves as the data transmitter of RS422 serial communication; MCU controls RS485 / 422 conversion chips U3 and U4 through the control terminal and the data transceiver control circuit; The data input switching circuit includes AND gates U1A, U1B, and OR gates U2A, U2B; The A input terminal of AND gate U1A is connected to the RXD data output terminal of RS232 conversion chip U5, the B input terminal of AND gate U1A is connected to the RS232 control terminal of MCU, and the Y output terminal of AND gate U1A is connected to the A input terminal of OR gate U2A; the A input terminal and B input terminal of OR gate U2B are respectively connected to the EN485 enable terminal and RS422 control terminal of MCU, the Y output terminal of OR gate U2B is connected to the A input terminal of AND gate U1B, the B input terminal of AND gate U1B is connected to the RXD data output terminal of RS485 / 422 conversion chip U3, and the Y output terminal of AND gate U1B is connected to the B input terminal of OR gate U2A; the Y output terminal of OR gate U2A is connected to the RXD data port of MCU; The data receiving and transmitting control circuit includes an AND gate U1C; the A input terminal of the AND gate U1C is connected to the RS485 control terminal of the MCU, the B input terminal of the AND gate U1C is connected to the EN485 enable terminal of the MCU, and the output terminal of the AND gate U1C is connected to the receiving control terminal and the sending control terminal of the RS485 / 422 conversion chip U3; The receiving control terminal of the RS485 / 422 conversion chip U4 is connected to a high level through a resistor R2, and the sending control terminal of the RS485 / 422 conversion chip U4 is connected to the RS422 control terminal of the MCU; The receiving control terminals of RS485 / 422 conversion chips U3 and U4 are both valid at low level, and the sending control terminals are both valid at high level.

2. The multi-channel serial port communication switching device according to claim 1, characterized in that: When the signals of the RS232 control terminal, RS485 control terminal, RS422 control terminal, and EN485 enable terminal of the MCU are 1, 0, 0, and 0 respectively, it switches to RS232 serial port communication; When the signals of the RS232 control terminal, RS422 control terminal, and EN485 enable terminal of the MCU are 0, 0, and 1 respectively, the communication is switched to RS485 serial port communication; the signal of the RS485 control terminal of the MCU controls the data transmission and reception of RS485 serial port communication; When the signals of the RS232 control terminal, RS485 control terminal, RS422 control terminal, and EN485 enable terminal of the MCU are 0, 0, 1, and 0 respectively, it switches to RS422 serial port communication.