Industrial robot anti-interference multi-slave-station expansion communication system and method
By introducing anti-interference RS485 communication circuits and optimizing the protocol frame structure in the industrial robot system, the problems of insufficient anti-interference ability and low data transmission efficiency of the industrial robot communication system in complex environments are solved, and efficient and reliable multi-slave station data interaction is achieved.
Patent Information
- Application Number
- CN202510648466.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-20
- Publication Date
- 2025-09-19
AI Technical Summary
Existing industrial robot communication systems have problems such as insufficient anti-interference ability in complex environments, low data transmission efficiency and poor scalability for multiple slave stations.
It adopts anti-interference RS485 communication circuit and optimized protocol frame structure, including magnetic beads, TVS tubes, PTC resistors and impedance matching resistors, combined with EtherCAT protocol and dynamic data segment configuration to achieve efficient data interaction between master and slave modules.
It improves the data transmission stability and efficiency of industrial robot systems in complex environments, enhances the system's scalability and fault tolerance, and ensures real-time performance and reliability.
Smart Images

Figure CN120676012A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial automation communication, and in particular to an anti-interference multi-slave station extended communication system and method for an industrial robot. Background Art
[0002] With the widespread application of industrial robots in manufacturing, automotive, logistics and other fields, the functional boundaries of robots are constantly being expanded. In actual applications, the industrial robot body only serves as a displacement mechanism and basic control platform. The actual operation function is realized through various external terminal tool modules, such as spot welding guns, vision systems, sensors, encoders, etc. These functional modules are similar to human senses and actuators. They can not only perceive external information and feedback it to the robot control system, but also accept control instructions to complete specific actions. However, the number of interfaces of the robot controller itself is limited, and it cannot directly connect to a large number of complex functional modules. Therefore, it is necessary to use functional expansion modules for unified management and communication, and all kinds of data are processed by the modules and uploaded to the control system in a centralized manner.
[0003] Currently, the mainstream functional modules on the market are categorized into two types: integrated I / O boards and blade-type I / O modules. Integrated I / O boards, such as some Nabot and Mocha products, while simple in structure, have a limited number of functional modules, poor scalability, and a large size, making them difficult to meet the needs of complex application scenarios. Blade-type I / O modules, such as those used by robots from Efort, Estun, and Kuka, offer improved scalability and flexibility through modular design, making them the current mainstream solution. This present invention is based on research and innovation conducted on the blade-type module architecture.
[0004] A search of relevant patents revealed that, for example, invention patent publication number CN117194302A proposes a remote I / O module control system and method based on RS485 communication. However, it lacks consideration for harsh environment applications, particularly in the hardware circuit anti-interference design, making it difficult to adapt to industrial robot applications under complex working conditions such as high electromagnetic interference and high mechanical vibration. Invention patent publication number CN106773854A proposes a multifunctional I / O module for robots, but its communication protocol design suffers from issues such as low simplicity, insufficient transmission efficiency, and limited scalability, making it difficult to meet the high-speed, real-time, and multi-node expansion communication requirements of current industrial robots.
[0005] In view of the above problems, the present invention proposes a streamlined and efficient communication method and a communication system with strong anti-interference capability. Summary of the Invention
[0006] The purpose of the present invention is to provide an industrial robot anti-interference multi-slave station extended communication system and method, which solves the problems of insufficient anti-interference ability, low data transmission efficiency and poor multi-slave station scalability of existing industrial robot communication systems in complex environments.
[0007] To achieve the above objectives, the present invention is implemented through the following technical solutions: A first aspect of the present invention provides an industrial robot anti-interference multi-slave station extended communication system, comprising: The master module is used to interact with the robot controller via the EtherCAT protocol and parse object dictionary data; At least one slave module, connected to the master module via an RS485 bus, each slave module having a unique ID and connected to an external device for executing data acquisition or control instructions; An anti-interference RS485 communication circuit is integrated into the master module and the slave module, and includes a magnetic bead, a TVS tube, a PTC resistor, and an impedance matching resistor, and is used to suppress transient current, overcurrent, and pulse shock; The master station module and the slave station module interact with each other through a protocol frame, and the protocol frame includes: Identification field, used to uniquely identify the target slave; Configuration field, used to dynamically define the type and length of the data segment; Dynamic data segment, the length of which is determined by the value of the configuration field; The checksum field is generated based on the protocol frame content and is used to verify data integrity.
[0008] Preferably, the anti-interference RS485 communication circuit includes: Magnetic beads are placed on differential signal lines to suppress high-frequency electromagnetic interference; TVS tube, connected between the differential signal line pair and ground, used to absorb transient voltage; PTC resistors are placed in the power path of the differential signal line pair for overcurrent protection. Impedance matching resistors are connected in parallel at both ends of the differential signal line pair, and their resistance values are adapted to the signal transmission frequency.
[0009] Preferably, the identification field and configuration field of the protocol frame are combined into 1 byte, wherein: The identification field is the slave ID, which occupies the upper 4 bits and has a value range of 0x0 to 0xF; The configuration field is the configuration parameter SW, which occupies the lower 4 bits, defines the type and length of the dynamic data segment, and has a non-zero value.
[0010] Preferably, the check field is 1 byte, and is generated by performing a cumulative operation on all bytes of the identification field, configuration field and dynamic data segment in the protocol frame, and taking the lower 8 bits of the operation result.
[0011] Preferably, the master station module includes: A first parsing unit, configured to convert object dictionary data of the robot controller into RS485 protocol instructions; The first communication unit sends inquiry frames or data frames to each slave station in a polling order and receives response frames; Fault-tolerant unit, triggers retransmission mechanism when no response or invalid response is received from slave station, and the maximum number of retransmissions is configurable.
[0012] Preferably, the slave module includes: The second parsing unit is used to filter non-matching instructions according to the frame header ID and parse the data segment defined by the SW; The second communication unit performs peripheral control or data acquisition after receiving the master station command and returns a response frame; The collision avoidance unit discards protocol frames with mismatched IDs or SWs to prevent bus data collisions.
[0013] Preferably, the communication process between the master station module and the slave station module is divided into: Inquiry phase: The master station broadcasts an inquiry frame to obtain the slave station ID and SW, and the slave station returns a response frame containing its own ID and SW; Data transmission phase: The master sends data frames in a polling order, and the slave processes the data according to SW and returns a response frame.
[0014] Preferably, in the inquiry phase, the master station retries the identification field of the unanswered slave station multiple times, and marks the slave station as an invalid node if there is no response.
[0015] A second aspect of the present invention provides an industrial robot anti-interference multi-slave station extended communication method implemented based on the communication system of the first aspect, comprising the following steps: S1. After the master station is initialized, it enters the inquiry phase and sends inquiry frames to all slave stations to obtain the identification field and dynamic data segment of the valid slave station; S2, the master station enters the data transmission phase and sends data frames to each slave station in a polling order. The frame header of the data frame contains the target slave station ID and SW. The SW dynamically defines the data segment type and length; S3. After receiving the data frame, the slave station checks whether the frame header ID matches its own ID. If so, it parses the data segment according to the SW and performs peripheral control or data acquisition, and returns a response frame containing the response data. S4: After receiving the response frame, the master station extracts the data, uploads it to the robot controller via EtherCAT, and starts the next round of interaction. S5. If the master station does not receive a response frame or receives an invalid response frame within the preset time, the retransmission mechanism is triggered. The maximum number of retransmissions is configurable.
[0016] In summary, the present invention includes at least one of the following beneficial technical effects: 1. This invention enhances the stability of the RS485 bus in complex industrial environments by incorporating an anti-interference design into the communication circuit. By filtering high-frequency noise, absorbing transient voltages, and providing overcurrent protection, the anti-interference circuit effectively reduces the impact of external electromagnetic interference on communication signals, thereby ensuring reliable data transmission. This design is particularly important for industrial robotic systems that require long-term stable operation, helping to reduce the risk of equipment failure and communication interruptions.
[0017] 2. The communication protocol of this invention effectively improves data transmission efficiency by streamlining the protocol frame structure and optimizing the data exchange process. The protocol's rationally designed query and data transmission processes ensure that data frames are transmitted without redundant information, minimizing communication delays. This is crucial for industrial robot applications in real-time control and data acquisition, ensuring fast and accurate data exchange.
[0018] 3. By defining a variable SW field, this invention enables dynamic configuration of data segment length and type, allowing the communication protocol to flexibly adapt to the needs of different slave devices. This feature allows the master to determine the data transmission content based on the capabilities and needs of the slave device in practical applications. This not only improves the flexibility of data exchange, but also supports the access of multiple different types of devices, enhancing the scalability of the system.
[0019] 4. This invention incorporates a retransmission mechanism that automatically triggers retransmission when the master station fails to receive a response frame or receives an invalid response frame, effectively preventing communication loss due to transmission failures or interference. This mechanism significantly enhances the communication system's fault tolerance, enabling it to maintain high reliability even in complex or unstable communication environments. In industrial automation, this feature ensures stable communication between devices even under harsh conditions.
[0020] 5. This invention optimizes the data transmission process, employs efficient protocols, and employs anti-interference design to enable fast and accurate data exchange within the communication system. Rapid data processing and real-time interaction between the master and slave devices reduces latency, thereby improving the overall system's responsiveness. In industrial robotic applications, real-time performance is crucial for efficient operation. This invention effectively enhances the system's responsiveness, enabling robots to react quickly in dynamic environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 Schematic diagram of the communication system architecture of the present invention; Figure 2 This is a schematic structural diagram of the master station module and the slave station module of the present invention; Figure 3 It is the anti-interference RS485 communication circuit diagram of the present invention; Figure 4 This is a flow chart of the communication method of the present invention. DETAILED DESCRIPTION
[0022] The following is combined with Figure 1 -Attached Figure 4 , the present invention is described in further detail.
[0023] This paper provides an interference-resistant, multi-slave expansion communication system for industrial robots, designed to achieve high-reliability and low-latency multi-device communication in industrial robot control scenarios. By leveraging an optimized RS485 protocol, interference-resistant hardware design, and a dynamic slave expansion mechanism, this system meets the stringent real-time and interference-resistant requirements of industrial environments.
[0024] like Figure 1 As shown, the communication system includes a master module, a slave module and an anti-interference RS485 communication circuit: Master module: As the communication core, it is connected to the robot controller through the EtherCAT protocol and is responsible for object dictionary data parsing, protocol instruction conversion and multi-slave management.
[0025] Slave module: connected to the master module via RS485 bus, supports external digital / analog devices, and executes data acquisition or control instructions.
[0026] Anti-interference RS485 communication circuit: integrated into the master and slave hardware, designed to suppress high-frequency interference, transient voltage and overcurrent shocks to ensure system stability in harsh environments.
[0027] The various parts of the communication system of the present invention are described in detail below with reference to the accompanying drawings.
[0028] like Figure 2 As shown, in this embodiment, the master station module serves as the core of the entire communication system, and its functions include communicating with the robot controller through the EtherCAT protocol, parsing object dictionary data, converting protocol instructions, and managing communications with multiple slave stations.
[0029] In this embodiment, the master module connects to the robot controller via the EtherCAT protocol. As a high-speed, real-time industrial network protocol, EtherCAT is widely used in industrial robot control systems. The master module's communication unit exchanges data with the controller via the EtherCAT protocol, enabling control of external devices and data acquisition. The master module parses the object dictionary data sent from the robot controller, converting it into protocol instructions that meet RS485 communication requirements, and then exchanges data with each slave via the RS485 bus.
[0030] The master module houses a first parsing unit, which converts the object dictionary data received from the robot controller into the format required by the RS485 protocol. This process involves parsing and reorganizing the data for efficient transmission via the optimized RS485 protocol. Specifically, the parsing unit processes the dictionary data according to the protocol requirements and assigns the appropriate data fields and instructions to each slave.
[0031] When sending protocol commands, the master module transmits data packets to each slave via the RS485 bus via the first communication unit. Following a pre-set polling sequence, the master module sends inquiry frames or data frames to each slave. When sending data command frames, the master module generates corresponding data frames based on the slave's ID and SW information and transmits them via the RS485 bus. During data transmission, the master module waits for a response frame from each slave and performs further processing based on the data returned in the response frame.
[0032] To ensure the stability and reliability of data exchange, the master module also features a fault-tolerance unit. During communication, if the master module fails to receive a response frame from a slave or receives an invalid response frame, the fault-tolerance unit triggers a retransmission mechanism and resends the command frame. The maximum number of retransmissions for this retransmission mechanism can be configured as needed to ensure communication reliability. If the master module sends the same command frame multiple times without receiving a valid response, the system marks the slave as an invalid node and continues data exchange with other slaves.
[0033] The master module also includes an anti-interference RS485 communication circuit, integrated within the module. This circuit is designed to resist high-frequency interference, transient voltages, and overcurrent surges. Key components used in this anti-interference circuit include ferrite beads, TVS diodes, PTC resistors, and impedance matching resistors. Ferrite beads filter out high-frequency noise, TVS diodes effectively absorb transient voltages, PTC resistors provide overcurrent protection, and impedance matching resistors ensure stable signal transmission and prevent signal reflections.
[0034] In the protocol frame structure design, the master module divides the data into an identification field, a configuration field, a dynamic data segment, and a checksum field, according to the RS485 protocol requirements. The identification field uniquely identifies the target slave, while the configuration field dynamically defines the type and length of the data segment. The length of the dynamic data segment is determined by the value in the configuration field to meet the data requirements of different application scenarios. The checksum field is generated by performing an accumulation operation on the protocol frame content and is used to verify data integrity and ensure that data is not tampered with during transmission.
[0035] like Figure 2 As shown, in this embodiment, the slave module is connected to the master module via an RS485 bus, responsible for data reception, command interpretation, peripheral device control, and data acquisition. Its design aims to ensure efficient and stable operation of the slave module in the industrial robot system, enabling real-time response to master commands and data exchange with external devices.
[0036] The basic functions of the slave module include two parts: receiving the protocol frames sent by the master and executing the corresponding tasks, and feeding back the data of the external device to the master.
[0037] To ensure effective communication with the master, the slave module first needs to parse the received data frame. This process is performed by the second parsing unit within the slave module. The parsing unit checks the identification field of the received protocol frame to ensure that the ID in the frame header matches the module's own ID. If the ID in the frame header does not match the slave's ID, the frame is discarded to avoid data conflicts. If they do match, the parsing unit further parses the configuration field and data segment in the frame header. The SW in the configuration field defines the type and length of the data segment, instructing the slave how to process the subsequent data.
[0038] After receiving and parsing the protocol frame, the slave module performs the corresponding peripheral control or data acquisition operations. Specifically, the slave module exchanges data with external devices (such as sensors and actuators) through interfaces, executing control commands or collecting data tasks issued by the master. These external devices are connected to the slave module via digital or analog interfaces. The slave module controls the device or collects device status data based on the received instructions.
[0039] After completing data acquisition or device control, the slave module encapsulates the corresponding data into a protocol frame and returns it to the master module via the RS485 bus. At this point, the slave module's second communication unit generates a data response frame and sends it back to the master. The data response frame includes the slave's ID, SW, and the corresponding dynamic data segment, ensuring that the master receives timely feedback from the slave after completing the task.
[0040] To ensure stable communication, the slave module also includes a collision avoidance unit. If a slave receives a protocol frame with a mismatched ID or SW, the collision avoidance unit automatically discards the frame, preventing data collisions on the bus. This design avoids communication errors caused by ID conflicts in multi-slave systems, improving data transmission efficiency and reliability across the entire system.
[0041] The slave module also integrates an anti-interference RS485 communication circuit, which utilizes the same anti-interference design as the master module, including ferrite beads, TVS diodes, PTC resistors, and impedance matching resistors. The ferrite beads filter out high-frequency interference, the TVS diodes absorb transient voltages, the PTC resistors provide overcurrent protection, and the impedance matching resistors ensure stable signal transmission. These designs effectively enhance the slave module's anti-interference capabilities in industrial environments and ensure stable communication on the RS485 bus.
[0042] The structure of the protocol frame is also rigorously parsed and processed within the slave module. Each protocol frame's identification field identifies the target master or slave, while the configuration field defines the type and length of the dynamic data segment. During dynamic data segment processing, the slave determines the data parsing method based on the value of the configuration field, ensuring that every instruction is correctly executed. The design of the checksum field is equally important; it verifies data integrity by summing all bytes of the protocol frame and taking the lower 8 bits, ensuring accurate communication.
[0043] like Figure 3 As shown, in this embodiment, the anti-interference RS485 communication circuit is used to ensure stable transmission of RS485 bus signals in complex industrial environments, suppressing the effects of external electromagnetic interference, transient voltage surges, and overcurrent. This circuit design is integrated into the master and slave modules to enhance the system's anti-interference capabilities and improve the reliability and stability of data transmission.
[0044] In this embodiment, the SN65HVD75DR used in the 485 transceiver is connected to the MCU on the left. R2, R6, and R3 (10Ω resistors) on the signal line absorb reflected signals, which is conducive to high-frequency data transmission. The right side is connected to other functional modules. Magnetic beads are added for transient current suppression, PTC resistors are used for overcurrent protection, and TVS tubes can effectively protect the circuit from various forms of pulse shocks, making it stable for robot application scenarios in harsh environments.
[0045] The anti-interference RS485 communication circuit mainly includes key components such as ferrite beads, TVS tubes, PTC resistors and impedance matching resistors. The synergistic effect of these components can effectively protect the RS485 communication line from various interferences and ensure that data can be transmitted smoothly.
[0046] Ferrite beads (such as FB1 and FB2) are placed on RS485 differential signal lines to filter out high-frequency electromagnetic interference. High-frequency noise can affect signal quality, leading to data transmission errors or instability. Ferrite beads effectively convert high-frequency noise on the signal lines into heat energy, preventing interference signals from affecting normal data transmission.
[0047] TVS diodes (such as D2 and D3) are connected between the differential signal lines and ground to absorb transient voltages. Transient voltages, such as surge currents caused by lightning strikes or power switching, can severely damage communication lines. TVS diodes, with their fast response, can instantly absorb these voltage peaks and divert them to ground, protecting RS485 communication lines from damage.
[0048] PTC resistors (such as PTC1 and PTC2) are placed in the power path of RS485 signal lines, primarily for overcurrent protection. PTC resistors have a low resistance during normal operation, but when the current exceeds a predetermined value, their resistance increases rapidly, thereby limiting the current and preventing excessive current from damaging the circuit. This self-healing characteristic makes PTC resistors very effective overcurrent protection components, protecting circuits from short circuits or overloads.
[0049] Impedance-matching resistors (such as R4) are connected in parallel at both ends of the RS485 differential signal line to ensure impedance matching during signal transmission. RS485 bus signal transmission requires impedance matching between the signal source, transmission line, and receiving end. Otherwise, signal reflection or attenuation may occur, affecting accurate data transmission. Impedance-matching resistors match the characteristic impedance of the transmission line, reducing signal reflections and maintaining stable signal transmission.
[0050] In addition, the design of the anti-interference RS485 communication circuit also takes into account reliability and cost-effectiveness. While ensuring system stability, stable and easy-to-integrate components were selected, and the overall circuit design was optimized to make it suitable for the actual needs of various industrial automation control systems.
[0051] In practice, the anti-interference circuit works in conjunction with an RS485 transceiver (such as the SN65HVD75DR) to achieve effective signal transmission and protection. The transceiver establishes a data connection between the MCU (microcontroller unit) and external devices. The anti-interference circuit ensures stable signal transmission in harsh environments, protecting the communication system from external electromagnetic interference, overcurrent, and transient voltage surges.
[0052] like Figure 4As shown, in this embodiment, the communication protocol adopts an optimized RS485 protocol frame structure, aiming to improve the efficiency and accuracy of data transmission, especially in industrial robot control systems, to ensure that the system can achieve efficient and reliable data interaction between multiple slave stations.
[0053] In this embodiment, the structure of the protocol frame mainly consists of the following parts: an identification field, a configuration field, a dynamic data segment, and a check field.
[0054] The identification field uniquely identifies the target slave. It occupies the upper four bits of the protocol frame at the beginning of the protocol frame. This field allows the master to accurately identify the slave with which it wishes to communicate. Each slave has a unique ID ranging from 0x0 to 0xF. Therefore, the system supports communication with up to 16 slaves. The identification field's simple yet efficient design allows for quick identification of the target device, reducing data transmission time.
[0055] The Configuration field occupies the lower four bits of the protocol frame. This field defines the type and length of the data segment, identified by the SW field. The SW value indicates how the segment is processed and the amount of data transmitted. For example, SW = 1 may indicate that the slave only supports 8-bit data input / output, while SW = 2 may indicate support for larger data sizes. The design of the Configuration field makes the protocol highly scalable, allowing for dynamic configuration based on different device requirements.
[0056] The length and content of the dynamic data segment are determined by the SW value in the configuration field. The data segment design provides the protocol with a high degree of flexibility, allowing it to transmit data of varying lengths and types based on actual needs. This flexible design allows the protocol to adapt to the data transmission needs of a wide range of devices and provide reliable support in diverse application scenarios.
[0057] The final portion of the protocol frame is the checksum field, which verifies the integrity of the frame's contents. In this embodiment, the checksum field occupies the last byte of the protocol frame. The checksum employs a sum check, which accumulates all bytes in the protocol frame and uses the lower 8 bits as the checksum. The design of the checksum field ensures that data has not been tampered with or lost during transmission, ensuring data integrity and transmission reliability.
[0058] During communication, the master and slave interact using this protocol frame. The master sends inquiry frames to the slave, which are used to obtain the slave's ID and SW information. Each time the master sends an inquiry frame, the slave responds with a response frame, returning its ID and SW information. After the inquiry process is complete, the master begins data transmission by sending data command frames to the slave. Each data command frame contains the target slave's ID, SW information, and the data to be transmitted. After receiving the master's data command frame, the slave returns a data response frame containing the slave's processing results or collected data.
[0059] The protocol frame is designed for simplicity and efficiency. The identification and configuration fields are combined into a single byte, making the protocol header compact and reducing transmission overhead. Furthermore, the flexible design of the dynamic data segment enables the protocol to adapt data transmission to the needs of different application scenarios, ensuring efficient and accurate data transmission.
[0060] The protocol also incorporates a retransmission mechanism to ensure timely recovery of data errors or lost data during communication. After sending a data frame, the master waits for a response from the slave. If no valid response is received, the retransmission mechanism is triggered, resending the data frame until the maximum number of retransmissions is reached or a valid response is received.
[0061] In this embodiment, the implementation of the communication protocol includes two main processes: an inquiry process and a data transmission process. The specific operation steps and data structure are as follows: When the host starts, it enters the inquiry process, sends inquiry instructions to each ID one by one, obtains the ID and SW information of each slave, and saves them.
[0062] After the query process is completed, the data transmission process begins, sending data to each slave one by one and receiving the return data from the slave one by one. After completing a round of data interaction with all slaves, the next round of data interaction begins immediately.
[0063] 1. ID and SW definition In this embodiment, the protocol uses a 4-bit ID and a 4-bit SW field, totaling 1 byte, to identify the slave and define the data type and transmission amount. The ID field uniquely identifies each slave and ranges from 0x0 to 0xF, supporting up to 16 slaves. The SW field defines the device's data transmission type and amount (SW cannot be 0). The specific meaning of SW can be adjusted based on the actual application scenario. For example, a SW value of 1 indicates that the device supports 8-bit data input and output. After obtaining the slave's SW value during the query process, the host can determine the number of bytes required for data exchange with the slave.
[0064] 2. Check digit definition This protocol uses a checksum to ensure data integrity. The checksum occupies one byte and is located at the end of the protocol frame. The checksum is performed by adding all bytes in the protocol frame and taking the lower 8 bits as the checksum. This method improves computational efficiency, significantly reducing computation time when verifying long frames. Furthermore, by using the lower 8 bits as the checksum, it optimizes data transmission and reduces communication delays and errors.
[0065] 3. Query frame definition and query process During the inquiry process, the host sends an inquiry command frame to each slave on the RS485 bus, and the slave returns an inquiry response frame, providing its ID and SW information.
[0066] The query command frame format is as follows: The inquiry command frame is 3 bytes in total; Byte1: b7-b4 (slave ID); b3-b0 (0000 frame header); Byte2: b7-b4 (slave ID); b3-b0 (0000 information, the same as Byte1); Byte3: CRC (checksum).
[0067] The query response frame format is as follows: The inquiry response frame consists of 3 bytes and has the following structure: Byte1: b7-b4 (slave ID); b3-b0 (0000, frame header); Byte2: b7-b4 (slave ID); b3-b0 (slave SW, information); Byte3: CRC (checksum).
[0068] In this embodiment, the lower 4 bits of the inquiry frame header are 0, which is a sign of the inquiry frame. As mentioned above, the slave SW cannot be 0 because SW 0 will conflict with the inquiry frame.
[0069] The inquiry process is as follows: During the query process, the host sends query command frames to each slave ID (0x0 to 0xF) on the RS485 bus. After each command frame, the host waits for a response from the slave. If the host does not receive a valid response, it resends the command frame. If no response is received after multiple retries, it assumes that there is no slave with that ID. If a valid response is received, the host extracts and saves the SW information from the response frame for subsequent data transmission.
[0070] When a slave receives a query command frame, it first verifies whether the upper 4 bits of the frame header match its own ID. If they do not match, the frame is discarded. If they do match, the slave further analyzes the lower 4 bits of the frame header. If the lower 4 bits are 0, it indicates that the frame is a query command frame, and the slave returns its ID and SW information in the format of a response frame.
[0071] 4. Data frame definition and data transmission process During data transmission, the host sends a data command frame to send data to the slave; the slave returns a data response frame to upload data to the host.
[0072] The data command frame format is as follows: Byte1: b7-b4 (slave ID); b3-b0 (slave SW, frame header); Byte2-Byte N : Data volume and data content are defined according to SW (information); Byte N+1 : CRC (checksum).
[0073] The data response frame format is as follows: Byte1: b7-b4 (slave ID); b3-b0 (slave SW, frame header); Byte2-Byte N : Data volume and data content are defined according to SW (information); Byte N+1 : CRC (checksum).
[0074] In this embodiment, the data command frame and data response frame have the same format, but the frame length can be different. The information portion of the frame can be determined based on the amount of data being sent and uploaded, and does not need to be the same length. If the host does not need to send data or the slave does not need to upload data, then this portion of the frame can be omitted. This design minimizes the length of the data frame. Except for the 1-byte frame header and 1-byte checksum, the rest is valid information, which minimizes data processing time and data transmission time, and minimizes transmission latency.
[0075] The data transmission process is as follows: During the query process, the host saves the ID and SW information of each slave. After entering the data transmission process, the host sends data command frames to each slave in turn. Each data command frame includes the ID and SW information of the target slave. The host determines the amount of data to be transmitted based on this SW information and packages the data along with a checksum. The host then waits for a data response frame from the slave. If no response is received or the received frame has a checksum error, the host resends the data command frame. If no valid response is received after multiple retransmissions, the host skips the slave and moves on to the next one.
[0076] After receiving a data command frame, the slave first parses the upper 4 bits of the frame header to verify whether the frame is a command frame sent to the slave. If so, it continues to parse the lower 4 bits of the frame header and, based on the SW information, determines whether the command meets the slave's processing capabilities. If so, it processes the data and returns it in the data response frame format. If not, it discards the frame content.
[0077] This embodiment provides a specific implementation logic of the master and slave devices: This implementation requires the use of a serial port and a timer built into the main control chip. The serial port is used for sending and receiving data, and is preferably the highest-performance serial port. The timer is used to determine whether the reception has timed out and whether the reception is complete. Any timer module can be selected. The timing time must be greater than the time required to transmit one byte of data, and a certain margin must be left. It needs to be reasonably set according to the baud rate.
[0078] Among them, the host is implemented as follows: 1. Initialize, enter the idle state, and turn off the serial port receiving and sending interrupts and timer interrupts.
[0079] 2. When starting a communication, package the content, enter the sending state, open the serial port send interrupt, and write the first byte of data to the serial port.
[0080] 3. In the sending state, after the serial port completes sending the 1-byte data, it automatically enters the serial port interrupt, writes the next 1-byte data to the serial port during the interrupt, and clears the serial port send interrupt flag.
[0081] 4. After sending the contents of the entire frame, close the serial port send interrupt, open the serial port receive interrupt and timer interrupt, and enter the ready-to-receive state.
[0082] 5. In the ready-to-receive state, if the serial port receives data, it will automatically enter the serial port interrupt, read the data in the interrupt, and enter the receiving state, while clearing the timer count value and the serial port receive interrupt flag; if the serial port has not received data, but the timer overflows and enters the timer interrupt, then the timeout count flag will be increased by 1 in the timer interrupt and the timer interrupt flag will be cleared; if the timer interrupt is entered multiple times, causing the timeout count flag to exceed the threshold (the threshold is recommended to be set to no less than 3), and the serial port has not received any data, it is considered that the reception has timed out, and the communication can be retransmitted or skipped directly.
[0083] 6. In the receiving state, if the serial port receives data, it will automatically enter the serial port interrupt, read the data in the interrupt, clear the timer count value, and clear the serial port receive interrupt flag to continue receiving the next byte; if the serial port has not received data, but the timer overflows and enters the timer interrupt, then it is considered that the frame reception is completed and enters the data processing state, and the serial port send and receive interrupt and timer interrupt are closed at the same time.
[0084] 7. In the data processing state, the received frame is parsed and the data is processed. After completion, it enters the idle state and prepares for the next communication.
[0085] The slave is implemented as follows: 1. Initialize and enter the idle state, only open the serial port's receive interrupt, and be ready to receive data at any time.
[0086] 2. In the idle state, if the serial port receives data, it will automatically enter the serial port interrupt. At this time, it is considered that the reception has started and enters the receiving state. The data is read out in the interrupt, the timer interrupt is enabled, the timer count value is cleared, and the serial port receive interrupt flag is cleared.
[0087] 3. In the receiving state, if the serial port receives data, it will automatically enter the serial port interrupt, read the data in the interrupt, clear the timer count value, and clear the serial port receive interrupt flag, and continue to receive the next byte; if the serial port has not received data, but the timer overflows and enters the timer interrupt, then it is considered that the frame reception is completed and enters the data processing state, and the serial port send and receive interrupt and timer interrupt are closed at the same time.
[0088] 4. In the data processing state, the received frame is parsed and the data is processed. After completion, it is determined whether the data needs to be returned to the host. If it does not need to be returned, it enters the idle state, enables the serial port receive interrupt, and prepares for the next reception. If it needs to be returned, it packages the content, enters the sending state, enables the serial port send interrupt, and writes the first byte of data to the serial port.
[0089] 5. In the sending state, after the serial port completes sending the 1-byte data, it automatically enters the serial port interrupt, writes the next 1-byte data to the serial port during the interrupt, and clears the serial port sending interrupt flag.
[0090] 6. After sending the contents of the entire frame, it enters the idle state and only opens the serial port's receive interrupt to prepare for the next reception.
[0091] In conjunction with the above-mentioned communication system, the present invention further provides an industrial robot anti-interference multi-slave station extended communication method, comprising the following steps: S1. After the master station is initialized, it enters the inquiry phase and sends inquiry frames to all slave stations to obtain the identification field and dynamic data segment of the valid slave station; The master station queries the ID and SW information of each slave station one by one by sending an inquiry command frame, obtains the identifier of each slave station and the supported data type and length information, and ensures the correctness of data interaction.
[0092] S2, the master station enters the data transmission phase and sends data frames to each slave station in a polling order. The frame header of the data frame contains the target slave station ID and SW. The SW dynamically defines the data segment type and length. During this phase, the master sends data command frames to the slaves in the polling order based on the slave information obtained during the query process. The frame header in the data command frame carries the ID and SW field of the target slave to ensure correct data transmission.
[0093] S3. After receiving the data frame, the slave station checks whether the frame header ID matches its own ID. If so, it parses the data segment according to the SW and performs peripheral control or data acquisition, and returns a response frame containing the response data. After receiving a data command frame, the slave first checks whether the ID field in the frame header matches its own ID. If so, the slave parses the data segment content based on the SW field, performs the corresponding peripheral control or data acquisition task, and generates a data response frame back to the master.
[0094] S4: After receiving the response frame, the master station extracts the data, uploads it to the robot controller via EtherCAT, and starts the next round of interaction. The master station extracts data from the received response frame and uploads the data to the robot controller via the EtherCAT protocol to ensure that the data is transmitted in place and trigger the next round of data interaction.
[0095] S5. If the master station does not receive a response frame or receives an invalid response frame within the preset time, the retransmission mechanism is triggered. The maximum number of retransmissions is configurable. The maximum number of retransmissions can be configured according to system requirements to ensure communication stability and reliability.
[0096] In this embodiment, the steps of the communication method are consistent with the specific implementation of the aforementioned communication protocol, so in the detailed description of steps S1 to S5, the specific protocol frame format and verification method are not repeated.
[0097] This method ensures that industrial robots can stably and efficiently perform anti-interference data transmission on multiple slave stations in complex environments, thus guaranteeing the real-time performance, reliability and integrity of data transmission of the system.
[0098] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.
Claims
1. Anti-interference multi-slave extended communication system for industrial robots, characterized by: include: The master module is used to interact with the robot controller via the EtherCAT protocol and parse object dictionary data; At least one slave module, connected to the master module via an RS485 bus, each slave module having a unique ID and connected to an external device for executing data acquisition or control instructions; An anti-interference RS485 communication circuit is integrated into the master module and the slave module, and includes a magnetic bead, a TVS tube, a PTC resistor, and an impedance matching resistor, and is used to suppress transient current, overcurrent, and pulse shock; The master station module and the slave station module interact with each other through a protocol frame, and the protocol frame includes: Identification field, used to uniquely identify the target slave; Configuration field, used to dynamically define the type and length of the data segment; Dynamic data segment, the length of which is determined by the value of the configuration field; The checksum field is generated based on the protocol frame content and is used to verify data integrity.
2. The industrial robot anti-interference multi-slave station extended communication system according to claim 1, characterized in that: The anti-interference RS485 communication circuit includes: Magnetic beads are placed on differential signal lines to suppress high-frequency electromagnetic interference; TVS tube, connected between the differential signal line pair and ground, used to absorb transient voltage; PTC resistors are placed in the power path of the differential signal line pair for overcurrent protection. Impedance matching resistors are connected in parallel at both ends of the differential signal line pair, and their resistance values are adapted to the signal transmission frequency.
3. The industrial robot anti-interference multi-slave station extended communication system according to claim 1, characterized in that: The identification field and configuration field of the protocol frame are combined into 1 byte, where: The identification field is the slave ID, which occupies the upper 4 bits and has a value range of 0x0 to 0xF; The configuration field is the configuration parameter SW, which occupies the lower 4 bits, defines the type and length of the dynamic data segment, and has a non-zero value.
4. The industrial robot anti-interference multi-slave station extended communication system according to claim 3, characterized in that: The check field is 1 byte and is generated by performing a cumulative operation on all bytes of the identification field, configuration field and dynamic data segment in the protocol frame and taking the lower 8 bits of the operation result.
5. The industrial robot anti-interference multi-slave station extended communication system according to claim 1, characterized in that: The master station module includes: A first parsing unit, configured to convert object dictionary data of the robot controller into RS485 protocol instructions; The first communication unit sends inquiry frames or data frames to each slave station in a polling order and receives response frames; Fault-tolerant unit, triggers retransmission mechanism when no response or invalid response is received from slave station, and the maximum number of retransmissions is configurable.
6. The industrial robot anti-interference multi-slave station extended communication system according to claim 1, characterized in that: The slave module includes: The second parsing unit is used to filter non-matching instructions according to the frame header ID and parse the data segment defined by the SW; The second communication unit performs peripheral control or data acquisition after receiving the master station command and returns a response frame; The collision avoidance unit discards protocol frames with mismatched IDs or SWs to prevent bus data collisions.
7. The industrial robot anti-interference multi-slave station extended communication system according to claim 3, characterized in that: The communication process between the master module and the slave module is divided into: Inquiry phase: The master station broadcasts an inquiry frame to obtain the slave station ID and SW, and the slave station returns a response frame containing its own ID and SW; Data transmission phase: The master sends data frames in a polling order, and the slave processes the data according to SW and returns a response frame.
8. The industrial robot anti-interference multi-slave station extended communication system according to claim 7, characterized in that: During the inquiry phase, the master station retries the identification field of the unanswered slave station multiple times, and marks the slave station as an invalid node if there is no response.
9. An anti-interference multi-slave extended communication method for an industrial robot, implemented based on the communication system according to any one of claims 1 to 8, characterized in that: The following steps are involved: S1. After the master station is initialized, it enters the inquiry phase and sends inquiry frames to all slave stations to obtain the identification field and dynamic data segment of the valid slave station; S2, the master station enters the data transmission phase and sends data frames to each slave station in a polling order. The frame header of the data frame contains the target slave station ID and SW. The SW dynamically defines the data segment type and length; S3. After receiving the data frame, the slave station checks whether the frame header ID matches its own ID. If so, it parses the data segment according to the SW and performs peripheral control or data acquisition, and returns a response frame containing the response data. S4: After receiving the response frame, the master station extracts the data, uploads it to the robot controller via EtherCAT, and starts the next round of interaction. S5. If the master station does not receive a response frame or receives an invalid response frame within the preset time, the retransmission mechanism is triggered. The maximum number of retransmissions is configurable.
Citation Information
Patent Citations
Multifunctional IO module for robot
CN106773854A
Remote IO module control system and method based on RS485 communication
CN117194302A