Protocol adaptive identification method and IO data acquisition device

By embedding Profibus and Modbus protocol stacks in the IO data acquisition device, the system can monitor and match protocol characteristics in real time, automatically identify protocol status, solve communication failures caused by manual configuration errors, and improve the reliability and availability of the system.

CN121814870APending Publication Date: 2026-04-07ZHANJIANG ZHONGYUE ENERGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-23
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

In existing technologies, when selecting the Profibus or Modbus protocol, the IO data acquisition device in an industrial automation control system needs to be manually configured correctly. Incorrect settings can lead to communication failures, increasing the difficulty and risk of debugging and maintenance.

Method used

The protocol adaptive identification method is adopted. By using the built-in Profibus and Modbus protocol stacks, the communication bus data frames are monitored in real time, the protocol features are extracted and matched with the pre-stored feature library, the protocol status is automatically identified, the target protocol stack is activated, and communication failures caused by manual configuration errors are reduced.

Benefits of technology

It improves system reliability and availability, reduces communication failures caused by human configuration errors, simplifies installation and maintenance processes, lowers the technical threshold, and increases equipment reuse rate and overall system reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121814870A_ABST
    Figure CN121814870A_ABST
Patent Text Reader

Abstract

The invention discloses a protocol adaptive identification method and an IO data acquisition device.The protocol adaptive identification method is applied to the IO data acquisition device, the IO data acquisition device comprises an RS-485 interface, a Profibus protocol stack and a Modbus protocol stack are arranged in the IO data acquisition device, and the protocol adaptive identification method comprises the steps that when the RS-485 interface is kept in a receiving enabling state, the Profibus protocol stack and the Modbus protocol stack are connected with the RS-485 interface; the method comprises the following steps: monitoring a data frame on a communication bus in real time to obtain an original data stream, analyzing the original data stream to extract protocol features, performing protocol matching on the protocol features and a pre-stored Profibus feature library and Modbus feature library to confirm a protocol state, and activating a target protocol stack according to the protocol state to enter a protocol response state, the target protocol stack comprises a Profibus protocol stack and a Modbus protocol stack. According to the method, the risk of communication faults caused by manual configuration errors can be reduced, and the overall reliability and availability of the system are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of industrial automation communication, and in particular to a protocol adaptive identification method and an IO data acquisition device. Background Technology

[0002] In industrial automation control systems, remote I / O data acquisition devices serve as crucial hubs connecting field sensors and actuators with upper-level control master stations (such as PLCs and DCS), making the compatibility of their communication protocols paramount. Currently, several fieldbus protocols coexist in the market, with PROFIBUS-DP and Modbus (RTU / TCP) being the two most widely used. Some scenarios use the Modbus protocol for data transmission, while others use the PROFIBUS protocol. Both protocols use RS485 level data transmission at the hardware physical layer. However, due to the relative complexity and high transmission rate of the PROFIBUS protocol, a dedicated PROFIBUS protocol chip is often required for bridging.

[0003] Currently, the PROFIBUS or Modbus protocol can be manually selected via hardware DIP switches or software configuration tools. However, users must be familiar with the master station protocol and complete the correct settings before powering on the device. Incorrect settings or changes to the master station protocol will prevent the device from communicating, causing system downtime and increasing the difficulty and risk of debugging and maintenance. Summary of the Invention

[0004] This invention aims to address at least one of the technical problems existing in the prior art. To this end, this invention proposes a protocol adaptive identification method, which can reduce the risk of communication failures caused by human configuration errors and improve the overall reliability and availability of the system.

[0005] The present invention also proposes an IO data acquisition device.

[0006] The present invention also proposes a control device for an IO data acquisition device.

[0007] The present invention also proposes a computer-readable storage medium.

[0008] In a first aspect, one embodiment of the present invention provides a protocol adaptive identification method applied to an IO data acquisition device, the IO data acquisition device including an RS-485 interface and a built-in Profibus protocol stack and Modbus protocol stack, the protocol adaptive identification method including:

[0009] While the RS-485 interface remains in the receive enabled state, the data frames on the communication bus are monitored in real time to obtain the raw data stream.

[0010] The raw data stream is parsed to extract protocol features;

[0011] The protocol features are matched with the pre-stored Profibus and Modbus feature libraries to confirm the protocol status.

[0012] The target protocol stack is activated according to the protocol state to enter the protocol response state; wherein, the target protocol stack includes: the Profibus protocol stack and the Modbus protocol stack.

