RS485 automatic direction control method

By coordinating the control of the universal asynchronous transceiver, the delayed transceiver unit, and the transmission delay compensation unit, the problems of transmission delay and slow signal switching in RS485 communication are solved, realizing the efficient and stable operation of RS485 communication, which is suitable for industrial automation and intelligent building fields.

CN121098656APending Publication Date: 2025-12-09BEIJING ZHONGKE TENGYUE TECH DEV CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511298800.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-11
Publication Date
2025-12-09

AI Technical Summary

Technical Problem

Existing RS485 communication control methods suffer from transmission and reception delays, data loss, slow signal switching, and compatibility issues, affecting the real-time performance and reliability of communication.

Method used

It employs a universal asynchronous transceiver, a delayed transceiver unit, and a transmit delay compensation unit to work in conjunction with an RS485 transceiver. By precisely controlling the level switching and maintenance of the differential signal transmission line, combined with external protection termination resistors, it achieves seamless switching between transmit and receive states for the transceiver.

Benefits of technology

It achieves seamless connection between sending and receiving states without requiring large-scale modifications to existing serial port hardware, improving real-time performance and reliability of communication, and is suitable for long-distance multi-node communication in complex electromagnetic environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121098656A_ABST
    Figure CN121098656A_ABST
Patent Text Reader

Abstract

The invention relates to an RS485 automatic direction control method, which is suitable for a device comprising a universal asynchronous receiving and transmitting transmitter, a delay receiving and transmitting unit, a transmission delay compensation unit and an RS485 transceiver. The data sending end of the asynchronous transceiving transmitter is connected with the input ends of the delay transceiving unit and the sending delay compensation unit, and the data receiving end of the asynchronous transceiving transmitter is connected with the receiving output end of the RS485 transceiver; the output end of the delay transmitting-receiving unit is connected with the low-level effective receiving enabling end and the driving enabling end of the RS485 transceiver, and the output end of the transmitting delay compensation unit is connected with the data input signal end of the transmitting delay compensation unit. The method comprises the steps that when a data sending end is 0, an RS485 transceiver drives an enable end to be 1, and a differential line is driven to a low level; when the signal is changed from 0 to 1, the enable end is driven to keep 1 and is driven to a differential high level; then, the enabling end is driven to be zero and is switched into a receiving state, and a high level threshold is maintained through an external resistor; and when the signal is changed from 1 to 0, the drive enabling end is synchronously changed to 1 and is driven to a differential low level.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of RS485 communication control, in particular to an RS485 automatic direction control method and device. BACKGROUND

[0002] As a balanced digital transmission standard, RS485 is widely used in industrial automation and other fields due to its differential signal transmission, multi-point communication capability, long distance and high speed rate, etc. However, its half-duplex characteristic needs direction control to realize the switching of transmission and reception.

[0003] The existing control mode has the following disadvantages: the software drive control has obvious transmission and reception delay and is easy to lose data; in the hardware control, the switching based on bytes needs additional configuration, and the switching based on bits is slow in level transition due to the circuit capacitance, which affects the high baud rate communication; although the special chip or the transmission-reception chip with automatic control has some improvement, there are still problems of adaptability and signal retention. These defects restrict the real-time and reliability of RS485 communication, and a better automatic direction control scheme is urgently needed. SUMMARY

[0004] Therefore, the present application provides an RS485 automatic direction control method, which is applicable to an RS485 automatic direction control device, and includes a universal asynchronous receiver-transmitter, a delay transmission unit, a transmission delay compensation unit and an RS485 transceiver. The asynchronous receiver-transmitter includes a transmission data end and a reception data end, the transmission data end is connected to the input ends of the delay transmission unit and the transmission delay compensation unit, the reception data end is connected to the reception output end of the RS485 transceiver, the output end of the delay transmission unit is connected to the low-level effective reception enable end and the drive enable end of the RS485 transceiver, and the output end of the transmission delay compensation unit is connected to the data input signal end of the RS485 transceiver; and the RS485 transceiver is used to receive the asynchronous receiver-transmitter, the delay transmission unit and the transmission delay compensation unit. The method includes the following steps: When the signal of the transmission data end is 0, the drive enable end of the RS485 transceiver is 1, and the RS485 transceiver drives the differential signal transmission line to the differential low level; When the signal of the transmission data end changes from 0 to 1, the drive enable end of the RS485 transceiver remains 1, so that the RS485 transceiver drives the differential signal transmission line to the differential high level; The drive enable end of the RS485 transceiver becomes 0, the RS485 transceiver switches to the reception state, and maintains the differential signal transmission line at the differential high level threshold; When the signal of the transmission data end changes from 1 to 0, the drive enable end of the RS485 transceiver synchronously changes to 1, and the RS485 transceiver drives the differential signal transmission line to the differential low level.

