A circuit for realizing RS485 communication by using double IO ports

CN224909478UActive Publication Date: 2026-10-27SCUD FUJIAN ELECTRONICS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202522315926.6
Authority / Receiving Office
CN · China
Patent Type
Utility models(China)
Current Assignee / Owner
Filing Date
2025-10-31
Publication Date
2026-10-27
Estimated Expiration
2035-10-31

AI Technical Summary

Technical Problem

[0002]RS-485作为工业领域中应用极为广泛的差分串行通信标准,凭借其独特的差分信号传输机制,能有效抑制工业现场常见的电磁干扰EMI与共模噪声,即便在变频器、电机等强干扰环境下仍能保持数据传输的稳定性,同时其支持的传输距离可达1200米在9600bps波特率下,且单条总线可挂载32个理论值,通过中继器可扩展至更多节点的特性,配合低成本的双绞线传输介质与通用收发器芯片如MAX485、SN75176,使其在工业自动化的PLC与传感器/执行器互联、智能交通的路口控制器与车辆检测器通信、电力监控的变电站仪表数据采集等场景中成为核心通信方案;然而,在实际硬件设计中,常见的RS-485通信电路为实现完整的半双工数据收发功能,通常需要占用微控制器MCU的3个IO口,如图1所示,其中2个用于标准UART串行通信的发送端TX与接收端RX,负责数据的输出与输入,另外1个则专门用于控制RS-485 收发器的接收使能RE与发送使能DE引脚通常将RE与DE短接以简化控制,仍需1个IO口,以实现收发模式的切换,这种方案在MCU资源较为丰富的高端设备中问题不明显,但在工业控制领域大量使用的8位MCU如STC89C52或资源受限的嵌入式系统如物联网终端模块中,由于这些设备本身IO口数量有限常仅4-8个可用IO,且还需兼顾按键输入、LED 指示、继电器控制、ADC 采样等其他外设的驱动需求,RS-485电路占用的3个IO口会显著加剧IO口资源紧张的问题,甚至导致部分功能因IO口不足而无法实现,影响系统整体设计的灵活性与可行性

Benefits of technology

[0013]本实用新型的有益效果如下:本实用新型由原来的3个IO口减少到2个IO,并能够实现通信数据的有效收发,能很好的解决485通信遇到的MCU IO口资源不足的情况,该电路方案器件简单,成本低廉,有很好的经济性、适用性和实用性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN224909478U_ABST
    Figure CN224909478U_ABST
Patent Text Reader

Abstract

The utility model discloses a kind of circuit for realizing RS485 communication using double IO port, including double IO port sending circuit, RS-485 communication chip U1, pull-up and pulldown circuit, protection circuit, RS485 output interface, power supply VCC, the double IO port sending circuit is connected pull-up and pulldown circuit by RS-485 communication chip U1, the pull-up and pulldown circuit is connected RS485 output interface by protection circuit, the double IO port sending circuit, RS-485 communication chip U1, pull-up and pulldown circuit are all connected power supply VCC, the utility model reduces from original 3 IO to 2 IO, and can realize the effective transceiving of communication data, can well solve the situation of MCU IO port resource deficiency encountered in 485 communication, and the circuit scheme device is simple, low in cost, with good economy, applicability and practicality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This utility model relates to RS485 communication circuits, and more particularly to a circuit that uses dual I / O ports to implement RS485 communication. Background Technology

[0002] RS-485, a widely used differential serial communication standard in the industrial field, effectively suppresses common electromagnetic interference (EMI) and common-mode noise in industrial environments due to its unique differential signal transmission mechanism. Even in environments with strong interference such as inverters and motors, it maintains stable data transmission. It supports transmission distances up to 1200 meters at a baud rate of 9600bps, and a single bus can theoretically support 32 nodes, expandable to more nodes via repeaters. Combined with low-cost twisted-pair transmission media and general-purpose transceiver chips such as MAX485 and SN75176, it has become a core communication solution in scenarios such as PLC-sensor / actuator interconnection in industrial automation, communication between intersection controllers and vehicle detectors in intelligent transportation, and data acquisition from substation instruments in power monitoring. However, in actual hardware design, common RS-485 communication circuits typically require three I / O ports of a microcontroller (MCU) to achieve complete half-duplex data transmission and reception functions. Figure 1 As shown, two pins, TX and RX, are used for standard UART serial communication, responsible for data output and input. The other pin is dedicated to controlling the RS-485 transceiver's receive enable (RE) and transmit enable (DE) pins. Typically, RE and DE are shorted to simplify control, still requiring one I / O port to switch between transmit and receive modes. This approach is not problematic in high-end devices with abundant MCU resources. However, in industrial control applications using 8-bit MCUs such as the STC89C52 or resource-constrained embedded systems like IoT terminal modules, the limited number of I / O ports (usually only 4-8) and the need to drive other peripherals like button inputs, LED indicators, relay control, and ADC sampling significantly exacerbates the I / O resource shortage. This can even prevent some functions from being implemented due to insufficient I / O ports, affecting the overall flexibility and feasibility of the system design. Utility Model Content