[0013] The protocol adaptive identification method of this invention has at least the following beneficial effects: After the IO data acquisition device is powered on, it is initially in a protocol listening state. The RS-485 interface remains in a receive-enabled state, continuously listening to data frames on the communication bus to obtain the raw data stream, and does not actively send any data that may interfere with the network. The captured raw data stream is parsed to extract protocol features such as frame start and end features, frame structure features, address field features, and specific function codes / services. The extracted protocol features are matched with the Profibus feature library and Modbus feature library pre-stored in the IO data acquisition device. After the protocol features match the Profibus feature library or Modbus feature library, the protocol status is confirmed. The IO data acquisition device can automatically identify whether the protocol frame sent by the connecting master station is a Profibus protocol or a Modbus protocol. The decision engine confirms the target protocol to switch according to the protocol status, activates the target protocol stack corresponding to the target protocol, and then puts the other protocol stack into a sleep or low-priority background state. The IO data acquisition device then enters the protocol response state, which can reduce the risk of communication failure due to manual configuration errors and improve the overall reliability and availability of the system.

[0014] According to other embodiments of the protocol adaptive identification method of the present invention, the step of matching the protocol features with a pre-stored PROFIBUS feature library and a Modbus feature library to confirm the protocol status includes:

[0015] The protocol features are matched with the Profibus feature library and the Modbus feature library according to a preset weighted scoring method to obtain the protocol status;

[0016] Alternatively, the protocol features can be matched with the Profibus feature library and the Modbus feature library using a preset finite state machine method to obtain the protocol state.

[0017] According to other embodiments of the protocol adaptive identification method of the present invention, the protocol state includes a Profibus protocol state and a Modbus protocol state. The step of performing protocol matching between the protocol features and the Profibus feature library and the Modbus feature library based on a preset weighted scoring method to obtain the protocol state includes:

[0018] When a target start frame is detected, the Profibus protocol score is added, and if the Profibus protocol score is greater than a preset threshold within a first preset time, the Profibus protocol status is obtained.

[0019] When a complete frame that meets the cyclic redundancy check is detected, the Modbus protocol score is increased, and if the Modbus protocol score is greater than a preset threshold within the first preset time period, the Modbus protocol status is obtained.

[0020] According to other embodiments of the protocol adaptive identification method of the present invention, the step of performing protocol matching between the protocol features and the Profibus feature library and the Modbus feature library according to a preset finite state machine method to obtain the protocol state includes:

[0021] Construct a finite state machine; wherein the finite state machine is used to perform state transitions on the received byte sequence;

[0022] When the byte sequence received by the finite state machine includes the target start frame, the finite state machine switches to the suspected Profibus protocol state, and after the byte sequence conforms to the sequence length and sequence format of the Profibus protocol, the finite state machine switches to the Profibus protocol state.

[0023] If the communication bus receives an address byte conforming to the Modbus protocol after a preset silent time, it switches to a suspected Modbus state through the finite state machine, and switches to the Modbus protocol state when the finite state machine receives the function code and the cyclic redundancy check is correct.

[0024] According to other embodiments of the protocol adaptive identification method of the present invention, if the protocol state includes the Profibus protocol state, the step of activating the target protocol stack according to the protocol state includes:

[0025] Activate the Profibus protocol stack and initialize it to slave mode, and configure the slave address of the Profibus protocol stack.

[0026] Place the Modbus protocol stack into a dormant state or a low-priority background state.

[0027] According to other embodiments of the protocol adaptive identification method of the present invention, if the protocol state includes the Modbus protocol state, the step of activating the target protocol stack according to the protocol state further includes:

[0028] Activate the Modbus protocol stack and initialize it to slave mode, and configure the slave address of the Modbus protocol stack;

[0029] Place the Profibus protocol stack into a sleep state or a low-priority background state.

[0030] The protocol adaptive identification method according to other embodiments of the present invention further includes:

[0031] In the protocol response state, detect abnormal protocol switching.

[0032] If no valid frame of the current protocol is received within the second preset time, the re-identification process is triggered;

[0033] Alternatively, if a preset number of invalid frames are received consecutively, the re-identification process is triggered.

[0034] Secondly, an embodiment of the present invention provides an IO data acquisition device, the IO data acquisition device comprising: a main controller and an RS-485 interface, the IO data acquisition device further comprising a built-in Profibus protocol stack and a Modbus protocol stack, the main controller being capable of executing the protocol adaptive identification method as described in the first aspect, the main controller comprising:

[0035] A data monitoring module is connected to the RS-485 interface and is used to monitor data frames on the communication bus in real time to obtain the raw data stream when the RS-485 interface is kept in the receive enabled state.