[0005] In a possible implementation, when the sending data end signal is 0, the drive enable end of the RS485 transceiver is 1, and the RS485 transceiver drives the differential signal transmission line to a differential low level, including the steps of: The drive enable end of the RS485 transceiver is kept as 1, in a sending enable state; The RS485 transceiver generates a differential low level by driving the differential signal transmission line; If it is in a receiving state before, the sending delay compensation unit delays the sending data end signal for a preset time.

[0006] In a possible implementation, when the sending data end signal changes from 0 to 1, the drive enable end of the RS485 transceiver is kept as 1, and the RS485 transceiver drives the differential signal transmission line to a differential high level, including the steps of: The drive enable end is kept as 1, and the RS485 transceiver continues to drive the differential signal transmission line, switching from a differential low level to a differential high level; After the differential high level is stable, the drive enable end changes from 1 to 0, the RS485 transceiver closes the driving function, and switches to a receiving state; After switching to the receiving state, the differential high level of the differential signal transmission line is maintained.

[0007] In a possible implementation, the drive enable end of the RS485 transceiver changes to 0, the RS485 transceiver switches to a receiving state, and the differential high level of the differential signal transmission line is maintained by an external protection termination resistor, including the steps of: The drive enable end changes from 0 to 1 synchronously with the transmission signal end signal, and immediately enters a sending enable state; The RS485 transceiver drives the differential signal transmission line to switch from a differential high level to a differential low level.

[0008] In a possible implementation, the RS485 transceiver is connected with an external protection termination resistor, and the differential high level of the differential signal transmission line is maintained by the external protection termination resistor of the RS485 transceiver.

[0009] In a possible implementation, the sending delay compensation unit delays the signal of the sending data end for a preset time.

[0010] In a possible implementation, the delay time is not less than the delay time of the drive enable end relative to the sending data end.

[0011] In a possible implementation, the voltage difference of the differential high level threshold is at least 200 mV.

[0012] The RS485 automatic direction control method has the following beneficial effects: Without large-scale modification of the software and hardware architecture of the existing serial port, it can be directly adapted to traditional devices such as universal asynchronous transceiver, thereby reducing the application threshold in the field of industrial automation, intelligent building and the like, and facilitating rapid deployment and upgrading.

[0013] Through the cooperative control of the delay transceiving unit and the transmission delay compensation unit, when the signal at the transmission data end changes from 1 to 0, the driving enable end synchronously changes to 1, thereby avoiding the switching delay in the traditional manual control mode, ensuring the seamless connection of the transmission and reception states in the half-duplex communication, and improving the communication real-time performance.

[0014] The transmission delay compensation unit ensures that the data input signal has been stable when the driving enable end is effective through preset delay processing (the delay time is not less than the delay time of the driving enable end relative to the transmission data end); at the same time, the differential high level threshold (voltage difference is at least 200 mV) is maintained by means of the external protection termination resistance, thereby avoiding signal edge distortion, ensuring that the transmission data pulse width has no obvious change, and completely retaining the original signal characteristics.

[0015] Through the precise control of the level switching and maintenance of the differential signal transmission line, combined with the inherent advantages of differential transmission, the common mode interference in the complex electromagnetic environment is effectively suppressed, the reliability in the long-distance and multi-node communication scene is improved, and it is suitable for the field with high communication quality requirement such as industrial automation and security monitoring.

[0016] Other features and aspects of the present application will become apparent from the following detailed description of exemplary embodiments with reference to the drawings. BRIEF DESCRIPTION OF DRAWINGS

[0017] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the present application, and serve to explain the principles of the present application.