[0003] The purpose of this invention is to overcome the shortcomings of the prior art and provide a circuit that uses dual I / O ports to implement RS485 communication.

[0004] To achieve the above objectives, this utility model is implemented through the following technical solution:

[0005] A circuit employing dual I / O ports for RS485 communication includes a dual I / O port transmitting circuit, an RS-485 communication chip U1, pull-up / pull-down circuits, a protection circuit, an RS485 output interface, and a power supply VCC. The dual I / O port transmitting circuit is connected to the pull-up / pull-down circuits via the RS-485 communication chip U1. The pull-up / pull-down circuits are connected to the RS485 output interface via the protection circuit. The dual I / O port transmitting circuit, the RS-485 communication chip U1, and the pull-up / pull-down circuits are all connected to the power supply VCC. The dual I / O port transmitting circuit includes resistors R1, R2, R3, R8, and R9, and a MOSFET Q1. One end of resistor R2 is connected to the power supply VCC. The other end is connected to the drain (D) of MOSFET Q1. The source (S) of MOSFET Q1 is connected to ground (GND). The gate (G) of MOSFET Q1 is connected to ground (GND) through resistor R9. The gate of MOSFET Q1 is connected to one end of resistor R8. The other end of resistor R8 is connected to the DI terminal of RS-485 communication chip U1 through resistor R3. The other end of resistor R8 is the first signal input terminal MCU_TX1. The / RE and DE terminals of RS-485 communication chip U1 are both connected to the drain (D) of MOSFET Q1. The RO terminal of RS-485 communication chip U1 is connected to one end of resistor R1. The other end of resistor R1 is the second signal input terminal MCU_RX1.

[0006] Preferably, MOSFET Q1 is an N-channel MOSFET.

[0007] Preferably, the power supply VCC is 3.3V.

[0008] Preferably, the pull-up / pull-down circuit includes resistors R4 and R5. One end of resistor R4 is connected to ground signal GND, and the other end of resistor R4 is connected to terminal B of RS-485 communication chip U1. One end of resistor R5 is connected to power supply VCC, and the other end of resistor R5 is connected to terminal A of RS-485 communication chip U1.

[0009] Preferably, the protection circuit includes resistors R6 and R7, positive temperature coefficient resistor protectors PT1 and PT2, TVS diodes D1, D2, and D3. Terminal A of the RS-485 communication chip U1 is connected to one end of resistor R7, and the other end of resistor R7 is connected to ground (GND) through TVS diode D1. Terminal B of the RS-485 communication chip U1 is connected to one end of resistor R6, and the other end of resistor R6 is connected to the positive temperature coefficient resistor protector PT1. The other end of resistor R7 is connected to the positive temperature coefficient resistor protector PT2, and the other end of resistor R6 is connected to the other end of resistor R7 through TVS diode D2. One end of TVS diode D3 is connected to the other end of resistor R6, and the other end of TVS diode D3 is connected to ground (GND).

[0010] Preferably, resistors R4 and R5 have the same resistance value.

[0011] Preferably, resistors R6 and R7 have the same resistance value.

[0012] Preferably, both the first signal input terminal MCU_TX1 and the second signal input terminal MCU_RX1 are used to connect to the MCU.

[0013] The beneficial effects of this utility model are as follows: This utility model reduces the number of I / O ports from the original 3 to 2, and can realize the effective transmission and reception of communication data. It can effectively solve the problem of insufficient MCU I / O port resources encountered in 485 communication. The circuit scheme has simple components, low cost, and good economy, applicability and practicality. Attached Figure Description

[0014] Figure 1 The circuit schematic diagram is for the background technology;

[0015] Figure 2 This is the circuit schematic diagram of this utility model. Detailed Implementation

[0016] The technical solution of this utility model will be further described below with reference to the accompanying drawings:

[0017] like Figure 2As shown, a circuit for RS485 communication using dual I / O ports includes a dual I / O port transmitting circuit 6, an RS-485 communication chip U1, pull-up / pull-down circuits 7, a protection circuit 8, an RS485 output interface 9, and a power supply VCC. The dual I / O port transmitting circuit is connected to the pull-up / pull-down circuits 7 via the RS-485 communication chip U1. The pull-up / pull-down circuits 7 are connected to the RS485 output interface 9 via the protection circuit 8. The dual I / O port transmitting circuit 6, the RS-485 communication chip U1, and the pull-up / pull-down circuits 7 are all connected to the power supply VCC. The dual I / O port transmitting circuit 6 includes resistors R1, R2, R3, R8, and R9, and a MOSFET Q1. One end of resistor R2 is connected to the power supply VCC. The source is VCC. The other end of the resistor R2 is connected to the drain (D) of the MOSFET Q1. The source (S) of the MOSFET Q1 is connected to ground (GND). The gate (G) of the MOSFET Q1 is connected to ground (GND) through the resistor R9. The gate of the MOSFET Q1 is connected to one end of the resistor R8. The other end of the resistor R8 is connected to the DI terminal of the RS-485 communication chip U1 through the resistor R3. The other end of the resistor R8 is the first signal input terminal MCU_TX1. The / RE and DE terminals of the RS-485 communication chip U1 are both connected to the drain (D) of the MOSFET Q1. The RO terminal of the RS-485 communication chip U1 is connected to one end of the resistor R1. The other end of the resistor R1 is the second signal input terminal MCU_RX1.

[0018] like Figure 2 As shown, MOSFET Q1 is an N-channel MOSFET. The power supply VCC is 3.3V.

[0019] like Figure 2 As shown, the pull-up / pull-down circuit 7 includes resistors R4 and R5. One end of resistor R4 is connected to ground signal GND, and the other end of resistor R4 is connected to terminal B of RS-485 communication chip U1. One end of resistor R5 is connected to power supply VCC, and the other end of resistor R5 is connected to terminal A of RS-485 communication chip U1.

[0020] like Figure 2As shown, the protection circuit 8 includes resistors R6 and R7, positive temperature coefficient resistor protectors PT1 and PT2, TVS diodes D1, D2, and D3. Terminal A of the RS-485 communication chip U1 is connected to one end of resistor R7, and the other end of resistor R7 is connected to ground (GND) via TVS diode D1. Terminal B of the RS-485 communication chip U1 is connected to one end of resistor R6, and the other end of resistor R6 is connected to the positive temperature coefficient resistor protector PT1. The other end of resistor R7 is connected to the positive temperature coefficient resistor protector PT2, and the other end of resistor R6 is connected to the other end of resistor R7 via TVS diode D2. One end of TVS diode D3 is connected to the other end of resistor R6, and the other end of TVS diode D3 is connected to ground (GND).

[0021] like Figure 2 As shown, resistors R4 and R5 have the same resistance value. Resistors R6 and R7 have the same resistance value. The first signal input terminal MCU_TX1 and the second signal input terminal MCU_RX1 are both used to connect to the MCU.

[0022] like Figure 2 As shown, Q1 is a low-power N-MOS transistor, controlling the transmit and receive enable of the RS-485 signal; R1, R2, and R8 are current-limiting resistors, R9 is the gate-level pull-down resistor of Q1; R4 is the B signal pull-down resistor, and R5 is the A signal pull-up resistor; C1 is the filter capacitor for the power supply VSS of chip U1; U1 is a general-purpose RS-485 communication chip; when the MCU needs to send data, Q1, R4, and R5 enable one MCU pin of MCU_TX1, simultaneously realizing data transmission and chip enable functions.

[0023] In the dual I / O port transmitting circuit 6, interface MCU_RX1 connects to the data receiving port of the system's main control MCU, MCU_TX1 connects to the data transmitting port of the system's main control MCU, and 485_3.3V connects to the system's 3.3V operating power supply; RS-485 communication chip U1 converts the TX / RX general serial port data of the main control MCU (corresponding to RO / DI of U1) into differential signal RS-485 data (corresponding to B / A of U1); interfaces 485_B and 485_A of RS485 output interface 9 are connected to output or output 485 A / B signals;

[0024] The operation of this RS-485 circuit is as follows:

[0025] When the local system MCU needs to receive external 485 data, first set MCU_TX1 high to 3.3V, turn on MOSFET Q1, and pull the / RE and DE pins of U1 low to 0V. Chip U1 is in data receiving mode, and MCU_RX1 can directly read data from the RO pin of U1.

[0026] When the local system MCU needs to send 485 data, MCU_RX1 is not working, and MCU_TX1 simultaneously performs the functions of transmit enable and data transmission. Specifically: when the MCU needs to transmit a high level "1", MCU_TX1 is first set high, Q1 is turned on, and the / RE and DE pins of U1 are 0, putting U1 in receive mode. At this time, the B line of U1 chip is pulled down to 0V by R4, and the A line is pulled up to 3.3V by R5. The voltage difference VAB on the A and B lines = V485B - V485A = 0 - 3.3 = -3.3V < -200mV, representing logic 1. Figure 2 In the middle, RS485 output interface 9 outputs logic "1"; when a low level "0" needs to be transmitted, MCU_TX1 is set low, Q1 is cut off, and the / RE and DE pins of U1 are pulled up to 3.3V by R2. U1 is in transmit mode. At this time, the "0" sent by MCU_TX1 enters the DI pin of chip U1. After being processed by U1, logic "0" is output on A / B, and logic "0" is output on RS485 output interface 9.

