The invention relates to a master-slave communication circuit and method for constructing a
ring network based on an RS485
bus, and belongs to the technical field of communication, and the master-slave communication circuit forms the
ring network by a host and a plurality of slaves. The host is provided with an RS485 port 1 and an RS485 port 2, the slaves are sequentially connected end to end to form a ring, the head end is connected with the host port 1, and the
tail end is connected with the port 2. And the slave circuit comprises two RS485 driving chips, two groups of AB ends are respectively connected in series with the
bus, and T / R ends are respectively connected with IO1 / IO2 of the MCU. The RXD1 / RXD2 of the MCU is connected with the RO ends of the two chips, and the TXD1 / TXD2 of the MCU is connected with the DI ends of the two chips. The circuit comprises four diodes, wherein the
cathode of D1 is connected with a connection point of RXD1 and RO, and the
anode of D1 is connected with a connection point of TXD2 and DI; the
cathode of D2 is connected with the RXD2 and RO connection point, and the
anode of D2 is connected with the TXD1 and DI connection point; the
cathode of D3 is connected with TXD1, and the
anode is connected with the connection point of TXD1 and DI; the cathode of D4 is connected with the TXD2, and the anode is connected with the connection point of the TXD2 and the And one ends of the two resistors R1 and R2 are connected with VCC, and the other ends are respectively connected with the two DI ends. The method has the advantages that when the
bus breaks down, normal operation of the
system is not affected, and the communication distance of the bus is prolonged.