[0036] The feature extraction module is used to parse the raw data stream to extract protocol features;

[0037] The protocol matching module is used to match the protocol features with the pre-stored Profibus feature library and Modbus feature library to confirm the protocol status.

[0038] The protocol stack activation module is used to activate the target protocol stack according to the protocol state to enter the protocol response state; wherein, the target protocol stack includes: Profibus protocol stack and Modbus protocol stack.

[0039] Thirdly, one embodiment of the present invention provides a control device for an I / O data acquisition apparatus, comprising:

[0040] At least one processor, and,

[0041] A memory communicatively connected to the at least one processor; wherein,

[0042] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the protocol adaptive identification method as described in the first aspect.

[0043] Fourthly, one embodiment of the present invention provides a computer-readable storage medium storing computer-executable instructions for causing a computer to perform the protocol adaptive identification method as described in the first aspect.

[0044] Other features and advantages of this application will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the description and the accompanying drawings. Attached Figure Description

[0045] Figure 1 This is a schematic flowchart of a specific embodiment of the protocol adaptive identification method in this invention.

[0046] Figure 2 yes Figure 1 A schematic diagram of a specific embodiment of step 103;

[0047] Figure 3 yes Figure 2 A schematic diagram of a specific embodiment of step 201;

[0048] Figure 4 yes Figure 2 A schematic diagram of a specific embodiment of step 202;

[0049] Figure 5 yes Figure 1 A schematic diagram of a specific embodiment of step 104;

[0050] Figure 6 yes Figure 1 A flowchart illustrating another specific embodiment of step 104;

[0051] Figure 7 This is a schematic flowchart of another specific embodiment of the protocol adaptive identification method in this invention;

[0052] Figure 8 This is a schematic flowchart of another specific embodiment of the protocol adaptive identification method in this invention;

[0053] Figure 9 This is a module block diagram of a specific embodiment of the IO data acquisition device in this invention;

[0054] Figure 10 This is a schematic diagram of a specific embodiment of the IO data acquisition device in this invention;

[0055] Figure 11 This is a schematic flowchart of a specific embodiment of the time-division multiplexing and bus arbitration method in this invention.

[0056] Explanation of reference numerals in the attached figures:

[0057] RS-485 interface 801, main controller 802, data monitoring module 803, feature extraction module 804, protocol matching module 805, protocol stack activation module 806. Detailed Implementation

[0058] The following will describe the concept and technical effects of the present invention clearly and completely with reference to embodiments, so as to fully understand the purpose, features and effects of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are all within the scope of protection of the present invention.

[0059] In the description of this invention, if directional descriptions are involved, such as "up," "down," "front," "back," "left," "right," etc., indicating the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, it is only for the convenience of describing the invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. If a feature is referred to as "set," "fixed," "connected," or "installed" on another feature, it can be directly set, fixed, or connected to the other feature, or it can be indirectly set, fixed, connected, or installed on the other feature.

[0060] In the description of the embodiments of the present invention, the term "several" means one or more, and the term "multiple" means two or more. The terms "greater than," "less than," and "exceeding" should be understood as excluding the stated number, while the terms "above," "below," and "within" should be understood as including the stated number. The terms "first" and "second" should be understood as distinguishing technical features, and not as indicating or implying relative importance, the number of indicated technical features, or the order of the indicated technical features.

[0061] In industrial automation control systems, remote I / O data acquisition devices serve as crucial hubs connecting field sensors and actuators with upper-level control master stations (such as PLCs and DCS), making the compatibility of their communication protocols paramount. Currently, several fieldbus protocols coexist in the market, with PROFIBUS-DP and Modbus (RTU / TCP) being the two most widely used. Some scenarios use the Modbus protocol for data transmission, while others use the PROFIBUS protocol. Both protocols use RS485 level data transmission at the hardware physical layer. However, due to the relative complexity and high transmission rate of the PROFIBUS protocol, a dedicated PROFIBUS protocol chip is often required for bridging.

[0062] Currently, the PROFIBUS or Modbus protocol can be manually selected via hardware DIP switches or software configuration tools. However, users must be familiar with the master station protocol and complete the correct settings before powering on the device. Incorrect settings or changes to the master station protocol will prevent the device from communicating, causing system downtime and increasing the difficulty and risk of debugging and maintenance.

[0063] This invention aims to address at least one of the technical problems existing in the prior art. To this end, this invention proposes a protocol adaptive identification method, which can reduce the risk of communication failures caused by human configuration errors and improve the overall reliability and availability of the system.