[0018] Figure 1 A structure diagram of the RS485 automatic direction control device according to the embodiment of the present application is shown; Figure 2 A structure diagram of the delay transceiving unit and the transmission delay compensation unit according to the embodiment of the present application is shown; Figure 3 A flowchart of the RS485 automatic direction control method according to the embodiment of the present application is shown; Figure 4 A flowchart of the control steps when the signal at the transmission data end is 0 in the embodiment of the present application is shown; Figure 5 A flowchart of the control steps when the signal at the transmission data end changes from 0 to 1 in the embodiment of the present application is shown; Figure 6A control step flow chart is shown when the RS485 transceiver in the embodiment of the application is switched to a receiving state and a signal changes from 1 to 0. DETAILED DESCRIPTION

[0019] Various exemplary embodiments, features and aspects of the present application will be described in detail, with reference to the accompanying drawings. The same reference numbers in the drawings represent functionally the same or similar elements. Although various aspects of the embodiments are illustrated in the drawings, the drawings are not necessarily drawn to scale unless specifically indicated.

[0020] It should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "upper", "lower", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application or simplifying the description, and therefore cannot be understood as indicating or implying that the indicated device or element must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the present application.

[0021] In addition, the terms "first", "second" are only for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first", "second" can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of "a plurality of" is two or more, unless otherwise specifically limited.

[0022] The word "exemplary" here means "serving as an example, instance, or illustration." Any implementation described as "exemplary" is not necessarily to be construed as preferred or advantageous over other implementations.

[0023] In addition, in order to better illustrate the present application, a large number of specific details are given in the specific embodiments below. Those skilled in the art should understand that the present application can also be implemented without certain specific details. In some examples, methods, means, elements and circuits well known to those skilled in the art are not described in detail, in order to highlight the main idea of the present application.

[0024] The RS485 automatic direction control method and device of the present application is a technical solution for realizing automatic direction control in RS485 communication, which is applied in the fields / equipment requiring long-distance, multi-node communication such as industrial automation, intelligent building, security monitoring, etc., to automatically control the switching of RS485 transceiver between sending and receiving states, reduce manual control steps, improve communication efficiency and stability, and at the same time, through optimizing the differential signal transmission and level maintenance mechanism, enhance the anti-interference ability.

[0025] Apparatus The disclosure of the present application includes an RS485 automatic direction control device, which is applied in the fields of industrial automation, instruments and meters, data acquisition and other fields requiring long-distance communication and equipment related to RS485 half-duplex communication, and plays a role in simplifying 485 transceiver control, shortening the delay of transceiver switching, ensuring the integrity of the transmitted data signal, synchronizing the transceiver control signal and the transmitted signal, and ensuring that the transceiver signal waveform is normal.

