Automatic adaptation circuit applied to terminal resistor of CAN bus or 485 bus
Through integrated communication module design, automatic adaptation of CAN bus and 485 bus terminating resistors is achieved, solving the problem of module design differences in different locations, improving production efficiency and maintenance convenience, and ensuring the stability and reliability of network communication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUNAN KEBA AUTOMOTIVE BATTERY CO LTD
- Filing Date
- 2026-02-06
- Publication Date
- 2026-05-01
AI Technical Summary
In existing technologies, the terminating resistors of CAN bus and 485 bus need to be designed differently depending on their location, which leads to complex manufacturing and maintenance, lacks automatic adaptation and parameter monitoring capabilities, and makes it difficult to meet the stability requirements of complex networking environments.
The integrated communication module design includes a transceiver, MCU, operational amplifier, voltage window comparator, and switching components. The circuit automatically identifies the first and last stages and automatically adapts the terminating resistors, ensuring the uniformity of the hardware structure of all modules. Communication control and status monitoring are achieved through the MCU.
It enables automatic adaptation of terminating resistors at both ends of the CAN bus or 485 bus, improving production standardization and maintenance convenience, and enhancing the stability and reliability of network communication.
Smart Images

Figure CN121967118A_ABST
Abstract
Description
An automatic adapter circuit for terminating resistors on CAN bus or 485 bus Technical Field
[0001] This invention relates to the field of communication circuit technology, and in particular to an automatic adaptation circuit for terminating resistors of CAN bus or 485 bus. Background Technology
[0002] Both the CAN bus and the 485 bus use a two-wire differential bus communication method, enabling multi-node connections and requiring relatively long connecting cables. They are widely used in industrial control, automotive electronics, and other fields. Terminating resistors are key components for ensuring the communication quality of the CAN and 485 buses; their core functions are to improve the bus's anti-interference capability, optimize signal quality, and eliminate signal reflections.
[0003] According to the technical requirements of bus communication, terminating resistors must be connected in parallel at both ends of the bus, i.e., the two nodes furthest apart, rather than being required for all communication modules. This characteristic means that communication modules in different locations cannot use a unified hardware structure in circuit design, hindering standardized operations during production and increasing the complexity of module replacement during later maintenance, thus reducing production and maintenance efficiency. Furthermore, traditional communication modules lack monitoring and communication control mechanisms for key circuit parameters, making it difficult to meet the stability requirements of complex networking environments. Therefore, how to achieve automatic adaptation of terminating resistors when CAN bus and 485 bus are networked, while simultaneously improving the communication control and parameter monitoring capabilities of the modules, has become a pressing technical problem to be solved in this field. Summary of the Invention
[0004] The purpose of this invention is to propose an automatic adaptation circuit for terminating resistors of CAN bus or 485 bus, so as to realize the automatic adaptation of terminating resistors at both ends of the bus during networking, ensure the uniformity of hardware structure of all communication modules, and improve production and maintenance efficiency and network communication stability.
[0005] To achieve this purpose, the present invention adopts the following technical solutions: An automatic adaptation circuit for terminal resistors applied to CAN bus or 485 bus, including at least two communication modules connected in series for networking. Each communication module includes a transceiver, an MCU, an operational amplifier, a voltage window comparator, a switching component, and an initial reference voltage source. The operational amplifier is a non-inverting summing amplifier. The non-inverting input terminals of the operational amplifier are respectively connected to the initial reference voltage source and the output voltage signal of the previous communication module. The output terminal of the operational amplifier is connected to the input terminal of the voltage window comparator. The output terminal of the voltage window comparator is connected to the control terminal of the switching component. A terminal resistor is connected in series at the output terminal of the switching component, and the terminal resistor is electrically connected to the MCU through the transceiver. When networking, the input terminals of the operational amplifier of the first-level communication module are left floating or grounded through a weak pull-down resistor, and the output terminal of the operational amplifier of the last-level communication module is left floating. When starting up, the output voltage of the operational amplifier of each communication module triggers the voltage window comparator to control the on / off of the switching component, so as to achieve the automatic adaptation of the terminal resistor at both the head and the end of the CAN bus or 485 bus. <s
[0006] Preferably, the non-inverting input terminal of the operational amplifier is connected to the reference voltage source through a first resistor, and the non-inverting input terminal of the operational amplifier is connected to the output voltage signal of the previous communication module through a second resistor. The inverting input terminal of the operational amplifier is grounded through a third resistor, and the inverting input terminal of the operational amplifier is also connected to its own output terminal through a fourth resistor.
[0007] Preferably, the resistance values of the first resistor and the second resistor are equal, the resistance values of the third resistor and the fourth resistor are equal, and the output voltage of the operational amplifier satisfies Uout = Uin + Uref, where Uout is the output voltage of the operational amplifier, Uin is the output voltage of the previous communication module, and Uref is the voltage of the initial reference voltage source.
[0008] Preferably, the voltage window comparator consists of two comparators. The non-inverting input terminal of one comparator is connected to the output terminal of the operational amplifier, and its inverting input terminal is connected to a second reference voltage source. The inverting input terminal of the other comparator is connected to the output terminal of the operational amplifier, and its non-inverting input terminal is connected to a first reference voltage source.
[0009] Preferably, the value ranges of the first reference voltage source and the second reference voltage source satisfy Uref < Uref1 < 2×Uref and (n - 1)Uref < Uref2 < nUref, where n is the number of levels of the communication modules in the network, Uref is the voltage of the initial reference voltage source, Uref1 is the voltage of the first reference voltage source, and Uref2 is the voltage of the second reference voltage source.
[0010] Preferably, the switching assembly includes a first diode, a second diode, and a switching element; the output terminals of the two comparators are electrically connected to the positive terminals of the first diode and the second diode, respectively; the negative terminals of the first diode and the second diode are both electrically connected to the control terminal of the switching element; and the output terminal of the switching element is connected to the transceiver in series with the terminating resistor.
[0011] Preferably, the switching device is a MOSFET, a relay, or an electronic switch.
[0012] Preferably, the value of the initial reference voltage source does not exceed one-nth of the supply voltage of the operational amplifier, and the supply voltage range of the operational amplifier is 3.3V~30V, where n is the number of communication module stages in the network.
[0013] Preferably, the resistance of the terminating resistor is 120 ohms.
[0014] Preferably, the transceiver is a CAN bus transceiver or a 485 bus transceiver, and the transceiver and the MCU communicate with each other through a communication interface. The bus interface of the transceiver is used to connect to the CAN bus or the 485 bus.
[0015] One of the above technical solutions offers the following advantages: The integrated modular design unifies the hardware structure of all communication modules, solving the problem of differentiated design required for modules in different locations in traditional technologies, thus achieving standardized production and convenient maintenance. No manual intervention is needed for configuring the terminal resistors; the hardware circuit automatically completes the identification of the first and last stages and resistor matching, reducing networking difficulty and the risk of human error. The addition of the MCU integrates communication control and status monitoring, improving the stability and reliability of the circuit in complex networking environments. Attached Figure Description
[0016] Figure 1 is a schematic diagram of an automatic adaptation circuit applied to the terminating resistor of a CAN bus or 485 bus; Figure 2 is a schematic diagram of a single communication module in an automatic adaptation circuit applied to the terminating resistor of a CAN bus or 485 bus. Detailed Implementation
[0017] The technical solution of the present invention will be further described below with reference to the accompanying drawings and specific embodiments.
[0018] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "left," "right," "vertical," "level," "top," "bottom," "inner," "outer," "axial," "radial," and "circumferential" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this invention and simplifying the description, and are not intended to indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention.
[0019] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0020] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "joining" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal communication between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0021] An automatic adaptation circuit for terminating resistors on CAN or 485 buses includes at least two communication modules connected in series. Each communication module includes a transceiver, an MCU, an operational amplifier, a voltage window comparator, a switching assembly, and an initial reference voltage source. The operational amplifier is a non-inverting adder. The non-inverting input of the operational amplifier is connected to the initial reference voltage source and the output voltage signal of the previous communication module. The output of the operational amplifier is connected to the input of the voltage window comparator, and the output of the voltage window comparator is connected to the control terminal of the switching assembly. A terminating resistor is connected in series to the output of the switching assembly. The terminating resistor is electrically connected to the MCU through the transceiver. During networking, the input of the operational amplifier of the first-stage communication module is left floating or grounded through a weak pull-down resistor, and the output of the operational amplifier of the last-stage communication module is left floating. During startup, the output voltage of the operational amplifier of each communication module triggers the voltage window comparator to control the switching assembly to switch on and off, thereby achieving automatic adaptation of the terminating resistor at the beginning and end of the CAN or 485 bus.
[0022] As shown in Figure 1-2, this technical solution achieves automatic adaptation of terminating resistors through a series-connected network of communication modules. Each communication module integrates a transceiver, MCU, operational amplifier, voltage window comparator, switching components, and an initial reference voltage source, forming a fully functional independent unit. During networking, the input terminal of the operational amplifier in the first-stage module is left floating to ensure an input voltage of 0V, and the output terminal of the operational amplifier in the last-stage module is also left floating. Through the cascading relationship of "previous stage output - subsequent stage input" between modules, the output voltage of each operational amplifier increases with each stage. This output voltage serves as the input signal for the voltage window comparator, triggering the comparator to output a corresponding level, thereby controlling the on / off state of the switching components. Ultimately, only the terminating resistors of the first and last stage modules are connected to the bus through the transceiver, achieving automatic adaptation. Simultaneously, the MCU and the terminating resistors are electrically connected through the transceiver to complete communication control and circuit status monitoring.
[0023] To further explain, the non-inverting input of the operational amplifier is connected to the reference voltage source through a first resistor, and the non-inverting input of the operational amplifier is connected to the output voltage signal of the previous stage communication module through a second resistor; the inverting input of the operational amplifier is grounded through a third resistor, and the inverting input of the operational amplifier is also connected to its own output through a fourth resistor.
[0024] A stable non-inverting adder circuit structure is further constructed for operational amplifier U1 using a resistor network. The first resistor R1 and the second resistor R2 serve as input current-limiting resistors for the initial reference voltage source Uref and the output voltage Uin of the preamplifier module, respectively, ensuring that the input voltage is stably transmitted to the non-inverting input terminal of operational amplifier U1. The third resistor R3 provides a grounding path for the inverting input terminal, and the fourth resistor R4 forms a voltage negative feedback loop, which can stabilize the operating state of operational amplifier U1, suppress temperature drift and signal distortion, and provide a hardware foundation for accurate addition operations.
[0025] To further explain, the first resistor and the second resistor have the same resistance value, the third resistor and the fourth resistor have the same resistance value, and the output voltage of the operational amplifier satisfies Uout=Uin+Uref, where Uout is the output voltage of the operational amplifier, Uin is the output voltage of the previous stage communication module, and Uref is the voltage of the initial reference voltage source.
[0026] Based on the symmetrical resistor design, the operational amplifier U1 meets the circuit conditions for addition. When the first resistor R1 and the second resistor R2 have equal resistance values, the two input voltages are superimposed with equal weights at the non-inverting input terminal. When the third resistor R3 and the fourth resistor R4 have equal resistance values, the gain of the negative feedback loop matches the input loop, ultimately ensuring that the output voltage of the operational amplifier U1 strictly follows the addition formula Uout=Uin+Uref. This achieves accurate voltage encoding at the module level, providing accurate voltage basis for subsequent identification of the first and last stages.
[0027] For further illustration, the voltage window comparator consists of two comparators. The non-inverting input terminal of one comparator is connected to the output terminal of the operational amplifier, and its inverting input terminal is connected to a second reference voltage source. The inverting input terminal of the other comparator is connected to the output terminal of the operational amplifier, and its non-inverting input terminal is connected to a first reference voltage source.
[0028] Specifically, two comparators U2 and U3 are used to form a complementary voltage detection structure, which together constitute the voltage window comparator. One comparator U2 takes the output voltage of the operational amplifier U1 as the non-inverting input and the second reference voltage source Uref2 as the inverting input, and is used to detect the high voltage signal of the last-stage module. The other comparator U3 takes the output voltage of the operational amplifier U1 as the inverting input and the first reference voltage source Uref1 as the non-inverting input, and is used to detect the low voltage signal of the first-stage module. Through the collaborative work of the two comparators U2 and U3, the voltage difference between the first and last-stage modules and the intermediate-stage modules can be accurately identified.
[0029] For further illustration, the value ranges of the first reference voltage source and the second reference voltage source satisfy Uref < Uref1 < 2×Uref and (n - 1)Uref < Uref2 < nUref, where n is the number of communication module stages in the network, Uref is the voltage of the initial reference voltage source, Uref1 is the voltage of the first reference voltage source, and Uref2 is the voltage of the second reference voltage source.
[0030] Furthermore, by limiting the value ranges of the first reference voltage source Uref1 and the second reference voltage source Uref2, a precise voltage identification window is constructed. The range setting of Uref < Uref1 < 2Uref ensures that only the first-stage module (output voltage is 1Uref) can make the corresponding comparator output a high level. The range setting of (n - 1)Uref < Uref2 < nUref ensures that only the last-stage module (output voltage is n×Uref) can make the other comparator output a high level. This value range can effectively avoid the output voltage range of the intermediate-stage modules, prevent the comparator from misjudging, and improve the reliability of the first and last-stage identification.
[0031] For further illustration, the switch component includes a first diode, a second diode, and a switch. The output terminals of the two comparators are respectively electrically connected to the positive electrodes of the first diode and the second diode. The negative electrodes of the first diode and the second diode are both electrically connected to the control terminal of the switch. The output terminal of the switch is connected in series with the terminal resistor and then connected to the transceiver.
[0032] Specifically, a level-triggered switch control circuit is constructed using diodes and switching devices. The first diode D1 and the second diode D2 correspond to the output terminals of the two comparators U2 and U3, respectively. The unidirectional conductivity of the diodes prevents mutual interference between the output levels of the two comparators U2 and U3. When either comparator outputs a high level, the corresponding diode conducts, and current flows into the control terminal of the switching device U4, triggering the closing of the switching device U4 and connecting the terminating resistor R5 to the bus. When both comparators U2 and U3 output a low level, diodes D1 and D2 are cut off, the switching device U4 is opened, and the terminating resistor R5 is isolated from the bus.
[0033] To further clarify, the switching device is a MOSFET, a relay, or an electronic switch.
[0034] Switch U4 serves as the control and execution component for the terminating resistor R5 connected to the bus, and can be flexibly selected according to the application scenario. MOSFETs feature fast response speed and low power consumption, making them suitable for high-frequency communication scenarios; relays offer advantages such as good isolation performance and high current carrying capacity, making them suitable for environments with strong electrical interference; electronic switches have high integration and simple control logic, making them suitable for miniaturized module designs. Different types of switches can achieve on / off control through the level signal transmitted by the diode, ensuring reliable connection and disconnection of the terminating resistor.
[0035] To further clarify, the value of the initial reference voltage source does not exceed one-nth of the supply voltage of the operational amplifier, and the supply voltage range of the operational amplifier is 3.3V~30V, where n is the number of communication module stages in the network.
[0036] Furthermore, by limiting the upper limit of the initial reference voltage source Uref, the output voltage of operational amplifier U1 is prevented from exceeding its operating range. The supply voltage range of operational amplifier U1 is 3.3V~30V, which can adapt to different industrial power supply scenarios; the value of the initial reference voltage source Uref does not exceed one-nth of the supply voltage, ensuring that the output voltage n×Uref of the final stage communication module does not exceed the supply voltage, preventing voltage encoding distortion caused by output saturation of operational amplifier U1, while ensuring the safe operation of the device and improving the environmental adaptability of the circuit.
[0037] To further clarify, the terminating resistor has a resistance of 120 ohms.
[0038] Furthermore, the terminating resistor R5 adopts a 120-ohm resistance value common to both CAN bus and 485 bus, which matches the characteristic impedance of the bus. When the terminating resistor R5 is connected to both ends of the bus, it can effectively absorb reflected signals during bus transmission, reduce signal attenuation, reduce electromagnetic interference, thereby improving the stability and transmission distance of bus communication, and conforming to the hardware design specifications of bus communication.
[0039] For further illustration, the transceiver is a CAN bus transceiver or a 485 bus transceiver. The data interaction between the transceiver and the MCU is realized through a communication interface, and the bus interface of the transceiver is used to access the CAN bus or the 485 bus.
[0040] Since the transceiver serves as the interface component between the module and the bus, the corresponding CAN bus transceiver or 485 bus transceiver can be selected according to the bus type to achieve differential transmission and reception of signals. The data interaction between the transceiver and the MCU is realized through a communication interface (such as SPI, I2C, serial port, etc.). The MCU can send control instructions and receive bus data through the transceiver. At the same time, the bus interface of the transceiver is directly connected to the CAN bus or the 485 bus, providing a stable access channel for the terminal resistor to ensure reliable electrical connection between the resistor and the bus.
[0041] The following further elaborates on the present invention in conjunction with specific embodiments, but the protection scope of the present invention is not limited by the specific embodiments.
[0042] As shown in Figure 1 in the embodiment, in this embodiment, 3 communication modules are networked (n = 3), and the supply voltage of the operational amplifier U1 of each communication module is 5V.
[0043] (1) Parameter setting According to the value of the initial reference voltage source Uref not exceeding one nth of the supply voltage of the operational amplifier U1, set Uref = 1.6V (satisfying 5V / 3 ≈ 1.67V, Uref ≤ 1.67V); the first reference voltage source Uref1 = 2.4V (satisfying Uref < Uref1 < 2Uref, that is, 1.6V < 2.4V < 3.2V, this value can improve the anti-interference ability of the circuit); the second reference voltage source Uref2 = (n - 0.5)Uref = 2.5×1.6V = 4V (satisfying (n - 1)Uref < Uref2 < nUref, that is, 3.2V < 4V < 4.8V, this value can improve the anti-interference ability of the circuit); the terminal resistor R5 = 120 ohms; the first resistor R1 = the second resistor R2 = 10k ohms, the third resistor R3 = the fourth resistor R4 = 10k ohms.
[0044] (2) Networking connection The Uin terminal of the operational amplifier U1 of the primary communication module is left floating or grounded through a weak pull-down resistor, and its Uout terminal is connected to the Uin terminal of the secondary communication module; the Uout terminal of the secondary communication module is connected to the Uin terminal of the tertiary communication module; the Uout terminal of the tertiary communication module is left floating. The output terminals of the MOS transistors U4 of each communication module are all connected in series with the terminal resistor R5 and access the CAN bus through a CAN bus transceiver. The MCU is electrically connected to the operational amplifier U1, the comparator U2, the comparator U3, the MOS transistor U4, and the CAN bus transceiver respectively to achieve communication control and parameter monitoring.
[0045] (3) During operation, after power-on, the first-level communication module has Uin=0V and Uout=Uref+Uin=1.6V. The voltage at the non-inverting input of comparator U3 is Uref1=2.4V and the voltage at the inverting input is 1.6V. Comparator U3 outputs a high level, and D2 is turned on. The voltage at the non-inverting input of comparator U2 is 1.6V and the voltage at the inverting input is Uref2=4V. Comparator U2 outputs a low level, and the first diode D1 is turned off. The second diode D2 turns on, causing the LED of U4 to light up. The MOSFET U4 is turned on, and the terminating resistor R5 is connected in parallel to the CAN bus head end through the CAN bus transceiver. The MCU monitors in real time that the output voltage of operational amplifier U1 is 1.6V, comparator U3 outputs a high level, comparator U2 outputs a low level, and the MOSFET U4 is in the turned-on state, confirming that the head-end terminating resistor R5 is successfully matched.
[0046] The second-level communication module has Uin = 1.6V and Uout = 1.6V + 1.6V = 3.2V. Comparator U3 has a non-inverting input voltage of 2.4V and an inverting input voltage of 3.2V, resulting in a low-level output and the second diode D2 being cut off. Comparator U2 has a non-inverting input voltage of 3.2V and an inverting input voltage of 4V, resulting in a low-level output and the first diode D1 being cut off. MOSFET U4 is disconnected, and terminating resistor R5 is not connected to the bus. Operational amplifier U1 outputs 3.2V, and both comparators U2 and U3 output low levels. MOSFET U4 is cut off, confirming that the intermediate module is not connected to a terminating resistor.
[0047] The third-level communication module has Uin = 3.2V and Uout = 1.6V + 3.2V = 4.8V. The voltage at the non-inverting input of comparator U3 is 2.4V, and the voltage at the inverting input is 4.8V. Comparator U3 outputs a low level, and the second diode D2 is cut off. The voltage at the non-inverting input of comparator U2 is 4.8V, and the voltage at the inverting input is 4V. Comparator U2 outputs a high level, and the first diode D1 is turned on. The conduction of the first diode D1 causes the LED of MOSFET U4 to light up, and MOSFET U4 is turned on. The terminating resistor R5 is connected in parallel to the end of the CAN bus via the CAN bus transceiver. The operational amplifier U1 outputs 4.8V, comparator U2 outputs a high level, comparator U3 outputs a low level, and MOSFET U4 is turned on, confirming successful end-of-line terminating resistor adaptation.
[0048] Through the above process, automatic adaptation of the terminating resistors at both ends of the CAN bus is achieved. Simultaneously, the MCU's monitoring function ensures the stability and reliability of the circuit operation. The communication modules of this invention can be increased or decreased in number according to networking requirements. All communication modules have completely identical hardware structures, eliminating the need to distinguish between the first and last stages, greatly simplifying the manufacturing and subsequent maintenance processes, and possessing broad application value.
[0049] The technical principles of the present invention have been described above with reference to specific embodiments. These descriptions are merely for explaining the principles of the invention and should not be construed as limiting the scope of protection of the invention in any way. Based on this explanation, those skilled in the art can readily conceive of other specific embodiments of the invention without inventive effort, and these equivalent variations or substitutions are all included within the scope defined by the claims of this application.
Claims
1. An automatic adaptation circuit for terminating resistors on CAN bus or 485 bus, characterized in that: It includes at least two communication modules connected in series for networking. Each of the communication modules includes a transceiver, an MCU, an operational amplifier, a voltage window comparator, a switching component, and an initial reference voltage source. The operational amplifier is a non-inverting adder. The non-inverting input terminals of the operational amplifier are respectively connected to the initial reference voltage source and the output voltage signal of the previous communication module. The output terminal of the operational amplifier is connected to the input terminal of the voltage window comparator. The output terminal of the voltage window comparator is connected to the control terminal of the switching component. A terminal resistor is connected in series at the output terminal of the switching component, and the terminal resistor is electrically connected to the MCU through the transceiver. When networking, the input terminals of the operational amplifier of the first-level communication module are left floating or grounded through a weak pull-down resistor, and the output terminal of the operational amplifier of the last-level communication module is left floating. When starting up, the output voltage of the operational amplifier of each communication module triggers the voltage window comparator to control the on / off of the switching component, so as to realize the automatic adaptation of the terminal resistor at both ends of the CAN bus or 485 bus.
2. The automatic adaptation circuit for terminating resistors of CAN bus or 485 bus according to claim 1, characterized in that: The non-inverting input terminal of the operational amplifier is connected to the reference voltage source through a first resistor, and the non-inverting input terminal of the operational amplifier is connected to the output voltage signal of the previous communication module through a second resistor. The inverting input terminal of the operational amplifier is grounded through a third resistor, and the inverting input terminal of the operational amplifier is also connected to its own output terminal through a fourth resistor.
3. The automatic adaptation circuit for terminating resistors of CAN bus or 485 bus according to claim 2, characterized in that: The resistance values of the first resistor and the second resistor are equal, the resistance values of the third resistor and the fourth resistor are equal, and the output voltage of the operational amplifier satisfies Uout = Uin + Uref, where Uout is the output voltage of the operational amplifier, Uin is the output voltage of the previous communication module, and Uref is the voltage of the initial reference voltage source.
4. The automatic adaptation circuit for terminating resistors of CAN bus or 485 bus according to claim 1, characterized in that: The voltage window comparator consists of two comparators. The non-inverting input terminal of one of the comparators is connected to the output terminal of the operational amplifier, and its inverting input terminal is connected to the second reference voltage source. The inverting input terminal of the other comparator is connected to the output terminal of the operational amplifier, and its non-inverting input terminal is connected to the first reference voltage source.
5. The automatic adaptation circuit for terminating resistors of CAN bus or 485 bus according to claim 4, characterized in that: The value ranges of the first reference voltage source and the second reference voltage source satisfy Uref < Uref1 < 2×Uref and (n - 1)Uref < Uref2 < nUref, where n is the number of levels of the communication modules in the network, Uref is the voltage of the initial reference voltage source, Uref1 is the voltage of the first reference voltage source, and Uref2 is the voltage of the second reference voltage source.
6. The automatic adaptation circuit for terminating resistors of CAN bus or 485 bus according to claim 4, characterized in that: The switching component includes a first diode, a second diode, and a switching element. The output terminals of the two comparators are respectively electrically connected to the positive poles of the first diode and the second diode. The negative poles of the first diode and the second diode are both electrically connected to the control terminal of the switching element. The output terminal of the switching element is connected in series with the terminal resistor and then connected to the transceiver.
7. The automatic adaptation circuit for terminating resistors of CAN bus or 485 bus according to claim 6, characterized in that: The switching element is a MOS transistor, a relay, or an electronic switch.
8. The automatic adaptation circuit for terminating resistors of CAN bus or 485 bus according to claim 4, characterized in that: The value of the initial reference voltage source shall not exceed one-nth of the supply voltage of the operational amplifier, and the supply voltage range of the operational amplifier shall be 3.3V~30V, where n is the number of communication module stages in the network.
9. The automatic adaptation circuit for terminating resistors of CAN bus or 485 bus according to claim 1, characterized in that: The terminating resistor has a resistance of 120 ohms.
10. The automatic adaptation circuit for terminating resistors of CAN bus or 485 bus according to claim 1, characterized in that: The transceiver is a CAN bus transceiver or a 485 bus transceiver. The transceiver and the MCU communicate with each other through a communication interface. The bus interface of the transceiver is used to connect to the CAN bus or the 485 bus.