[0064] Reference Figure 1 , Figure 1 A flowchart illustrating the protocol adaptive identification method in an embodiment of the present invention is shown. In some embodiments, it is applied to an IO data acquisition device, which includes an RS-485 interface and a built-in Profibus protocol stack and Modbus protocol stack. The protocol adaptive identification method may include, but is not limited to, steps 101 to 104:

[0065] Step 101: While the RS-485 interface remains in the receive enabled state, communicate data frames on the real-time communication bus to obtain the raw data stream.

[0066] In step 101, the RS-485 interface is the physical layer interface of the IO data acquisition device.

[0067] Step 102: Parse the raw data stream to extract protocol features.

[0068] In step 102, the protocol features include frame start and end features, frame structure features, address field features, and specific function codes / services. Frame start and end features include: Profibus-DP frames have explicit start delimiters (e.g., SD2=0x68, SD4=0xDC, etc.), while Modbus RTU relies on the silence time (3.5 characters) between frames as a natural boundary. Frame structure features include: Profibus frames have a fixed-format header (length, destination / source address, control field, etc.), while Modbus frames consist of slave address, function code, data, and CRC checksum. Address field features include: Profibus address fields are single-byte (0-127), and Modbus slave addresses are also single-byte (1-247), but the polling pattern between the master and slave is usually different. Specific function codes / services include: for example, a Profibus master periodically sends token frames or requests diagnostic data (FDL), while a Modbus master does not. Typical Modbus function codes (such as 0x03 Read Holding Register) have no direct counterpart in Profibus.

[0069] Step 103: Match the protocol features with the pre-stored Profibus and Modbus feature libraries to confirm the protocol status.

[0070] Step 104: Activate the target protocol stack according to the protocol state to enter the protocol response state; wherein, the target protocol stack includes: Profibus protocol stack and Modbus protocol stack.

[0071] In steps 101 to 104 of this embodiment, after the IO data acquisition device is powered on, it initially enters a protocol listening state. The RS-485 interface remains in a receive-enabled state, continuously listening to data frames on the communication bus to obtain the raw data stream, and does not actively send any data that may interfere with the network. The captured raw data stream is parsed to extract protocol features such as frame start and end features, frame structure features, address field features, and specific function codes / services. The extracted protocol features are matched with the PROFIBUS feature library and Modbus feature library pre-stored in the IO data acquisition device. After the protocol features match the PROFIBUS feature library or Modbus feature library, the protocol status is confirmed. The IO data acquisition device can automatically identify whether the protocol frame sent by the connected master station is a PROFIBUS protocol or a Modbus protocol. The decision engine confirms the target protocol to switch according to the protocol status, activates the target protocol stack corresponding to the target protocol, and then puts the other protocol stack into a sleep or low-priority background state. The IO data acquisition device then enters the protocol response state, which can reduce the risk of communication failure due to manual configuration errors and improve the overall reliability and availability of the system.

[0072] Reference Figure 2 , Figure 2 The flowchart of the protocol adaptive identification method in an embodiment of the present invention is shown. In some embodiments, protocol features are matched with pre-stored Profibus and Modbus feature libraries to confirm the protocol status, specifically including but not limited to steps 201 to 202:

[0073] Step 201: Match the protocol features with the Profibus feature library and the Modbus feature library according to the preset weighted scoring method to obtain the protocol status.

[0074] In step 201, each matching protocol feature is assigned a score using a weighted scoring method. Within a certain time period, the scores of the Profibus protocol and the Modbus protocol are compared, and the protocol state is determined based on the score comparison result. The protocol state is used to determine whether it is the Profibus protocol or the Modbus protocol.

[0075] Step 202, or, according to the preset finite state machine method, perform protocol matching between the protocol features and the Profibus feature library and the Modbus feature library to obtain the protocol state.

[0076] In step 202, a finite state machine is designed, and the received byte sequence is transitioned through the finite state machine.

[0077] Reference Figure 3 , Figure 3A flowchart illustrating the protocol adaptive identification method in an embodiment of the present invention is shown. In some embodiments, the protocol state includes the Profibus protocol state and the Modbus protocol state. Protocol features are matched with the Profibus feature library and the Modbus feature library according to a preset weighted scoring method to obtain the protocol state. Specifically, this includes, but is not limited to, steps 301 to 302:

[0078] Step 301: When the target start frame is detected, the Profibus protocol score is added, and if the Profibus protocol score is greater than a preset threshold within a first preset time, the Profibus protocol status is obtained.

[0079] In step 301, the target start frame is, for example, SD2=0x68, where the Profibus protocol status is determined to be Profibus protocol.

