IO communication method, device, equipment and storage medium
By combining continuous register addresses and data items to form combined address segments and acquisition packets, the problem of poor versatility of IO devices is solved, and efficient data acquisition and device adaptability are achieved.
Patent Information
- Application Number
- CN202410133252.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-30
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2044-01-30
AI Technical Summary
In the prior art, IO devices have poor versatility, mainly because different types of devices require different communication protocols for data collection, resulting in a large number of IO collection packages.
By obtaining the addresses of multiple registers and the data items to be collected, if there are continuous target addresses, they are combined to form a combined address segment, and the corresponding data items to be collected are combined to obtain an IO collection package, which is finally encapsulated and sent a communication request to the IO device.
It improves the versatility and data acquisition efficiency of IO devices, reduces the restrictions on register address segments, and adapts to new register types without changing the device, only by combining data items according to the address.
Smart Images

Figure CN118012795B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to an IO communication method, apparatus, device, and storage medium. Background Art
[0002] When collecting data from IO (Input / Output) devices, the software combines these variables based on user-configured data items to form an IO acquisition packet. To improve IO communication efficiency, we need to minimize the number of IO acquisition packets. Currently, this is primarily achieved by specifying the address segments to be collected for a specific register type.
[0003] Since the protocol specifies the address segments for collecting specific register types, and different types of devices may need to use different communication protocols to collect data, the versatility of the devices is poor. Summary of the Invention
[0004] The main purpose of this application is to provide an IO communication method, apparatus, device and storage medium, aiming to solve the technical problem of poor versatility of the device.
[0005] To achieve the above object, the present application provides an IO communication method, comprising: obtaining addresses of multiple registers and data items to be collected corresponding to each of the registers;
[0006] If there are at least two consecutive target addresses among the multiple addresses, combining the at least two target addresses to obtain a combined address segment;
[0007] Combining all the data items to be collected corresponding to the combined address segment to obtain an IO collection package;
[0008] Encapsulating the IO acquisition package to obtain a communication request;
[0009] The communication request is sent to the IO device, so that the IO device collects and feeds back communication data based on the communication request.
[0010] Optionally, combining all the to-be-collected data items corresponding to the combined address segment to obtain an IO collection package includes:
[0011] If the total number of communication bytes of all the data items to be collected is greater than the preset number of communication bytes, determining the number of the IO collection packages;
[0012] Based on the number of the IO acquisition packets and the preset number of communication bytes, the data items corresponding to the combined address segments are combined to obtain a plurality of the IO acquisition packets.
[0013] Optionally, sending the communication request to the IO device so that the IO device collects and feeds back communication data based on the communication request includes:
[0014] The communication request is sent to the IO device so that the IO device parses the communication request. If the instruction corresponding to the communication request is a connection variable instruction, communication data is collected and the communication data is fed back.
[0015] Optionally, the sending the communication request to the IO device so that the IO device parses the communication request, and if the instruction corresponding to the communication request is a connection variable instruction, collecting communication data and feeding back the communication data includes:
[0016] The communication request is sent to the IO device so that the IO device parses the communication request. If the instruction corresponding to the communication request is a connection variable instruction, the communication data in the display window and / or the communication data that needs to record historical data is collected, and the communication data is fed back.
[0017] Optionally, sending the communication request to the IO device so that the IO device collects and feeds back communication data based on the communication request includes:
[0018] The communication request is sent to the IO device so that the IO device parses the communication request. If the instruction corresponding to the communication request is a variable value instruction, the latest communication data currently collected is fed back.
[0019] Optionally, after combining all the to-be-collected data items corresponding to the combined address segment to obtain an IO collection package, the method further includes:
[0020] Determining the priority corresponding to the data item in the IO acquisition package;
[0021] Set the highest priority among all priorities as the target priority;
[0022] Using the target priority as the priority of the IO acquisition package;
[0023] Based on the priority of the IO acquisition package, a collection frequency of the IO acquisition package is determined.
[0024] Optionally, if there are at least two consecutive target addresses among the plurality of addresses, combining the at least two target addresses to obtain a combined address segment includes:
[0025] If there are at least two target addresses among the multiple addresses that have the same corresponding register type and continuous addresses, the at least two target addresses are combined to obtain a combined address segment.
[0026] In a second aspect, the present application provides an IO communication device, characterized in that the IO communication device includes:
[0027] An acquisition module, configured to acquire addresses of a plurality of registers and data items to be collected corresponding to the registers;
[0028] A first combining module, configured to combine at least two consecutive target addresses to obtain a combined address segment if there are at least two consecutive target addresses among the multiple addresses;
[0029] A second combining module is used to combine all the data items to be collected corresponding to the combined address segment to obtain an IO collection package;
[0030] The encapsulation module is used to encapsulate the IO acquisition package to obtain a communication request;
[0031] The sending module is used to send the communication request to the IO device, so that the IO device collects and feeds back communication data based on the communication request.
[0032] In a third aspect, the present application provides an IO communication device, comprising: a processor, a memory, and an IO communication program stored in the memory, wherein the IO communication program implements the steps of the IO communication method as described in any one of the above items when executed by the processor.
[0033] In a fourth aspect, the present application provides a computer-readable storage medium, on which an IO communication program is stored. When the IO communication program is executed by a processor, the IO communication method as described in any one of the above items is implemented.
[0034] An embodiment of the present application proposes an IO communication method, which includes: obtaining addresses of multiple registers and data items to be collected corresponding to each of the registers; if there are at least two consecutive target addresses among the multiple addresses, combining the at least two target addresses to obtain a combined address segment; combining all the data items to be collected corresponding to the combined address segment to obtain an IO collection package; encapsulating the IO collection package to obtain a communication request; and sending the communication request to an IO device so that the IO device collects and feeds back communication data based on the communication request.
[0035] Compared with the related art, the number of IO acquisition packages is reduced by specifying the address segment for acquiring a certain register type. In the embodiment of the present application, it is only necessary to combine consecutive addresses to obtain the combined address segment, and then combine the data amount according to the combined address segment to obtain the IO acquisition package. This embodiment does not need to limit the address segment of the register, so when a new register type is used, there is no need to change the device, and it is only necessary to combine the data items according to the address of the register type, thereby improving the versatility of the device. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 This is a structural diagram of the IO communication device of this application;
[0037] Figure 2 This is a flow chart of the first embodiment of the IO communication method of the present application;
[0038] Figure 3 This is a functional module diagram of the first embodiment of the IO communication device of the present application.
[0039] The realization of the objectives, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0040] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.
[0041] When collecting IO device data, the software combines these variables based on user-configured data items to form an IO acquisition packet. To improve IO communication efficiency, we need to minimize the number of IO acquisition packets. Currently, the main method to reduce the number of IO acquisition packets is to specify the address segment of a specific register type to be collected.
[0042] Since the protocol specifies the address segments for collecting specific register types, and different types of devices may need to use different communication protocols to collect data, the versatility of the devices is poor.
[0043] The present application provides a solution, which includes obtaining the addresses of multiple registers and the data items to be collected corresponding to each of the registers; if there are at least two consecutive target addresses among the multiple addresses, combining the at least two target addresses to obtain a combined address segment; combining all the data items to be collected corresponding to the combined address segment to obtain an IO collection package; encapsulating the IO collection package to obtain a communication request; and sending the communication request to an IO device so that the IO device collects and feeds back communication data based on the communication request.
[0044] Compared with the related art, the number of IO acquisition packages is reduced by specifying the address segment for acquiring a certain register type. In the embodiment of the present application, it is only necessary to combine consecutive addresses to obtain the combined address segment, and then combine the data amount according to the combined address segment to obtain the IO acquisition package. This embodiment does not need to limit the address segment of the register, so when a new register type is used, there is no need to change the device, and it is only necessary to combine the data items according to the address of the register type, thereby improving the versatility of the device.
[0045] Reference Figure 1 , Figure 1 This is a structural diagram of the IO communication device in the hardware operating environment involved in the embodiment of the present application.
[0046] like Figure 1 As shown, the IO communication device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0047] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation to the IO communication device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0048] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a data storage module, a network communication module, a user interface module and an IO communication program.
[0049] exist Figure 1In the IO communication device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the IO communication device of the present application can be set in the IO communication device, and the IO communication device calls the IO communication program stored in the memory 1005 through the processor 1001, and executes the IO communication method provided in the embodiment of the present application.
[0050] Based on the hardware structure of the above IO communication device but not limited to the above hardware structure, the present application provides a first embodiment of an IO communication method. Figure 2 , Figure 2 A flow chart of the first embodiment of the IO communication method of the present application is shown.
[0051] It should be noted that although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in an order different from that shown or described here.
[0052] In this embodiment, the IO communication method includes:
[0053] Step S10: Acquire addresses of multiple registers and data items to be collected corresponding to each register.
[0054] It should be noted that the IO communication method is executed by an IO communication device. An IO communication program is stored on the IO communication device. When the IO communication device executes the IO communication program, the IO communication method of this embodiment is implemented.
[0055] In this embodiment, the data items to be collected may be user-configured data items to be collected. These may be specific real-time data, status information, or control parameters. For example, the data items to be collected may be temperature, pressure, humidity, etc. A register may be a hardware device in an I / O communication device that stores data. After collecting the data items to be collected, the I / O communication device may store the collected data items in the register. The I / O communication device may be provided with multiple registers, and the types of the multiple registers may be the same or different.
[0056] Specifically, the addresses of multiple registers and the data items to be collected corresponding to the registers can be pre-stored locally or in the cloud in the IO communication device. When executing step S10, the addresses of the registers and the data items to be collected corresponding to each register can be directly called from the local or cloud.
[0057] Step S20: If there are at least two consecutive target addresses among the multiple addresses, combine the at least two target addresses to obtain a combined address segment.
[0058] Specifically, after obtaining the addresses of multiple registers, all addresses may be sorted to determine at least two consecutive target addresses. After obtaining at least two target addresses, the two target addresses may be combined to obtain a combined address segment.
[0059] It is understandable that after obtaining two consecutive target addresses, the types of registers corresponding to the consecutive target addresses may be the same or different. To facilitate subsequent collection of the data to be collected, as an optional implementation, step S20 specifically includes:
[0060] Step S201: If there are at least two target addresses in a plurality of addresses that have the same corresponding register type and continuous addresses, then the at least two target addresses are combined to obtain a combined address segment.
[0061] Specifically, based on the foregoing, after sorting the addresses of multiple registers to obtain at least two consecutive addresses, it can be determined whether the register types corresponding to the at least two consecutive target addresses are the same. If the two types are the same, the target addresses can be combined to obtain a combined address segment. Furthermore, if the register types corresponding to the at least two consecutive target addresses are different, the target addresses can be combined as long as the addresses are consecutive. This can reduce the amount of communication data and the number of communications, thereby saving communication bandwidth and system resources.
[0062] Step S30: Combine all the data items to be collected corresponding to the combined address segment to obtain an IO collection package.
[0063] In this embodiment, the IO acquisition package can be used to transmit and process data packets of IO device data. In order to reduce the number of communications, reduce communication overhead, and improve the efficiency of IO communication, multiple data items to be collected can be combined into one IO acquisition package.
[0064] It is understood that when there are multiple data items to be collected corresponding to a combined address segment, the total number of communication bytes for the data items to be collected may exceed the preset communication byte count, i.e., the maximum number of bytes allowed per communication by the IO communication device. When the total number of communication bytes for all data items to be collected exceeds the preset communication byte count, data loss or overflow may occur, increasing the likelihood of errors during data transmission and, in turn, compromising data integrity and accuracy.
[0065] Therefore, to avoid affecting the integrity and accuracy of the data, further, as an optional implementation, step S30 specifically includes:
[0066] Step S301: If the total number of communication bytes of all the data items to be collected is greater than a preset number of communication bytes, the number of the IO collection packages is determined.
[0067] Step S302: Based on the number of the IO acquisition packets and the preset number of communication bytes, the data items corresponding to the combined address segments are combined to obtain a plurality of the IO acquisition packets.
[0068] Specifically, after obtaining the combined address segment, all data items to be collected that correspond to the combined address segment are determined from the plurality of data items to be collected, and all data items to be collected are traversed to determine the type of each data item to be collected. After determining the type of each data item to be collected, the number of bytes occupied by each data item to be collected is determined based on the type of each data item to be collected. The number of bytes occupied by each data item to be collected, as well as the number of bytes for additional information and communication protocol overhead, are added to the total to obtain the total number of communication bytes for all data items to be collected.
[0069] After obtaining the total number of communication bytes for all data items to be collected, a determination is made as to whether the total number of communication bytes is greater than a preset total number of communication bytes. If the total number of communication bytes is greater than the preset number of communication bytes, the preset number of communication bytes is used as the maximum number of bytes for each IO collection packet, and the number of IO collection packets is determined based on the maximum number of bytes and the total number of communication bytes. Finally, after obtaining the number of IO collection packets, the data items to be collected corresponding to the combined address segments are combined according to the number of IO collection packets and the preset number of communication bytes to obtain multiple IO collection packets.
[0070] After obtaining the IO acquisition package, in order to avoid untimely data updates due to too low an acquisition frequency, thereby causing inaccurate data processing results, further, as an optional implementation, after step S30, the following is further included:
[0071] Step S31: Determine the priority corresponding to the data item to be collected in the IO collection package.
[0072] Step S32: The highest priority among all priorities is taken as the target priority.
[0073] Step S33: Using the target priority as the priority of the IO acquisition package.
[0074] Step S34: Determine the collection frequency of the IO collection package based on the priority of the IO collection package.
[0075] Specifically, after obtaining an IO acquisition package, the priorities of all data items to be collected in the IO acquisition package can be determined, and all priorities can be sorted to obtain a priority sequence. After obtaining the priority sequence, the highest priority in the priority sequence is used as the target priority, and this priority is used as the priority of the IO acquisition package. The acquisition frequency of the IO acquisition package is determined based on this priority.
[0076] For example, the IO acquisition package contains three data items to be collected, namely, data item 1 to be collected, data item 2 to be collected, and data item 3 to be collected, and the priority of data item 1 to be collected is 1, the priority of data item 2 to be collected is 10, and the priority of data item 3 to be collected is 100. The target priority can be determined as the priority corresponding to data item 3 to be collected, and the target priority can be used as the priority of the IO acquisition package, that is, the priorities of data item 1 to be collected, data item 2 to be collected, and data item 3 to be collected are all 100.
[0077] In this embodiment, setting the highest priority as the priority of the IO acquisition package can ensure that the data items to be collected are processed with high priority during the communication process, thereby improving the accuracy and real-time performance of the acquisition. In addition, setting the highest priority as the priority of the IO acquisition package can also reduce communication delays.
[0078] Step S40: encapsulate the IO acquisition package to obtain a communication request.
[0079] Step S50: Send the communication request to the IO device, so that the IO device collects and feeds back communication data based on the communication request.
[0080] Specifically, after obtaining the IO acquisition packet, the corresponding protocol can be used to format the IO acquisition packet, add protocol header information, add a checksum, and perform encryption processing to obtain a communication request. The communication request is then sent to the IO device. After receiving the communication request, the IO device collects and feeds back the communication data according to the communication request. In the process of collecting communication data, to ensure the accuracy, reliability, and efficiency of data exchange, the IO device further, as an optional embodiment, specifically includes step S50:
[0081] Step S501: Send the communication request to the IO device, so that the IO device parses the communication request. If the instruction corresponding to the communication request is a connection variable instruction, the IO device collects communication data and feeds back the communication data.
[0082] Step S502: Send the communication request to the IO device, so that the IO device parses the communication request. If the instruction corresponding to the communication request is a variable value instruction, the IO device feeds back the latest communication data currently collected.
[0083] Specifically, after receiving a communication request, the communication request can be parsed to obtain a specific instruction code or command identifier. After obtaining the specific instruction code or command identifier, it is compared with the instruction code or command identifier corresponding to the connection variable instruction. When the two are consistent, it is determined that the instruction corresponding to the communication request is a connection variable instruction. When it is determined that the instruction corresponding to the communication request is a connection variable instruction, the IO device establishes a communication connection with the corresponding data device to facilitate the collection of real-time communication data. In the process of collecting real-time communication data, in order to improve the collection efficiency, only the communication data that needs to be updated is collected. Therefore, in the process of collecting communication data, further, as an optional implementation method, step S501 specifically includes:
[0084] Step S5011: Send the communication request to the IO device so that the IO device parses the communication request. If the instruction corresponding to the communication request is a connection variable instruction, the communication data in the display window and / or the communication data that needs to record historical data is collected, and the communication data is fed back.
[0085] Specifically, in the process of collecting communication data, the communication data to be collected can be identified, such as determining whether there is a collection mark for the communication data to be collected, whether a display window appears for the communication data to be collected, or whether the communication data to be collected needs to record its historical value. When there is a collection mark for the communication data to be collected, a display window appears, or its historical value needs to be recorded, the collection operation is performed on the data to be collected, and the communication data is fed back after the communication data is collected.
[0086] Accordingly, when the specific instruction code or command identifier is inconsistent with the instruction code or command identifier corresponding to the connection variable instruction, the specific instruction code or command identifier is compared to see whether it is consistent with the instruction code or command identifier corresponding to the value variable instruction. If the specific instruction code or command identifier is consistent with the instruction code or command identifier corresponding to the value variable instruction, the IO device sends the latest communication data currently collected to the IO communication device.
[0087] In this embodiment, after receiving a communication request, the IO device parses it to determine whether the instruction corresponding to the communication request is a variable-value instruction or a variable-link instruction. It then performs different operations based on the corresponding instruction, thereby improving the accuracy, reliability, and efficiency of data exchange and avoiding continuous resource consumption. Furthermore, when the instruction is a variable-link instruction, "optimized collection" is implemented to improve collection efficiency by collecting only the data that needs to be updated.
[0088] In this embodiment, addresses of multiple registers and data items to be collected corresponding to each of the registers are obtained; if there are at least two consecutive target addresses among the multiple addresses, the at least two target addresses are combined to obtain a combined address segment; all the data items to be collected corresponding to the combined address segment are combined to obtain an IO collection package; the IO collection package is encapsulated to obtain a communication request; and the communication request is sent to the IO device, so that the IO device collects and feeds back communication data based on the communication request.
[0089] Compared with the related art, the number of IO acquisition packages is reduced by specifying the address segment for acquiring a certain register type. In the embodiment of the present application, it is only necessary to combine consecutive addresses to obtain the combined address segment, and then combine the data amount according to the combined address segment to obtain the IO acquisition package. This embodiment does not need to limit the address segment of the register, so when a new register type is used, there is no need to change the device, and it is only necessary to combine the data items according to the address of the register type, thereby improving the versatility of the device.
[0090] In addition, continuous addresses are combined to obtain combined address segments, and based on the combined address segments, all data items to be collected corresponding to the combined address segments are combined to obtain IO collection packages. That is, as long as the addresses are continuous, the continuous addresses will be combined to obtain combined address segments. This reduces the number of IO collection packages while keeping the data items to be collected unchanged, thereby improving data collection efficiency.
[0091] Based on the same application concept, the IO communication device of this application is proposed, referring to Figure 3 , Figure 3 This is a functional module diagram of the IO communication device of this application.
[0092] The IO communication device includes:
[0093] An acquisition module, configured to acquire addresses of a plurality of registers and data items to be collected corresponding to the registers;
[0094] A first combining module, configured to combine at least two consecutive target addresses to obtain a combined address segment if there are at least two consecutive target addresses among the multiple addresses;
[0095] A second combining module is used to combine all the data items to be collected corresponding to the combined address segment to obtain an IO collection package;
[0096] The encapsulation module is used to encapsulate the IO acquisition package to obtain a communication request;
[0097] The sending module is used to send the communication request to the IO device, so that the IO device collects and feeds back communication data based on the communication request.
[0098] It should be noted that the IO communication device may be provided with more modules. The various embodiments of the IO communication device in this embodiment and the technical effects achieved therefrom may refer to the various implementation methods of the IO communication method in the aforementioned embodiments, and will not be repeated here.
[0099] In addition, an embodiment of the present application further proposes a computer storage medium, on which an IO communication program is stored, and when the IO communication program is executed by the processor, the steps of the IO communication method as described above are implemented. Therefore, no further description will be given here. In addition, the description of the beneficial effects of adopting the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the program instructions can be deployed to be executed on one computing device, or on multiple computing devices located at one location, or on multiple computing devices distributed at multiple locations and interconnected by a communication network.
[0100] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware through a computer program. The above-described program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes in the above-described method embodiments. The above-described storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0101] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art can understand and implement the present invention without inventive work.
[0102] Through the description of the above embodiments, it is clear to those skilled in the art that the present application can be implemented by means of software plus necessary general hardware, and of course it can also be implemented by dedicated hardware including application-specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be various, such as analog circuits, digital circuits, or dedicated circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute the method of each embodiment of the present application.
[0103] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. An IO communication method, characterized in that: The method comprises: Acquire addresses of a plurality of registers and data items to be collected corresponding to the respective registers; the plurality of registers may include registers of different types; If there are at least two consecutive target addresses among the multiple addresses, combining the at least two target addresses to obtain a combined address segment; Combining all the data items to be collected corresponding to the combined address segment to obtain an IO collection package; Encapsulating the IO acquisition package to obtain a communication request; Sending the communication request to the IO device, so that the IO device collects and feeds back communication data based on the communication request; After combining all the to-be-collected data items corresponding to the combined address segment to obtain an IO collection package, the method further includes: Determining the priority corresponding to the data item in the IO acquisition package; Set the highest priority among all priorities as the target priority; Using the target priority as the priority of the IO acquisition package; Determining a collection frequency of the IO collection package based on the priority of the IO collection package; If there are at least two consecutive target addresses among the multiple addresses, the step of combining the at least two target addresses to obtain a combined address segment includes: Determine whether the register types corresponding to at least two consecutive target addresses are the same; If the registers are of the same type, combining at least two of the target addresses to obtain a combined address segment; If the types of the registers are different, then in the case that the addresses of at least two of the target addresses are continuous, the at least two target addresses with continuous addresses are combined to obtain a combined address segment.
2. The IO communication method according to claim 1, wherein: The step of combining all the data items to be collected corresponding to the combined address segment to obtain an IO collection package includes: If the total number of communication bytes of all the data items to be collected is greater than the preset number of communication bytes, determining the number of the IO collection packages; Based on the number of the IO acquisition packets and the preset number of communication bytes, the data items corresponding to the combined address segments are combined to obtain a plurality of the IO acquisition packets.
3. The IO communication method according to claim 1, wherein: The sending of the communication request to the IO device so that the IO device collects and feeds back communication data based on the communication request includes: The communication request is sent to the IO device so that the IO device parses the communication request. If the instruction corresponding to the communication request is a connection variable instruction, communication data is collected and the communication data is fed back.
4. The IO communication method according to claim 3, wherein: The sending of the communication request to the IO device so that the IO device parses the communication request, and if the instruction corresponding to the communication request is a connection variable instruction, collecting communication data and feeding back the communication data, includes: The communication request is sent to the IO device so that the IO device parses the communication request. If the instruction corresponding to the communication request is a connection variable instruction, the communication data in the display window and / or the communication data that needs to record historical data is collected, and the communication data is fed back.
5. The IO communication method according to claim 3, wherein: The sending of the communication request to the IO device so that the IO device collects and feeds back communication data based on the communication request includes: The communication request is sent to the IO device so that the IO device parses the communication request. If the instruction corresponding to the communication request is a variable value instruction, the latest communication data currently collected is fed back.
6. An IO communication device, characterized in that: The IO communication device includes: An acquisition module, configured to acquire addresses of a plurality of registers and data items to be collected corresponding to the respective registers; the plurality of registers may include registers of different types; A first combining module, configured to combine at least two consecutive target addresses to obtain a combined address segment if there are at least two consecutive target addresses among the multiple addresses; A second combining module is used to combine all the data items to be collected corresponding to the combined address segment to obtain an IO collection package; The encapsulation module is used to encapsulate the IO acquisition package to obtain a communication request; A sending module, configured to send the communication request to the IO device, so that the IO device collects and feeds back communication data based on the communication request; The second combination module is further configured to determine the priority corresponding to the data item in the IO acquisition package; set the highest priority among all priorities as the target priority; set the target priority as the priority of the IO acquisition package; and determine the acquisition frequency of the IO acquisition package based on the priority of the IO acquisition package; The first combination module is also used to determine whether the types of registers corresponding to at least two consecutive target addresses are the same; if the types of registers are the same, the at least two target addresses are combined to obtain a combined address segment; if the types of registers are different, if the addresses of at least two target addresses are consecutive, the at least two target addresses with consecutive addresses are combined to obtain a combined address segment.
7. An IO communication device, characterized in that: include: A processor, a memory, and an IO communication program stored in the memory, wherein the IO communication program implements the steps of the IO communication method according to any one of claims 1 to 5 when executed by the processor.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores an IO communication program, and when the IO communication program is executed by a processor, the IO communication method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Data processing method and related device
CN114036077A