[0027] This module has a simple circuit function and low cost. It can effectively solve the problem of insufficient MCU IO port resources in RS-485 communication. Practical verification has shown that this circuit can work normally and successfully complete RS-485 communication, which has good practicality.

[0028] When transmitting data "1", this invention enables U1 to operate in data receiving mode by turning on Q1. Although the data "1" to be transmitted cannot enter the DI pin of U1, the A / B output logic "1" is achieved through the pull-up / pull-down resistors on the A / B lines.

[0029] The number and resistance value of R1~R8 in the circuit can be adjusted according to the actual situation; Q1 N-MOSFET can be adjusted to NPN transistor.

[0030] It should be noted that the above examples are only one specific embodiment of this utility model. Obviously, this utility model is not limited to the above embodiments and can have many variations. In short, all variations that can be directly derived or conceived by those skilled in the art from the content disclosed in this utility model should be considered within the protection scope of this utility model.

Claims

1. A circuit that uses dual I / O ports to implement RS485 communication, characterized in that, The circuit includes a dual I / O port transmitting circuit (6), an RS-485 communication chip U1, pull-up / pull-down circuits (7), a protection circuit (8), an RS485 output interface (9), and a power supply VCC. The dual I / O port transmitting circuit is connected to the pull-up / pull-down circuit (7) through the RS-485 communication chip U1. The pull-up / pull-down circuit (7) is connected to the RS485 output interface (9) through the protection circuit (8). The dual I / O port transmitting circuit (6), the RS-485 communication chip U1, and the pull-up / pull-down circuit (7) are all connected to the power supply VCC. The dual I / O port transmitting circuit (6) includes resistors R1, R2, R3, R8, R9, and a MOSFET Q.

1. One end of resistor R2 is connected to power supply VCC, and the other end of resistor R2 is connected to the drain (D) of MOSFET Q1. The source (S) of MOSFET Q1 is connected to ground signal GND. The gate (G) of MOSFET Q1 is connected to ground signal GND through resistor R9. The gate of MOSFET Q1 is connected to one end of resistor R8. The other end of resistor R8 is connected to the DI terminal of RS-485 communication chip U1 through resistor R3. The other end of resistor R8 is the first signal input terminal MCU_TX1. The / RE and DE terminals of RS-485 communication chip U1 are both connected to the drain (D) of MOSFET Q1. The RO terminal of RS-485 communication chip U1 is connected to one end of resistor R1. The other end of resistor R1 is the second signal input terminal MCU_RX1.

2. The circuit for implementing RS485 communication using dual I / O ports according to claim 1, characterized in that, The MOSFET Q1 is an N-channel MOSFET.

3. The circuit for implementing RS485 communication using dual I / O ports according to claim 1, characterized in that, The power supply VCC is 3.3V.

4. The circuit for implementing RS485 communication using dual I / O ports according to claim 1, characterized in that, The pull-up / pull-down circuit (7) includes resistors R4 and R5. One end of resistor R4 is connected to ground signal GND, and the other end of resistor R4 is connected to the B terminal of RS-485 communication chip U1. One end of resistor R5 is connected to power supply VCC, and the other end of resistor R5 is connected to the A terminal of RS-485 communication chip U1.

5. The circuit for implementing RS485 communication using dual I / O ports according to claim 1, characterized in that, The protection circuit (8) includes resistors R6 and R7, positive temperature coefficient resistor protector PT1 and PT2, TVS diodes D1, D2, and D3. Terminal A of the RS-485 communication chip U1 is connected to one end of resistor R7, and the other end of resistor R7 is connected to ground signal GND through TVS diode D1. Terminal B of the RS-485 communication chip U1 is connected to one end of resistor R6, and the other end of resistor R6 is connected to positive temperature coefficient resistor protector PT1. The other end of resistor R7 is connected to positive temperature coefficient resistor protector PT2, and the other end of resistor R6 is connected to the other end of resistor R7 through TVS diode D2. One end of TVS diode D3 is connected to the other end of resistor R6, and the other end of TVS diode D3 is connected to ground signal GND.

6. The circuit for implementing RS485 communication using dual I / O ports according to claim 4, characterized in that, The resistors R4 and R5 have the same resistance value.

7. The circuit for implementing RS485 communication using dual I / O ports according to claim 5, characterized in that, The resistance values ​​of resistor R6 and resistor R7 are the same.

8. The circuit for implementing RS485 communication using dual I / O ports according to claim 1, characterized in that, The first signal input terminal MCU_TX1 and the second signal input terminal MCU_RX1 are both used to connect to the MCU.