[0080] Step 302: When a complete frame that meets the cyclic redundancy check is detected, the Modbus protocol score is increased, and if the Modbus protocol score is greater than a preset threshold within a first preset time, the Modbus protocol status is obtained.

[0081] In step 302, the Cyclic Redundancy Check (CRC) represents Modbus CRC check, where the Modbus protocol status indicates that it is determined to be Modbus protocol.

[0082] It should be noted that the specific weighted scoring method is as follows: detecting SD2=0x68 adds points to the Profibus protocol score; detecting a complete frame that conforms to the Modbus CRC checksum adds points to the Modbus protocol score. Within a set time window, the protocol is determined to be the one whose cumulative score among the Profibus and Modbus protocols first exceeds the threshold.

[0083] Reference Figure 4 , Figure 4 The flowchart of the protocol adaptive identification method in an embodiment of the present invention is shown. In some embodiments, the protocol features are matched with the Profibus feature library and the Modbus feature library according to a preset finite state machine method to obtain the protocol state, specifically including but not limited to steps 401 to 403:

[0084] Step 401: Construct a finite state machine; wherein the finite state machine is used to perform state transitions on the received byte sequence.

[0085] Step 402: When the byte sequence received by the finite state machine includes the target start frame, the finite state machine is switched to the suspected Profibus protocol state. After the byte sequence conforms to the sequence length and sequence format of the Profibus protocol, the finite state machine is switched to the Profibus protocol state.

[0086] Step 403: If the communication bus receives an address byte conforming to the Modbus protocol after a preset silent time, it switches to the suspected Modbus state through a finite state machine, and switches to the Modbus protocol state when the finite state machine receives the function code and the cyclic redundancy check is correct.

[0087] It should be noted that, for example, with the finite state machine method: if 0x68 is received, the protocol state enters the "suspected Profibus" state. If subsequent bytes conform to the Profibus length and format, the Profibus protocol state is confirmed. If an address byte is received after a long period of silence, the state enters the "suspected Modbus" state. If a function code is received and the CRC is correct, the Modbus protocol state is confirmed.

[0088] Reference Figure 5 , Figure 5 A flowchart illustrating the protocol adaptive identification method in an embodiment of the present invention is shown. In some embodiments, if the protocol state includes the Profibus protocol state, activating the target protocol stack according to the protocol state specifically includes, but is not limited to, steps 501 to 502:

[0089] Step 501: Activate the Profibus protocol stack and initialize it to slave mode, then configure the slave address of the Profibus protocol stack.

[0090] Step 502: Put the Modbus protocol stack into a sleep state or a low-priority background state.

[0091] It should be noted that, specifically, the Profibus protocol stack is activated and initialized to slave mode, with its own slave address configured. The slave address can be pre-set uniformly or learned from captured frames. The Modbus protocol stack is then placed into a sleep or low-priority background state. The IO data acquisition device then enters the protocol response state, and for subsequent requests from the master station that conform to the Profibus protocol, it parses and processes the IO data entirely according to the Profibus protocol specifications, and organizes compliant response frames to reply. It can automatically call the Profibus protocol processing engine to reply with data according to the Profibus protocol specifications without manual intervention.

[0092] Reference Figure 6 , Figure 6A flowchart illustrating the protocol adaptive identification method in an embodiment of the present invention is shown. In some embodiments, if the protocol state includes the Modbus protocol state, activating the target protocol stack according to the protocol state may include, but is not limited to, steps 601 to 602:

[0093] Step 601: Activate the Modbus protocol stack and initialize it to slave mode, and configure the slave address of the Modbus protocol stack.

[0094] Step 602: Put the Profibus protocol stack into a sleep state or a low-priority background state.

[0095] It should be noted that, specifically, the Modbus protocol stack is activated and initialized to slave mode, with its own slave address configured. The slave address can be pre-set uniformly or learned from captured frames. The Profibus protocol stack is then placed into a sleep or low-priority background state. The IO data acquisition device then enters the protocol response state, and for subsequent requests from the master station that conform to the Modbus protocol, it parses and processes the IO data entirely according to the Modbus protocol specifications, and organizes compliant response frames to reply. It can automatically call the Modbus protocol processing engine to reply with data according to the Modbus protocol specifications without manual intervention.

[0096] Reference Figure 7 , Figure 7 A flowchart illustrating the protocol adaptive identification method in an embodiment of the present invention is shown. In some embodiments, the protocol adaptive identification method may include, but is not limited to, steps 701 to 703:

[0097] Step 701: In the protocol response state, detect abnormal protocol switching.

