ModbusRTU protocol conversion module with invalid interrupt filtering function

By introducing a protocol conversion module with invalid interrupt filtering function into the ModbusRTU communication system, and using the communication chip U1 and microcontroller U2 to parse and filter data, the problem of excessive invalid interrupts in the slave unit CPU was solved, the operating efficiency of the slave unit equipment was improved and the transformation cost was reduced.

CN224987466UActive Publication Date: 2026-11-17FRAATON ELECTRIC (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202522725312.5
Authority / Receiving Office
CN · China
Patent Type
Utility models(China)
Current Assignee / Owner
Filing Date
2025-12-23
Publication Date
2026-11-17
Estimated Expiration
2035-12-23

AI Technical Summary

Technical Problem

In existing industrial Modbus RTU communication systems, the slave CPU suffers from excessive invalid interrupts, resulting in high processing resource consumption and a lack of dedicated interrupt optimization modules, leading to poor system compatibility during system upgrades.

Method used

Design a ModbusRTU protocol conversion module with invalid interrupt filtering function. It adopts communication chip U1 and microcontroller U2. By parsing bus data, it filters valid data to transmit to the slave main CPU and automatically replies to invalid requests, thereby reducing invalid interrupts.

Benefits of technology

It significantly reduces the number of CPU interrupts on the slave unit, improves operating efficiency, reduces hardware modification costs, has strong compatibility, is easy to integrate, and ensures communication stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN224987466U_ABST
    Figure CN224987466U_ABST
Patent Text Reader

Abstract

This utility model relates to the field of industrial communication technology and provides a ModbusRTU protocol conversion module with invalid interrupt filtering function. The module includes a communication chip U1, a microcontroller U2, and peripheral circuitry. It is configured with an RS485 bus-side interface for accessing the RS485 bus and a microcontroller-side interface for communication with the slave CPU. The differential signal pins of the communication chip U1 are electrically connected to the differential signal terminals of the RS485 bus-side interface, and the data transceiver pins of the communication chip U1 are electrically connected to the first serial port pin of the microcontroller U2. The second serial port pin of the microcontroller U2 is electrically connected to the data transceiver terminal of the microcontroller-side interface, and the power supply pins of the microcontroller U2 are electrically connected to the power supply and ground terminals of the microcontroller-side interface. This utility model solves the problems of excessive invalid interrupts in the slave CPU, lack of a dedicated interrupt optimization module, and poor system modification compatibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This utility model belongs to the field of industrial communication technology, and in particular relates to a ModbusRTU protocol conversion module with invalid interrupt filtering function. Background Technology

[0002] In the field of industrial communication technology, the Modbus RTU protocol is widely used in industrial communication scenarios with multiple devices in a network due to its simple structure and reliable communication. Existing industrial Modbus RTU communication systems generally adopt an RS485 bus architecture. In this architecture, multiple slave devices (up to 247) establish connections with the host through the RS485 bus. The slave host CPU is directly connected to the RS485 bus and undertakes the task of receiving and processing bus data frames. That is, when the host initiates a data read operation, the slave host CPU needs to receive all the data on the bus and process it. When the slave replies with information, it also needs to be transmitted through the bus and received by other slave host CPUs.

[0003] However, existing technologies have the following drawbacks: Too many invalid interrupts on the slave CPU: When the master initiates a data read, all slaves on the bus will be interrupted; during the slave's reply information transmission, other slaves will also be interrupted; a large number of invalid interrupts continuously occupy the processing resources of the slave CPU, resulting in a significant reduction in the execution efficiency of the slave's main tasks (such as core tasks such as device control and data acquisition); Lack of dedicated interrupt optimization module: The existing communication solution does not have a dedicated processing module designed for the above-mentioned interrupt redundancy problem. It is impossible to reduce the ModbusRTU protocol processing burden of the slave CPU while ensuring normal communication between the host and slave. It is difficult to balance communication stability and slave operating efficiency. Poor system modification compatibility: If it is necessary to reduce invalid interrupts of the slave CPU, large-scale modifications to the existing slave hardware structure or software logic are required. This will not only increase the modification cost and extend the modification cycle, but may also damage the communication compatibility of the original system, leading to a decrease in the overall stability of the system. Therefore, a ModbusRTU protocol conversion module with invalid interrupt filtering function is needed to solve the above problems. Utility Model Content

[0004] The purpose of this utility model embodiment is to provide a ModbusRTU protocol conversion module with invalid interrupt filtering function to solve the problems mentioned in the background art.

[0005] To achieve the above objectives, this utility model provides the following technical solution: A ModbusRTU protocol conversion module with invalid interrupt filtering function includes a protocol conversion module. The protocol conversion module is equipped with a communication chip U1, a microcontroller U2 and peripheral circuits. The protocol conversion module is configured with an RS485 bus-side interface for accessing the RS485 bus and a main microcontroller-side interface for communicating with the slave CPU. The differential signal pins of the communication chip U1 are electrically connected to the differential signal terminals of the RS485 bus side interface, and the data transceiver pins of the communication chip U1 are electrically connected to the first serial port pin of the microcontroller U2. The second serial port pin of the microcontroller U2 is electrically connected to the data transceiver terminal of the main microcontroller side interface, and the power supply pin of the microcontroller U2 is electrically connected to the power supply terminal and ground terminal of the main microcontroller side interface. The peripheral circuit is electrically connected to the communication chip U1 and the microcontroller U2, respectively. The microcontroller U2 can parse and filter bus data, forward valid data to the slave CPU through the main microcontroller interface, and automatically respond to invalid requests according to the ModbusRTU protocol.

[0006] In a further technical solution, the RS485 bus-side interface includes a GND terminal, a first differential signal terminal, and a second differential signal terminal, wherein the first differential signal terminal and the second differential signal terminal are electrically connected to the differential signal pins of the communication chip U1 in a one-to-one correspondence.

[0007] In a further technical solution, the main microcontroller-side interface includes a VCC terminal, a GND terminal, a receiving terminal, and a transmitting terminal. The receiving terminal and the transmitting terminal are electrically connected to the second serial port pins of the microcontroller U2 in a one-to-one correspondence, and the VCC terminal and the GND terminal are electrically connected to the power supply pins of the microcontroller U2 in a one-to-one correspondence.

[0008] In a further technical solution, the communication chip U1 is an RS485 communication chip, and its transmit pin and receive pin are electrically connected to the transmit pin and receive pin of the first serial port of the microcontroller U2, respectively. The ground pin of the communication chip U1 is electrically connected to the GND terminal of the RS485 bus side interface.

[0009] In a further technical solution, the receiving pin of the second serial port of the microcontroller U2 is electrically connected to the transmitting end of the main microcontroller side interface, and the transmitting pin of the second serial port of the microcontroller U2 is electrically connected to the receiving end of the main microcontroller side interface, thereby realizing bidirectional data transmission.

[0010] In a further technical solution, the peripheral circuit includes a power filter circuit and a reset circuit. The power filter circuit is electrically connected to the power pins of the communication chip U1 and the microcontroller U2, respectively, and the reset circuit is electrically connected to the reset pin of the microcontroller U2.

[0011] In a further technical solution, the microcontroller U2 can parse the address field, function code, check code, and communication format of the bus data frame. When the address field matches and the check code and communication format are normal, the data frame is forwarded to the slave main CPU. When the function code is invalid, the address does not match and is not a broadcast address or the check is incorrect, an abnormal response frame is automatically constructed and sent.

[0012] A further technical solution is address field matching, which means that the address field of the data frame is consistent with the pre-configured slave address of the microcontroller U2, or the address field is a broadcast address.

[0013] Compared with the prior art, the beneficial effects of this utility model are: This invention solves the problem of excessive invalid interrupts from the slave CPU: through the parsing and filtering function of the microcontroller U2, only valid data with matching address fields (consistent with the pre-configured slave address or a broadcast address), correct checksum, and normal communication format is forwarded to the slave main CPU and triggers an interrupt; for invalid requests with invalid function codes, mismatched addresses and not broadcast addresses, or checksum errors, the microcontroller U2 directly and automatically responds to the exception according to the Modbus RTU protocol, without the slave main CPU needing to participate in the processing; this structural design significantly reduces the number of interrupts generated by the slave CPU due to invalid bus data, freeing up a large amount of CPU computing resources, allowing the slave main CPU to focus on core main tasks such as device control and data acquisition, and significantly improving the operating efficiency of the slave device; This invention addresses the lack of a dedicated interrupt optimization module: It integrates a communication chip U1, a microcontroller U2, and peripheral circuits through a protocol conversion module, forming a dedicated optimization module for interrupt redundancy. The communication chip U1 uses the mature SP3485 chip, and the microcontroller U2 uses the general-purpose STC32G8K48 microcontroller. Both have low hardware costs, and the peripheral circuits only include power filtering and reset circuits, resulting in a simple structure that is easy to mass-produce. The module can directly replace the existing system's mode where the slave unit's main CPU directly connects to the bus, without requiring significant modifications to the existing slave unit hardware, thus reducing the burden on the slave unit's CPU while ensuring normal communication. This invention solves the problem of poor compatibility in system upgrades: the protocol conversion module is fully compatible with the standard Modbus RTU protocol, and the microcontroller U2 supports flexible configuration of communication parameters such as slave address, baud rate, and parity method through the program programming interface, which can match the bus communication needs of different industrial scenarios; both the RS485 bus-side interface and the main microcontroller-side interface adopt a standardized design, which can quickly connect to the existing industrial Modbus RTU communication system without large-scale modification of the existing system's hardware structure and software logic, and has strong compatibility and high ease of use.

[0014] To more clearly illustrate the structural features and effects of this utility model, the following detailed description of this utility model is provided in conjunction with the accompanying drawings and specific embodiments. Attached Figure Description

[0015] Figure 1 This is a block diagram of the module of this utility model; Figure 2 This is a schematic diagram of the principle of this utility model; Figure 3 This is a schematic diagram of the packaging appearance of this utility model.

[0016] In the diagram: 1. Protocol conversion module; 2. RS485 bus side interface; 3. Main microcontroller side interface; 4. Peripheral circuit. Detailed Implementation

[0017] To make the objectives, technical solutions, and advantages of this utility model clearer, the present utility model will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present utility model and are not intended to limit the present utility model.

[0018] The specific implementation of this utility model will be described in detail below with reference to specific embodiments.

[0019] like Figure 1-3 As shown, this utility model embodiment provides a ModbusRTU protocol conversion module with invalid interrupt filtering function, including a protocol conversion module 1. The protocol conversion module 1 is provided with a communication chip U1, a microcontroller U2 and peripheral circuits 4. The protocol conversion module 1 is configured with an RS485 bus side interface 2 for accessing the RS485 bus and a main microcontroller side interface 3 for communicating with the slave CPU. The differential signal pins of the communication chip U1 are electrically connected to the differential signal terminals of the RS485 bus-side interface 2, and the data transceiver pins of the communication chip U1 are electrically connected to the first serial port pin of the microcontroller U2. Specifically, the positive terminal (first differential signal terminal) of the communication chip U1 is directly connected to the RS485-A terminal of the RS485 bus-side interface 2, and the negative terminal (second differential signal terminal) is directly connected to the RS485-B terminal of the RS485 bus-side interface 2. A matching resistor is connected in parallel between the positive and negative terminals of the communication chip U1 to eliminate signal reflection in RS485 bus transmission and improve the stability of long-distance communication. The positive and negative terminals of the differential signal of the communication chip U1 are also grounded through electrostatic protection components to suppress electrostatic or surge interference on the bus side and protect the communication chip U1. The data transmission terminal of the communication chip U1... The pins are connected to the first serial port transmit pin of microcontroller U2, and the data receive pin is connected to the first serial port receive pin of microcontroller U2. After the transmit enable pin and receive enable pin of communication chip U1 are shorted, they are connected to the general-purpose I / O pin of microcontroller U2 through pull-up resistors. Microcontroller U2 controls communication chip U1 to switch between "receive mode" and "transmit mode". The power supply pin of communication chip U1 is connected to the adapter power supply, and the ground pin is directly connected to the GND terminal of RS485 bus side interface 2. A power supply filter capacitor is connected in parallel between the power supply pin and the ground pin to filter out high-frequency noise at the power supply terminal of communication chip U1.

[0020] The second serial port pin of the microcontroller U2 is electrically connected to the data transceiver terminal of the main microcontroller side interface 3, and the power supply pin of the microcontroller U2 is electrically connected to the power supply terminal and ground terminal of the main microcontroller side interface 3. Specifically, the second serial port receiver pin of microcontroller U2 is connected to the transmitter pin of the main microcontroller side interface 3 (the transmitter pin of the slave CPU), and the second serial port transmitter pin of microcontroller U2 is connected to the receiver pin of the main microcontroller side interface 3 (the receiver pin of the slave CPU), realizing bidirectional serial communication with the slave CPU. The power supply pin of microcontroller U2 is connected to the power supply terminal of the main microcontroller side interface 3. A low-frequency power supply filter capacitor and a high-frequency power supply filter capacitor are connected in parallel between the power supply pin and the ground pin to provide stable power supply for microcontroller U2. The ground pin of microcontroller U2 is directly connected to the GND terminal of the main microcontroller side interface 3 to ensure that it shares a common ground with the slave CPU and avoid signal interference. In addition, the program burning interface pin of microcontroller U2 is connected to the power supply or ground through pull-up resistors, filter capacitors, and pull-down resistors, respectively, for pre-configuring slave address and communication parameters (baud rate, parity method, etc.).

[0021] The peripheral circuit 4 is electrically connected to the communication chip U1 and the microcontroller U2, respectively. Peripheral circuit 4 includes a power supply filter circuit and a reset circuit, with the specific connections as follows: Power filtering circuit: In addition to the power filtering capacitors of the communication chip U1 and the microcontroller U2, the main power input terminal of the protocol conversion module 1 (introduced from the power terminal of the main microcontroller side interface 3) is also connected in series with an overcurrent protection component to prevent the module from being damaged by power overcurrent; a global power filtering capacitor is connected in parallel between the main power terminal and ground to further filter out low-frequency interference from the global power supply. Reset Circuit: The reset pin of microcontroller U2 is connected to its own power supply pin through a pull-up resistor and to ground through a reset capacitor, forming a power-on reset circuit. The reset pin is also connected to ground through a manual reset button, forming a manual reset circuit. When the module malfunctions, pressing the manual reset button can trigger the microcontroller U2 to reset and restore normal operation. The pull-up resistor and reset capacitor parameters of the reset circuit are matched to ensure that the duration of the reset signal meets the reset requirements of microcontroller U2 when powered on.

[0022] The microcontroller U2 can parse and filter bus data, forward valid data to the slave CPU through the main microcontroller interface 3, and automatically reply with an abnormal response to invalid requests according to the Modbus RTU protocol.

[0023] In this embodiment, both the communication chip U1 and the microcontroller U2 are mature components, which can reduce hardware costs; the integrated design of the protocol conversion module 1 realizes centralized processing of bus data, avoids the slave main CPU directly participating in bus data filtering, and provides a hardware foundation for invalid interrupt filtering; the communication chip U1 ensures stable transmission and reception of bus data, the microcontroller U2 undertakes the core functions of data parsing and filtering, and the peripheral circuit 4 ensures long-term stable operation of the module. The overall structure is simple and easy to integrate, providing hardware support for the implementation of subsequent functions.

[0024] Specifically, the RS485 bus-side interface 2 includes a GND terminal, a first differential signal terminal (RS485-A), and a second differential signal terminal (RS485-B). The first differential signal terminal and the second differential signal terminal are electrically connected to the differential signal pins of the communication chip U1 in a one-to-one correspondence (i.e., RS485-A is connected to the positive differential signal terminal of the communication chip U1, and RS485-B is connected to the negative differential signal terminal of the communication chip U1). Furthermore, the GND terminal of the interface (2) shares the same ground with the ground pin of the communication chip U1 and the ground pin of the microcontroller U2 to ensure that the signal reference potential is consistent.

[0025] In this embodiment, the interface design fully complies with the RS485 bus communication specifications. The differential signal end improves the anti-interference capability of bus data through differential transmission, adapting to complex industrial electromagnetic environments. The GND end provides a stable reference potential for the bus signal, avoiding communication errors caused by signal drift, ensuring a reliable connection between the module and the RS485 bus, and guaranteeing data transmission stability.

[0026] Specifically, the main microcontroller side interface 3 includes a VCC terminal, a GND terminal, a receiving terminal (RX), and a transmitting terminal (TX). The receiving terminal and the transmitting terminal are electrically connected to the second serial port pin of the microcontroller U2 in a one-to-one correspondence (i.e., interface (3) TX is connected to the receiving terminal of the second serial port of the microcontroller U2, and interface (3) RX is connected to the transmitting terminal of the second serial port of the microcontroller U2). The VCC terminal and the GND terminal are electrically connected to the power supply pin of the microcontroller U2 in a one-to-one correspondence (i.e., interface (3) VCC is connected to the power supply terminal of the microcontroller U2, and interface (3) GND is connected to the grounding pin of the microcontroller U2). Furthermore, the VCC terminal of interface (3) is connected in series with a reverse connection protection diode to prevent the main CPU power supply of the slave machine from being reversed and damaging the module.

[0027] In this embodiment, the interface adopts a standard serial communication form. The VCC terminal provides working power to the microcontroller U2, and the GND terminal ensures the common ground stability of power and signal. The receiving end and the transmitting end form a bidirectional data transmission link between the module and the slave main CPU. There is no need to design an additional dedicated communication interface, which simplifies the connection between the module and the slave main CPU, reduces the integration difficulty, and improves the ease of use of the module.

[0028] Specifically, the communication chip U1 is an RS485 communication chip. Its transmit and receive pins are electrically connected to the transmit and receive pins of the first serial port of the microcontroller U2, respectively. The ground pin of the communication chip U1 is electrically connected to the GND terminal of the RS485 bus side interface 2. The transmit enable / receive enable pins of the communication chip U1 (after being shorted) are connected to the general-purpose I / O pins of the microcontroller U2 through pull-up resistors. The microcontroller U2 controls the transmission by outputting high and low levels through the general-purpose I / O pins: when the general-purpose I / O pin is high, the communication chip U1 enters the transmit mode and can send an exception response frame to the RS485 bus; when the general-purpose I / O pin is low, the communication chip U1 enters the receive mode and can monitor the bus data.

[0029] In this embodiment, the RS485 communication chip has strong bus driving capability, which can adapt to the long-distance, multi-node communication needs in industrial scenarios; it is directly connected to the serial port of the microcontroller U2 to realize the conversion between bus data and signals that the microcontroller U2 can process, ensuring the transparency and real-time performance of data transmission and improving the adaptability of the module in industrial environments.

[0030] Specifically, the receiving pin of the second serial port of the microcontroller U2 is electrically connected to the transmitting end of the main microcontroller side interface 3, the transmitting pin of the second serial port of the microcontroller U2 is electrically connected to the receiving end of the main microcontroller side interface 3, and the receiving pin of the second serial port is connected to the power supply through a pull-up resistor, and the transmitting pin of the second serial port is connected to the receiving end of the interface (3) through a current limiting resistor. The pull-up resistor is used to improve the anti-interference capability of the receiving pin, and the current limiting resistor is used to limit the serial communication current, avoid damage to the serial port pin of the slave main CPU due to overcurrent, and realize bidirectional data transmission.

[0031] In this embodiment, the full-duplex communication link constructed by this connection method can forward the filtered valid data (such as the host's instructions to the slave) to the slave's main CPU, and can also receive the slave's main CPU's response data and feed it back to the RS485 bus through the communication chip U1. This satisfies the bidirectional interaction requirements between the host and slave in the ModbusRTU protocol, ensures the integrity of the communication process, and ensures the comprehensiveness of the communication function.

[0032] Specifically, the peripheral circuit 4 includes a power filtering circuit and a reset circuit. In the power filtering circuit: the power filtering capacitor of the communication chip U1 is connected in parallel between the power supply terminal of the communication chip U1 and ground; the low-frequency and high-frequency power filtering capacitors of the microcontroller U2 are connected in parallel between the power supply terminal of the microcontroller U2 and ground; the global power filtering capacitor is connected in parallel between the module's total power supply terminal and ground; and the overcurrent protection element is connected in series at the total power input terminal, together forming a multi-stage power filtering and overcurrent protection. In the reset circuit: one end of the pull-up resistor is connected to the power supply terminal of the microcontroller U2, and the other end is connected to the reset pin; one end of the reset capacitor is connected to the reset pin, and the other end is connected to ground; and one end of the manual reset button is connected to the reset pin, and the other end is connected to ground, forming a reset mechanism that combines power-on reset and manual reset. The power filtering circuit is electrically connected to the power supply pins of the communication chip U1 and the microcontroller U2, respectively, and the reset circuit is electrically connected to the reset pin of the microcontroller U2.

[0033] In this embodiment, the power filtering circuit can filter out noise signals in the power supply (such as high-frequency interference in the industrial power grid), providing a stable and clean power supply environment for the communication chip U1 and the microcontroller U2, and avoiding abnormal chip operation caused by power fluctuations; the reset circuit can automatically trigger the microcontroller U2 to reset when the module experiences abnormalities such as program crashes due to interference, so as to restore it to normal working state, improve the module's working stability and anti-interference ability, and extend its service life.

[0034] Specifically, the microcontroller U2 can parse the address field, function code, check code, and communication format of the bus data frame. When the address field matches and the check code and communication format are normal, the data frame is forwarded to the slave main CPU. When the function code is invalid, the address does not match and is not a broadcast address or the check is incorrect, an abnormal response frame is automatically constructed and sent.

[0035] In this embodiment, the check code uses CRC check, and the communication format supports conventional industrial communication parameters and can be flexibly configured. The microcontroller U2 implements the above data processing logic through the program, accurately filters valid data, avoids invalid data from triggering the slave main CPU interrupt, and automatically replies to abnormal responses (such as function code not supported, error frames corresponding to check errors) according to the ModbusRTU protocol, ensuring the standardization of bus communication, realizing the core function of invalid interrupt filtering, and improving the operating efficiency of the slave main CPU.

[0036] Specifically, address field matching means that the address field of the data frame is consistent with the pre-configured slave address of the microcontroller U2, or the address field is a broadcast address.

[0037] In this embodiment, the definition of the address determination criteria for valid data ensures that the slave device can accurately receive instruction data for itself (the address field is consistent with the pre-configured slave device address) and respond to the host's broadcast instructions (the address field is the broadcast address). At the same time, it eliminates interference from address data unrelated to the slave device, ensuring the accuracy of data filtering and taking into account both the specificity and universality of communication.

[0038] Working principle and usage process of this utility model: Power-on configuration and initialization: The protocol conversion module 1 is connected to the industrial RS485 bus via the RS485 bus side interface 2, and a connection is established with the slave main CPU via the main microcontroller side interface 3; after the slave main CPU is powered on, it writes pre-configuration parameters to the microcontroller U2 via the main microcontroller side interface 3, including the slave address and ModbusRTU communication parameters; after receiving the configuration parameters, the microcontroller U2 completes the data buffer initialization and enables the first serial port interrupt to prepare for listening to bus data; the power filter circuit in the peripheral circuit 4 starts working to provide stable power supply to the communication chip U1 and the microcontroller U2, and the reset circuit enters standby state to deal with module abnormalities; Bus data monitoring: Microcontroller U2 sends a control signal to communication chip U1 through the first serial port, causing communication chip U1 to enter receive mode and continuously monitor the data stream on the RS485 bus; when there is data transmission on the bus, communication chip U1 converts the differential signal on the bus into a single-ended signal that microcontroller U2 can process, and transmits it to the first serial port receive pin of microcontroller U2 through the data transceiver pin. Microcontroller U2 temporarily stores the received continuous data in the internal buffer area; Data parsing and validity assessment: Microcontroller U2 parses the data frames in the buffer according to the Modbus RTU protocol format (start bit, address field, function code, data field, check bit, stop bit), extracting the address field, function code, data field, and CRC checksum in sequence, and verifying whether the communication format is consistent with the pre-configured parameters; first, it checks whether the data format is normal. If the data format is abnormal, microcontroller U2 directly constructs a fault code and sends it to the RS485 bus through communication chip U1; if the data format is normal, it further checks whether the address field is consistent with the pre-configured slave address or is a broadcast address, and simultaneously verifies the validity of the CRC checksum. Valid data forwarding and invalid request handling: If the address field matches and the CRC check is correct, the microcontroller U2 determines that the data frame is valid data. It forwards the complete data frame to the slave CPU via the second serial port through the main microcontroller side interface 3, triggering a valid interrupt of the slave CPU. After processing the valid data, the slave CPU generates response data and feeds it back to the microcontroller U2 through the main microcontroller side interface 3. The microcontroller U2 sends the response data to the RS485 bus through the communication chip U1, completing one master-slave communication interaction. If the address field does not match and is not a broadcast address, the function code is invalid, or the CRC check is incorrect, the microcontroller U2 determines that the request is invalid. It does not need to forward data to the slave CPU. Instead, it directly constructs the corresponding abnormal response frame according to the ModbusRTU protocol and sends it to the RS485 bus through the communication chip U1, completing the automatic handling of the invalid request. The entire process does not trigger an interrupt of the slave CPU.

[0039] The above description is only a preferred embodiment of the present utility model and is not intended to limit the present utility model. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present utility model should be included within the protection scope of the present utility model.

Claims

1. A ModbusRTU protocol conversion module with invalid interrupt filtering function, comprising a protocol conversion module (1), characterized in that: The protocol conversion module (1) is equipped with a communication chip U1, a microcontroller U2 and peripheral circuits (4). The protocol conversion module (1) is configured with an RS485 bus side interface (2) for accessing the RS485 bus and a main microcontroller side interface (3) for communicating with the main CPU of the slave machine. The differential signal pins of the communication chip U1 are electrically connected to the differential signal terminals of the RS485 bus side interface (2), and the data transceiver pins of the communication chip U1 are electrically connected to the first serial port pins of the microcontroller U2. The second serial port pin of the microcontroller U2 is electrically connected to the data transceiver terminal of the main microcontroller side interface (3), and the power supply pin of the microcontroller U2 is electrically connected to the power supply terminal and ground terminal of the main microcontroller side interface (3). The peripheral circuit (4) is electrically connected to the communication chip U1 and the microcontroller U2 respectively; The microcontroller U2 can parse and filter bus data, forward valid data to the slave CPU through the main microcontroller side interface (3), and automatically reply with an abnormal response to invalid requests according to the ModbusRTU protocol.

2. The ModbusRTU protocol conversion module with invalid interrupt filtering function according to claim 1, characterized in that: The RS485 bus-side interface (2) includes a GND terminal, a first differential signal terminal, and a second differential signal terminal. The first differential signal terminal and the second differential signal terminal are electrically connected to the differential signal pins of the communication chip U1 in a one-to-one correspondence.

3. The ModbusRTU protocol conversion module with invalid interrupt filtering function according to claim 1, characterized in that: The main microcontroller side interface (3) includes a VCC terminal, a GND terminal, a receiving terminal, and a transmitting terminal. The receiving terminal and the transmitting terminal are electrically connected to the second serial port pin of the microcontroller U2 in a one-to-one correspondence. The VCC terminal and the GND terminal are electrically connected to the power supply pin of the microcontroller U2 in a one-to-one correspondence.

4. The ModbusRTU protocol conversion module with invalid interrupt filtering function according to claim 1, characterized in that: The communication chip U1 is an RS485 communication chip. Its transmitting and receiving pins are electrically connected to the transmitting and receiving pins of the first serial port of the microcontroller U2, respectively. The ground pin of the communication chip U1 is electrically connected to the GND terminal of the RS485 bus side interface (2).

5. The ModbusRTU protocol conversion module with invalid interrupt filtering function according to claim 1, characterized in that: The receiving pin of the second serial port of the microcontroller U2 is electrically connected to the transmitting end of the main microcontroller side interface (3), and the transmitting pin of the second serial port of the microcontroller U2 is electrically connected to the receiving end of the main microcontroller side interface (3) to realize bidirectional data transmission.

6. The ModbusRTU protocol conversion module with invalid interrupt filtering function according to claim 1, characterized in that: The peripheral circuit (4) includes a power filter circuit and a reset circuit. The power filter circuit is electrically connected to the power pins of the communication chip U1 and the microcontroller U2, respectively, and the reset circuit is electrically connected to the reset pin of the microcontroller U2.

7. The ModbusRTU protocol conversion module with invalid interrupt filtering function according to claim 1, characterized in that: The microcontroller U2 can parse the address field, function code, check code, and communication format of the bus data frame. When the address field matches and the check code and communication format are normal, the data frame is forwarded to the slave main CPU. When the function code is invalid, the address does not match and is not a broadcast address or the check is incorrect, an abnormal response frame is automatically constructed and sent.

8. The ModbusRTU protocol conversion module with invalid interrupt filtering function according to claim 1, characterized in that: Address field matching refers to the data frame address field being consistent with the pre-configured slave address of the microcontroller U2, or the address field being a broadcast address.