[0026] With reference to the drawings Figure 1 , Figure 1 The structure diagram of the RS485 automatic direction control device of the embodiment of the present application is shown. The device includes a universal asynchronous transceiver transmitter 101, a delay transceiver unit 102, a transmission delay compensation unit 103, and an RS485 transceiver 104. The asynchronous transceiver transmitter 101 includes a transmission data end and a receiving data end, the transmission data end is connected to the input end of the delay transceiver unit 102 and the transmission delay compensation unit 103, and the receiving data end is connected to the receiving output end (RO) of the RS485 transceiver 104. The output end of the delay transceiver unit 102 is connected to the low-level active receiving enable end (RE') and the driving enable end (DE) of the RS485 transceiver 104, and the delay transceiver unit 102 includes a shift register and an OR gate 102-2. The output end of the transmission delay compensation unit 103 is connected to the data input signal end of the RS485 transceiver 104, and the transmission delay compensation unit 103 includes a first D flip-flop 103-1. The RS485 transceiver 104 is used to receive the asynchronous transceiver transmitter 101, the delay transceiver unit 102, and the transmission delay compensation unit 103. Through the cooperation of each unit, the device realizes precise transceiver control and avoids conflicts; the transmission delay compensation ensures signal synchronization and prevents data loss; and the overall guarantee stable communication in complex environments, improves transmission efficiency and system reliability.

[0027] With reference to the drawings Figure 2 , Figure 2 The structure diagram of the delay transceiver unit and the transmission delay compensation unit of the embodiment of the present application is shown.

[0028] In a specific embodiment, the data input end of the shift register 102-1 is connected to the transmission data end, the data output end of the shift register 102-1 is connected to the first input end of the OR gate 102-2, and the output end of the OR gate 102-2 is the output end of the delay transceiver unit 102.

[0029] In a specific embodiment, the output end of the delay transceiver unit 102 is connected to the first output D flip-flop 201, and the data output end of the first output D flip-flop 201 is connected to the driving enable end (DE) of the RS485 transceiver 104.

[0030] In an embodiment, the data input of the first D flip-flop 103-1 is connected to the transmitting data terminal, the data output of the first D flip-flop 103-1 is connected to the second output D flip-flop 202, and the output of the second output D flip-flop 202 is connected to the driving input (DI) of the RS485 transceiver 104.

[0031] In an embodiment, the first input D flip-flop 203 is connected between the shift register 102-1 and the transmitting data terminal, the data input of the first input D flip-flop 203 is connected to the transmitting data terminal, and the inverted data output of the first input D flip-flop 203 is connected to the data input of the shift register 102-1.

[0032] In a possible implementation, the first input D flip-flop 203 is connected between the first D flip-flop 103-1 and the transmitting data terminal, and the non-inverted data output of the first input D flip-flop 203 is connected to the data input of the first D flip-flop 103-1.

[0033] In an embodiment, the inverted data output of the first input D flip-flop 203 is connected to the second input of the OR gate 102-2.

[0034] In an embodiment, the device further comprises a clock circuit 204, which is connected to the clock input of the first input D flip-flop 203, the shift register 102-1, the first D flip-flop 103-1, the first output D flip-flop 201, and the second output D flip-flop 202.

[0035] In an embodiment, the shift register 102-1 comprises at least two D flip-flops.

[0036] It should be noted that although the technical solution is described by taking two D flip-flops as an example, those skilled in the art can understand that the present application should not be limited thereto. In fact, the user can flexibly set the number of D flip-flops according to the actual application scene, as long as the delay time of the delay transceiver unit matches the compensation time of the transmitting delay compensation unit, and the synchronization control of the transmitting data terminal signal and the driving enable terminal (DE) signal can be realized, and the transceiver switching without delay and the integrity of the transmitting data signal can be ensured.

[0037] In an embodiment, the D flip-flops are connected in series. Specifically, the data output of the first D flip-flop is connected to the data input of the next D flip-flop, and the above is combined by analogy. Those skilled in the art can clearly understand the technical solution through the above description, and thus further description is omitted here.

[0038] Thus, by the cooperation of the universal asynchronous transceiver, the delay transceiver unit, the transmission delay compensation unit and the RS485 transceiver, combined with the logical design of the shift register, the OR gate and the plurality of D flip-flops, the RS485 automatic direction control device according to the above-mentioned embodiments of the application can realize the automatic direction switching of the RS485 half-duplex communication, ensure the synchronization of the transceiving control signal and the data signal, avoid the transceiving conflict and the data loss, improve the stability and efficiency of the communication in the long distance and complex environment, and is suitable for the RS485 communication scene in various fields such as industrial automation and instruments.

[0039] Method With specific reference Figure 3 , Figure 3 The flow chart of the RS485 automatic direction control method according to the embodiments of the application is shown.

[0040] The application comprises an RS485 automatic direction control method, which is applicable to the RS485 automatic direction control device, and the method comprises the following steps: 301, when the signal of the sending data terminal is 0, the driving enable terminal of the RS485 transceiver is 1, and the RS485 transceiver drives the differential signal transmission line to the differential low level.

[0041] Specifically, the control of the state of the driving enable terminal is included in step 301: at this time, the driving enable terminal of the RS485 transceiver is controlled to be 1 by the delay transceiver unit, and is in the sending enable state, so as to ensure that the transceiver has the ability to drive the differential signal transmission line.

[0042] Specifically, the differential signal driving logic is that the RS485 transceiver drives the differential signal transmission line to generate the differential low level according to the 0 signal of the sending data terminal. Specifically, the voltage of the B line of the differential signal transmission line is higher than the voltage of the A line of the differential signal transmission line, and the difference between the two is greater than 200mV, that is, the level definition of the logic 0 is met, so as to stabilize the transmission of the 0 signal.

[0043] Specifically, the transmission delay compensation mechanism of this step is that due to the introduction of the delay transceiver unit, the state change of the driving enable terminal (DE) has a fixed delay relative to the sending data terminal. In order to avoid the signal conflict that the sending data terminal has been 0 but the driving enable terminal (DE) has not been switched from 0 to 1, the transmission delay compensation unit will delay the 0 signal of the sending data terminal for a preset time, so as to ensure that when the driving enable terminal (DE) becomes 1, the data input terminal of the transceiver has stably received the 0 signal, and the synchronization of the driving action and the input signal is ensured.

[0044] Step 302, when the signal of the sending data terminal changes from 0 to 1, the driving enable terminal of the RS485 transceiver remains 1, so that the RS485 transceiver drives the differential signal transmission line to the differential high level.

[0045] Specifically, the driving enable end maintains the sending state as when the sending data end switches from 0 to 1, the delay transceiver unit controls the driving enable end (DE) to continue to maintain 1, ensuring that the RS485 transceiver is still in the sending enable state, avoiding signal interruption caused by state switching.

[0046] Specifically, the step differential signal switching logic is that the transceiver drives the differential signal transmission line from differential low level to differential high level according to the 1 signal of the sending data end, that is, the voltage of the A line of the differential signal transmission line is higher than the voltage of the B line of the differential signal transmission line, and the difference is greater than 200mV, that is, the level definition of logic 1 is met. In this process, the driving action is synchronized with the signal change of the sending data end, ensuring that the edge of the 1 signal is clear and distortion-free.

[0047] More specifically, the step further includes high level stability guarantee, that is, through the driving capability of the transceiver, the differential high level is quickly established and maintained, ensuring that there is no pulse width loss in the switching process, laying a stable level foundation for subsequent switching to the receiving state.

[0048] In step 303, the driving enable end of the RS485 transceiver becomes 0, and the RS485 transceiver switches to the receiving state, maintaining the differential signal transmission line at the differential high level threshold.

[0049] In this step, the driving enable end switches to the receiving state. Specifically, after the sending data end stabilizes to 1, the delay transceiver unit controls the driving enable end (DE) to change from 1 to 0, the RS485 transceiver closes the driving function and switches to the receiving state. At this time, the receiving enable end RE is synchronized to take effect, allowing the signal on the receiving bus.

[0050] Specifically, the external circuit maintains a high level in this step. That is, after switching to the receiving state, the differential high level of the differential signal transmission line is no longer driven by the transceiver, but is maintained by the external protection termination resistor. The resistance value of the resistor is designed according to the bus characteristics, ensuring that the voltage difference of the differential signal transmission line always remains at 200mV, that is, above the differential high level threshold, avoiding level attenuation caused by circuit capacitance or noise, and ensuring that the receiving end can correctly identify the 1 signal.

[0051] This step guarantees the compatibility of the receiving state. Specifically, in this state, the transceiver only listens to the bus signal and does not output driving to the bus, ensuring that the signals of other devices on the bus can be normally received, in line with the bus sharing mechanism of RS485 half-duplex communication.

[0052] And in step 304, when the sending data end signal changes from 1 to 0, the driving enable end of the RS485 transceiver is synchronized to become 1, and the RS485 transceiver drives the differential signal transmission line to the differential low level.

[0053] Specifically, the driving enable end and the transmitting data end are synchronously switched in this step. When the transmitting data end is switched from 1 to 0, the delay transceiver unit controls the driving enable end (DE) to be synchronously changed from 0 to 1, so that the RS485 transceiver is immediately switched from the receiving state to the transmitting state, and the signal loss caused by the switching delay in the traditional method is eliminated.

[0054] In this step, the differential signal fast switching logic is that the transceiver quickly drives the differential signal transmission line from the differential high level to the differential low level according to the 0 signal of the transmitting data end. Since the driving enable end (DE) and the transmitting data end are synchronously operated, there is no tailing of the signal edge in the switching process, and the pulse width of the “0” signal is consistent with the original transmitting data end signal without obvious change.

[0055] This step also realizes real-time guarantee. That is, the synchronous switching mechanism avoids the signal misplacement problem under the high baud rate, and even in the high-speed communication scene, it can ensure that the 0 signal is accurately received by other devices on the bus, and the real-time performance and reliability of the communication are improved.

[0056] Through the cooperative control of the delay transceiver unit and the transmitting delay compensation unit, the problems of transceiver switching delay and signal distortion in the prior art are solved, and the traditional serial port software and hardware design is compatible, and efficient and stable operation of the RS485 communication is realized.

[0057] Specifically referring to Figure 4 , Figure 4 FIG. 4 shows the RS485 transceiver control flowchart when the transmitting data end signal is 0 according to an embodiment of the present application.

[0058] In a possible implementation, when the transmitting data end signal is 0, the driving enable end of the RS485 transceiver is 1, and the RS485 transceiver drives the differential signal transmission line to the differential low level, which includes the following steps. In step 401, the driving enable end of the RS485 transceiver is kept as 1, and is in the transmitting enable state. In step 402, the RS485 transceiver generates the differential low level by driving the differential signal transmission line. In step 403, if the transmitting data end signal is delayed for a preset time by the transmitting delay compensation unit when it is in the receiving state. The driving enable end keeps the transmitting state to ensure stable signal output, the differential low level driving guarantees reliable data transmission, and the transmitting delay compensation unit avoids signal conflict, is compatible with the original design, realizes non-delay switching, and guarantees data integrity.

[0059] Specifically referring to Figure 5 , Figure 5 FIG. 5 shows the RS485 transceiver control flowchart when the transmitting data end signal is changed from 0 to 1 according to an embodiment of the present application.

[0060] In a possible implementation, when the sending data end signal changes from 0 to 1, the driving enable end of the RS485 transceiver is kept as 1, the RS485 transceiver drives the differential signal transmission line to the differential high level, including the step 501, the driving enable end is kept as 1, the RS485 transceiver continues to drive the differential signal transmission line, and switches from the differential low level to the differential high level. The step 502, after the differential high level is stable, the driving enable end changes from 1 to 0, the RS485 transceiver closes the driving function, and switches to the receiving state. And the step 503, after switching to the receiving state, the differential high level of the differential signal transmission line is maintained. The technical effect is that: keeping the driving enable end as 1 ensures that the differential signal is stably switched to the high level, the receiving state is switched after the signal is stable, the signal is not interrupted, the high level is maintained externally to ensure accurate receiving, the switching is realized without delay, the signal is complete, and the original design is compatible.

[0061] With specific reference Figure 6 , Figure 6 The control flowchart when the RS485 transceiver switches to the receiving state and the signal changes from 1 to 0 is shown.

[0062] In a possible implementation, the driving enable end of the RS485 transceiver changes to 0, the RS485 transceiver switches to the receiving state, the differential high level threshold of the differential signal transmission line is maintained through the external protection termination resistance, including the step 601, the driving enable end changes from 0 to 1 synchronously with the transmission signal end signal, and immediately enters the sending enable state. And the step 602, the RS485 transceiver drives the differential signal transmission line to switch from the differential high level to the differential low level. The driving enable end is switched synchronously, ensuring immediate sending; the differential level is quickly switched, the signal is complete, and the communication efficiency and reliability are improved.

[0063] In a possible implementation, the RS485 transceiver is connected with the external protection termination resistance, and the differential high level of the differential signal transmission line is maintained through the external protection termination resistance of the RS485 transceiver.

[0064] In a possible implementation, the sending delay compensation unit performs delay processing on the signal of the sending data end for a preset time.

[0065] In a possible implementation, the delay time is not less than the delay time of the driving enable end relative to the sending data end.

[0066] In a possible implementation, the voltage difference of the differential high level threshold is at least 200 mV.

[0067] Thus, by the cooperation of the universal asynchronous transceiver, the delay transceiver unit, the transmission delay compensation unit and the RS485 transceiver, combined with the precise control of the level of the differential signal transmission line and the level maintaining effect of the external protection termination resistance, the RS485 automatic direction control method and device according to the above-mentioned embodiments of the application can realize the automatic and non-delay switching of the receiving and transmitting states in the RS485 half-duplex communication, ensure the integrity of the transmitted data signal without distortion, effectively compatible with the original serial port software and hardware design, significantly improve the stability and real-time performance of long-distance and multi-node communication in complex electromagnetic environment, and meet the high reliability requirements of RS485 communication in the fields of industrial automation and intelligent building.

[0068] The above has described the embodiments of the application, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes are obvious to those skilled in the art without departing from the scope and spirit of the described embodiments. The selection of the terms used herein is intended to best explain the principles, practical application or improvement of the technology in the market of the embodiments, or to enable other ordinary skilled persons in the art to understand the embodiments disclosed herein.

Claims

1. An RS485 automatic direction control method, characterized in that, An RS485 automatic direction control device is applicable, including a universal asynchronous transceiver, a delay transceiver unit, a transmit delay compensation unit, and an RS485 transceiver. The asynchronous transceiver includes a data transmitting end and a data receiving end. The data transmitting end is connected to the input ends of the delayed transceiver unit and the transmission delay compensation unit. The data receiving end is connected to the receive output end of the RS485 transceiver. The output end of the delayed transceiver unit is connected to the low-level active receive enable end and the drive enable end of the RS485 transceiver. The output end of the transmission delay compensation unit is connected to the data input signal end of the RS485 transceiver. The RS485 transceiver is used to receive signals from the asynchronous transceiver, the delayed transceiver unit, and the transmission delay compensation unit. The method includes the following steps: When the data transmission terminal signal is 0, the RS485 transceiver's drive enable terminal is 1, and the RS485 transceiver drives the differential signal transmission line to a differential low level. When the data transmission signal changes from 0 to 1, the RS485 transceiver's drive enable pin remains at 1, causing the RS485 transceiver to drive the differential signal transmission line to a differential high level. When the RS485 transceiver's drive enable pin is changed to 0, the RS485 transceiver switches to receive mode, maintaining the differential signal transmission line at the differential high-level threshold. When the data transmission signal changes from 1 to 0, the RS485 transceiver's drive enable pin synchronously changes to 1, and the RS485 transceiver drives the differential signal transmission line to a differential low level.

2. The method according to claim 1, characterized in that, The step of driving the differential signal transmission line to a differential low level when the data transmission terminal signal is 0 and the RS485 transceiver's drive enable terminal is 1 includes the following steps: The RS485 transceiver's drive enable pin is kept at 1, indicating that it is in the transmit enable state; The RS485 transceiver generates a differential low level by driving the differential signal transmission line. If the device was previously in a receiving state, the transmission delay compensation unit will delay the signal from the transmitting data terminal by a preset time.

3. The method according to claim 1, characterized in that, The step of keeping the RS485 transceiver's drive enable pin at 1 when the data transmission terminal signal changes from 0 to 1, thereby driving the RS485 transceiver to a differential high level, includes the following steps: With the drive enable pin set to 1, the RS485 transceiver continues to drive the differential signal transmission line, switching from differential low level to differential high level. After the differential high level stabilizes, the drive enable pin changes from 1 to 0, the RS485 transceiver disables the drive function and switches to the receiving state; After switching to receive mode, maintain the differential high level of the differential signal transmission line.

4. The method according to claim 1, characterized in that, When the enable pin of the RS485 transceiver becomes 0, the RS485 transceiver switches to receive mode. Maintaining the differential signal transmission line at a differential high-level threshold via an external protection resistor includes the following steps: The drive enable terminal and the transmission signal terminal signal synchronously change from 0 to 1, immediately entering the transmit enable state; The RS485 transceiver drives the differential signal transmission line to switch from differential high level to differential low level.

5. The method according to claim 3, characterized in that, The RS485 transceiver is connected to an external protection termination resistor, and the differential high level of the differential signal transmission line is maintained by the external protection termination resistor of the RS485 transceiver.

6. The method according to claim 1, characterized in that, The transmission delay compensation unit performs a preset time delay processing on the signal from the data transmission end.

7. The method according to claim 6, characterized in that, The delay time is not less than the delay time of the drive enable terminal relative to the data transmission terminal.

8. The method according to claim 1, characterized in that, The voltage difference of the differential high-level threshold is at least 200mV.

Citation Information

Patent Citations

  • Automatic stream control device, control method and its circuit

    CN101026387A

  • Signal processing method, device and system

    CN113872837A

  • RS485 circuit capable of automatically switching transmitting and receiving

    CN220440709U

  • Electric system and alarm device thereof

    US20090167528A1