[0098] Step 702: If no valid frame of the current protocol is received within the second preset time, the re-identification process is triggered.

[0099] Step 703, or, if a preset number of invalid frames are received consecutively, the re-identification process is triggered.

[0100] It should be noted that, specifically, in the protocol response state, the IO data acquisition device can continue to maintain a lightweight background listening thread to detect abnormal protocol switching, such as a change of master station. If no valid frames of this protocol are received for an extended period, or if a large number of unparseable frames are received consecutively, the re-identification process can be triggered, i.e., returning to step S101.

[0101] In addition, this application also discloses an IO data acquisition device, please refer to... Figure 8 , Figure 8This invention discloses a module block diagram of an IO data acquisition device according to an embodiment of the present invention. In some embodiments, the IO data acquisition device can implement the above-described protocol adaptive identification method. The IO data acquisition device includes a main controller 802 and an RS-485 interface 801. The IO data acquisition device also has a built-in Profibus protocol stack and a Modbus protocol stack. The main controller 802 is capable of executing the protocol adaptive identification method as described in any of the above embodiments. The main controller 802 includes a data monitoring module 803, a feature extraction module 804, a protocol matching module 805, and a protocol stack activation module 806. The data monitoring module 803, the feature extraction module 804, the protocol matching module 805, and the protocol stack activation module 806 are all communicatively connected.

[0102] The data monitoring module 803 connects to the RS-485 interface 801 and is used to monitor data frames on the communication bus in real time to obtain the raw data stream while the RS-485 interface 801 remains in the receive enabled state. The feature extraction module 804 parses the raw data stream to extract protocol features. The protocol matching module 805 performs protocol matching between the protocol features and pre-stored PROFIBUS and Modbus feature libraries to confirm the protocol status. The protocol stack activation module 806 activates the target protocol stack according to the protocol status to enter the protocol response state; the target protocol stack includes a PROFIBUS protocol stack and a Modbus protocol stack.

[0103] After power-on, the IO data acquisition device initially enters a protocol listening state. The RS-485 interface 801 remains enabled for receiving, and the data listening module 803 continuously monitors data frames on the communication bus to obtain the raw data stream, without actively sending any data that might interfere with the network. The feature extraction module 804 parses the captured raw data stream to extract protocol features such as frame start and end features, frame structure features, address field features, and specific function codes / services. The protocol matching module 805 matches the extracted protocol features with the PROFIBUS and Modbus feature libraries pre-stored in the IO data acquisition device. After a match is found, the protocol status is confirmed, and the IO data acquisition device can automatically identify whether the protocol frame sent by the master station is a PROFIBUS or Modbus protocol. The protocol stack activation module 806 confirms the target protocol to be switched based on the protocol status, activates the target protocol stack corresponding to the target protocol, and then puts the other protocol stack into a dormant or low-priority background state. The IO data acquisition device then enters the protocol response state, which can reduce the risk of communication failure caused by manual configuration errors and improve the overall reliability and availability of the system.

[0104] The operation process of the IO data acquisition device in this embodiment is specifically described above. Figure 1 , Figure 2 , Figure 3 , Figure 4 , Figure 5 , Figure 6 The steps S101 to S104, S201 and S202, S301 and S302, S401 to S403, S501 and S502, S601 and S602, and S701 to S703 of the protocol adaptive identification method are not described in detail here.

[0105] Please refer to Figure 9 and Figure 10 , Figure 9 This is a schematic flowchart of a protocol adaptive identification method disclosed in one embodiment of the present invention. Figure 10 This is a schematic diagram of an I / O data acquisition device according to an embodiment of the present invention. In some embodiments, the operation process of the I / O data acquisition device includes: hardware self-test, I / O data acquisition device initialization, communication interface preparation, and initiation of adaptive identification process. Users do not need any software or hardware settings; they only need to connect the device to the fieldbus network and connect the I / O signal lines. The I / O data acquisition device automatically identifies the master station protocol in the network and completes protocol adaptation and preparation within 100ms to several seconds. Afterward, the I / O data acquisition device, from the perspective of the master station, is a standard PROFIBUS slave or a standard Modbus slave, exchanging data entirely in accordance with the communication protocol of that protocol.

[0106] It should be noted that the physical layer interface can also support Ethernet for adaptive identification of Modbus TCP and Profinet. Profinet requires an expanded feature library. The protocol decision engine can include a machine learning model, which improves the accuracy and speed of protocol identification in complex interference environments by learning from historical communication data. The IO data acquisition device can be equipped with an indicator light to display the currently identified and running protocol, such as green for Modbus and blue for Profinet, facilitating status observation by on-site personnel. The adaptive protocol identification method is also applicable to the adaptive identification of two or more other industrial communication protocols, such as CANopen and Modbus.

[0107] Users do not need to understand the master station protocol, nor perform any hardware jumpers or software configurations, greatly simplifying the installation, debugging, and maintenance process and lowering the technical threshold. The IO data acquisition device boasts excellent compatibility and flexibility, adapting to both PROFIBUS and Modbus, two major mainstream protocol networks. This significantly reduces the types of spare parts needed, improves equipment reuse, and is highly suitable for complex scenarios such as upgrades, retrofits, and integration of equipment from multiple vendors. The automatic identification mechanism of the IO data acquisition device reduces communication failures caused by human configuration errors, improving the overall reliability and availability of the system. The background monitoring mechanism can also handle unexpected situations such as changes to the network master station. Compared to dual-protocol stack parallel solutions, this invention achieves dual-protocol support on a single processor through dynamic scheduling, avoiding redundant hardware resource design and effectively controlling costs. The IO data acquisition device shortens the engineering time for system integrators and accelerates project delivery. It provides end users with a future-oriented solution, protecting their investment.

[0108] Reference Figure 11 , Figure 11 A flowchart illustrating the time-division multiplexing and bus arbitration method in an embodiment of the present invention is shown. In some embodiments, the time-division multiplexing and bus arbitration method is applied to a master station system, such as a Profibus master station, which operates with a single Profibus protocol.

[0109] The master station system includes: deploying at least one of the above-mentioned intelligent remote IO data acquisition devices on a bus that is mixed with native Profibus slave stations and native Modbus slave stations, and configuring it as a "protocol gateway" mode.

[0110] Address mapping involves virtually mapping a unique Profibus slave address to each native Modbus slave device that needs to access the network within the "gateway" device. The master system treats these Modbus devices as ordinary Profibus slaves.

[0111] When the master station polls for a virtual address (corresponding to a real Modbus device) according to the PROFIBUS protocol, the gateway device recognizes this request. The gateway translates the PROFIBUS request data frame into a corresponding Modbus request frame in real time based on its internal mapping table, including converting the slave address, function code, data address mapping, and calculating the Modbus CRC. The gateway sends the translated Modbus frame onto the bus to address the target Modbus device. The target Modbus device, completely unaware of the request, replies in standard Modbus format. The gateway captures this Modbus reply, translates it back into a standard PROFIBUS response frame, and replies to the master station using its own PROFIBUS identity.

[0112] For a Profibus master, all devices are Profibus devices; for native Modbus devices, the master is a Modbus master. Physically, there is only one bus. Furthermore, the Profibus window and the Modbus window are strictly separated in time and are actively controlled by the master.

[0113] Polling offers a degree of flexibility; within each protocol window, the master station can employ any communication method within that protocol standard, such as polling or broadcasting. Furthermore, the time allocation within a window can be dynamically adjusted based on the data volume and real-time requirements of the two types of devices; for example, 90% of the time can be allocated to Profibus, and 10% to Modbus.

[0114] It should be noted that, in Figure 11 The silence time (T_silence) in the protocol is a core parameter for preventing crosstalk between protocols. It must be long enough to allow all possible responses (including delays) on the bus to dissipate completely, ensuring that the starting frame of the next window can be correctly identified.

[0115] Another embodiment of the present invention discloses a control device for an I / O data acquisition apparatus, comprising: at least one processor, and a memory communicatively connected to the at least one processor. The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to perform actions such as... Figure 1 Control method steps S101 to S104 Figure 2 Control method steps S201 and S202 Figure 3 Control method steps S301 and S302 Figure 4 Control method steps S401 to S403 Figure 5 Control method steps S501 and S502 Figure 6 The control method steps S601 and S602 and Figure 7 The protocol adaptive identification method in steps S701 to S703 of the control method.

[0116] Another embodiment of the present invention discloses a computer-readable storage medium, the storage medium comprising: storing computer-executable instructions for causing a computer to perform... Figure 1 Control method steps S101 to S104 Figure 2 Control method steps S201 and S202 Figure 3 Control method steps S301 and S302 Figure 4 Control method steps S401 to S403 Figure 5Control method steps S501 and S502 Figure 6 The control method steps S601 and S602 and Figure 7 The protocol adaptive identification method in steps S701 to S703 of the control method.

[0117] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0118] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0119] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments, and various changes can be made within the scope of knowledge possessed by those skilled in the art without departing from the spirit of the present invention. Furthermore, the embodiments of the present invention and the features thereof can be combined with each other unless otherwise specified.

Claims

1. A protocol adaptive identification method, characterized in that, This method is applied to an I / O data acquisition device, which includes an RS-485 interface and a built-in Profibus and Modbus protocol stack. The protocol adaptive identification method includes: While the RS-485 interface remains in the receive enabled state, the data frames on the communication bus are monitored in real time to obtain the raw data stream. The raw data stream is parsed to extract protocol features; The protocol features are matched with the pre-stored Profibus and Modbus feature libraries to confirm the protocol status. The target protocol stack is activated according to the protocol state to enter the protocol response state; wherein, the target protocol stack includes: the Profibus protocol stack and the Modbus protocol stack.

2. The protocol adaptive identification method according to claim 1, characterized in that, The step of matching the protocol features with the pre-stored Profibus and Modbus feature libraries to confirm the protocol status includes: The protocol features are matched with the Profibus feature library and the Modbus feature library according to a preset weighted scoring method to obtain the protocol status; Alternatively, the protocol features can be matched with the Profibus feature library and the Modbus feature library using a preset finite state machine method to obtain the protocol state.

3. The protocol adaptive identification method according to claim 2, characterized in that, The protocol state includes the Profibus protocol state and the Modbus protocol state. The process of matching the protocol features with the Profibus feature library and the Modbus feature library using a preset weighted scoring method to obtain the protocol state includes: When a target start frame is detected, the Profibus protocol score is added, and if the Profibus protocol score is greater than a preset threshold within a first preset time, the Profibus protocol status is obtained. When a complete frame that meets the cyclic redundancy check is detected, the Modbus protocol score is increased, and if the Modbus protocol score is greater than a preset threshold within the first preset time period, the Modbus protocol status is obtained.

4. The protocol adaptive identification method according to claim 3, characterized in that, The step of performing protocol matching between the protocol features and the Profibus and Modbus feature libraries using a preset finite state machine method to obtain the protocol state includes: Construct a finite state machine; wherein the finite state machine is used to perform state transitions on the received byte sequence; When the byte sequence received by the finite state machine includes the target start frame, the finite state machine switches to the suspected Profibus protocol state, and after the byte sequence conforms to the sequence length and sequence format of the Profibus protocol, the finite state machine switches to the Profibus protocol state. If the communication bus receives an address byte conforming to the Modbus protocol after a preset silent time, it switches to a suspected Modbus state through the finite state machine, and switches to the Modbus protocol state when the finite state machine receives the function code and the cyclic redundancy check is correct.

5. The protocol adaptive identification method according to claim 3, characterized in that, If the protocol state includes the Profibus protocol state, activating the target protocol stack according to the protocol state includes: Activate the Profibus protocol stack and initialize it to slave mode, and configure the slave address of the Profibus protocol stack. Place the Modbus protocol stack into a dormant state or a low-priority background state.

6. The protocol adaptive identification method according to claim 5, characterized in that, If the protocol state includes the Modbus protocol state, the step of activating the target protocol stack according to the protocol state further includes: Activate the Modbus protocol stack and initialize it to slave mode, and configure the slave address of the Modbus protocol stack; Place the Profibus protocol stack into a sleep state or a low-priority background state.

7. The protocol adaptive identification method according to claim 4, characterized in that, Also includes: In the protocol response state, detect abnormal protocol switching. If no valid frame of the current protocol is received within the second preset time, the re-identification process is triggered; Alternatively, if a preset number of invalid frames are received consecutively, the re-identification process is triggered.

8. An I / O data acquisition device, characterized in that, The IO data acquisition device includes: a main controller and an RS-485 interface. The IO data acquisition device also has a built-in Profibus protocol stack and a Modbus protocol stack. The main controller is capable of executing the protocol adaptive identification method as described in any one of claims 1 to 7. The main controller includes: A data monitoring module is connected to the RS-485 interface and is used to monitor data frames on the communication bus in real time to obtain the raw data stream when the RS-485 interface is kept in the receive enabled state. The feature extraction module is used to parse the raw data stream to extract protocol features; The protocol matching module is used to match the protocol features with the pre-stored Profibus feature library and Modbus feature library to confirm the protocol status. The protocol stack activation module is used to activate the target protocol stack according to the protocol state to enter the protocol response state; wherein, the target protocol stack includes: Profibus protocol stack and Modbus protocol stack.

9. A control device for an I / O data acquisition apparatus, characterized in that, include: At least one processor, and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the protocol adaptive identification method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the protocol adaptive identification method as described in any one of claims 1 to 7.