A dual CPU data interaction method, device and system

By using the alternate acquisition and release mechanism of shared memory operation permissions between the control station CPU and the DP main station CPU, a secure data interaction is achieved, the risk of data leakage is solved, and the security of data transmission is improved.

CN112416849BActive Publication Date: 2024-11-26HANGZHOU HOLLYSYS AUTOMATION
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011342105.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-25
Publication Date
2024-11-26
Estimated Expiration
2040-11-25

AI Technical Summary

Technical Problem

In the field of industrial automation, there is a risk of data leakage in data interaction between the control station CPU and the DP master CPU. How to provide a dual CPU data interaction method with high security.

Method used

By obtaining the operation permissions of shared memory, the control station CPU and the DP main station CPU share the same shared memory, sending data input and output instructions, and alternately obtaining the release operation permissions, thereby storing and reading data in the shared memory, avoiding other devices from tampering with data. .

Benefits of technology

It effectively improves the security of data transmission, reduces the risk of data leakage, and ensures the integrity of data during the interaction process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112416849B_ABST
    Figure CN112416849B_ABST
Patent Text Reader

Abstract

The present invention discloses a dual-CPU data interaction method, wherein the control station CPU and the DP master station CPU can realize data interaction between the control station CPU and the DP master station CPU by sending corresponding instructions and alternately obtaining shared memory operation permissions. At the same time, when writing and reading data to the shared memory, the method can prevent other devices that cannot obtain operation permissions from tampering with the data, thereby greatly reducing the risk of data leakage and effectively improving the security of data transmission. The present invention also provides a dual-CPU data interaction device and a dual-CPU data interaction system, which also have the above-mentioned beneficial effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a dual-CPU data interaction method, a dual-CPU data interaction device and a dual-CPU data interaction system. Background Art

[0002] With the advancement of science and technology, industrial automation has achieved great development. In the field of industrial automation, it is usually necessary to set up peripheral devices to perform tasks such as data collection, and the peripheral devices are usually distributed. A DP (Decentralized Periphery) master station is usually set up on site to collect the parameters of the peripheral devices; at the same time, a control station is set up, which interacts with the DP master station to collect the parameters of each on-site device and perform related operations.

[0003] However, at the current stage, when the CPU (central processing unit) of the control station interacts with the CPU of the DP master station, there is a risk of data leakage. Therefore, how to provide a dual-CPU data interaction method with high security is an urgent problem that technicians in this field need to solve. Summary of the invention

[0004] The object of the present invention is to provide a dual-CPU data interaction method with high security; another object of the present invention is to provide a dual-CPU data interaction device and a dual-CPU data interaction system with high security.

[0005] In order to solve the above technical problems, the present invention provides a dual CPU data interaction method, which is applied to the control station CPU, comprising:

[0006] Obtaining the operation authority of the shared memory; the control station CPU and the DP main station CPU share the same shared memory;

[0007] Sending a data input instruction to the DP main station CPU and releasing the operation authority, so that the DP main station CPU obtains the operation authority according to the data input instruction, and inputs data to the shared memory storage according to the operation authority;

[0008] After sending a data input instruction to the DP master station CPU and releasing the operation authority, obtaining the operation authority released by the DP master station CPU, and reading the input data from the shared memory according to the operation authority;

[0009] Performing operations on the input data to obtain output data;

[0010] Outputting data to the shared memory storage according to the operation authority;

[0011] After outputting data to the shared memory storage according to the operation authority, a data output instruction is sent to the DP master station CPU and the operation authority is released, so that the DP master station CPU obtains the operation authority according to the data output instruction and reads the output data stored in the shared memory according to the operation authority.

[0012] Optionally, obtaining the shared memory operation permission includes:

[0013] When the operation cycle is reached, the shared memory operation permission is obtained.

[0014] Optionally, after outputting data to the shared memory storage according to the operation authority, sending a data output instruction to the DP master station CPU and releasing the operation authority so that the DP master station CPU obtains the operation authority according to the data output instruction, and reading the output data stored in the shared memory according to the operation authority includes:

[0015] After outputting data to the shared memory storage according to the operation authority, a data output instruction is sent to the DP master station CPU and the operation authority is released, so that the DP master station CPU obtains the operation authority according to the data output instruction, reads the output data stored in the shared memory according to the operation authority, and releases the operation authority after the DP master station CPU reads the output data.

[0016] Optionally, the input data is data collected by the DP master station CPU through various field devices.

[0017] Optionally, the usage record of the operation permission is stored in a configuration parameter area of ​​the shared memory.

[0018] The present invention also provides a dual-CPU data interaction device, which is applied to a control station CPU and includes:

[0019] The first acquisition module is used to obtain the operation authority of the shared memory; the control station CPU and the DP main station CPU share the same shared memory;

[0020] Input instruction module: used for sending data input instruction to the DP main station CPU and releasing the operation authority, so that the DP main station CPU obtains the operation authority according to the data input instruction, and inputs data to the shared memory storage according to the operation authority;

[0021] A second acquisition module is used for acquiring the operation authority released by the DP master station CPU after sending a data input instruction to the DP master station CPU and releasing the operation authority, and reading the input data from the shared memory according to the operation authority;

[0022] Operation module: used to operate on the input data to obtain output data;

[0023] Storage module: used for outputting data to the shared memory storage according to the operation authority;

[0024] Output instruction module: used for sending data output instructions to the DP master station CPU and releasing the operation authority after outputting data to the shared memory storage according to the operation authority, so that the DP master station CPU obtains the operation authority according to the data output instruction and reads the output data stored in the shared memory according to the operation authority.

[0025] The present invention also provides a dual-CPU data interaction method, which is applied to a DP master station CPU, comprising:

[0026] Obtaining a data input instruction and obtaining the operation authority of the shared memory according to the data input instruction; the DP main station CPU and the control station CPU share the same shared memory; the data input instruction is an instruction sent by the control station CPU when releasing the operation authority;

[0027] Writing input data to the shared memory according to the operation authority;

[0028] After writing the input data into the shared memory, releasing the operation permission;

[0029] Obtaining a data output instruction and obtaining the operation authority according to the data output instruction; the data output instruction is an instruction sent by the control station CPU after writing output data to the shared memory according to the acquired operation authority, and the output data is output data obtained by the control station CPU by calculating the input data;

[0030] The output data stored in the shared memory is read according to the operation permission.

[0031] Optionally, after reading the output data stored in the shared memory according to the operation authority, the method further includes:

[0032] Release the operation permission.

[0033] The present invention also provides a dual-CPU data interaction device, which is applied to a DP master station CPU, comprising:

[0034] The third acquisition module is used to acquire a data input instruction and acquire the operation authority of the shared memory according to the data input instruction; the DP main station CPU and the control station CPU share the same shared memory; the data input instruction is an instruction sent by the control station CPU when releasing the operation authority;

[0035] Writing module: used for writing input data into the shared memory according to the operation authority;

[0036] Release module: used for releasing the operation permission after writing input data into the shared memory;

[0037] A fourth acquisition module: used to acquire a data output instruction and acquire the operation authority according to the data output instruction; the data output instruction is an instruction sent by the control station CPU after writing output data to the shared memory according to the acquired operation authority, and the output data is output data obtained by the control station CPU by performing calculations based on the input data;

[0038] Reading module: used for reading the output data stored in the shared memory according to the operation authority.

[0039] The present invention also provides a dual-CPU data interaction system, comprising a control station CPU and a DP main station CPU, wherein the control station CPU and the DP main station CPU share the same shared memory;

[0040] The control station CPU is used for:

[0041] Obtain shared memory operation permissions;

[0042] Sending a data input instruction to the DP master station CPU and releasing the operation authority;

[0043] After sending a data input instruction to the DP master station CPU and releasing the operation authority, obtaining the operation authority released by the DP master station CPU, and reading the input data from the shared memory according to the operation authority;

[0044] Performing operations on the input data to obtain output data;

[0045] Outputting data to the shared memory storage according to the operation authority;

[0046] After outputting data to the shared memory storage according to the operation authority, sending a data output instruction to the DP master station CPU and releasing the operation authority;

[0047] The DP master station CPU is used for:

[0048] Obtaining a data input instruction and obtaining a shared memory operation permission according to the data input instruction;

[0049] Writing input data to the shared memory according to the operation authority;

[0050] After writing the input data into the shared memory, releasing the operation permission;

[0051] Obtaining a data output instruction and obtaining the operation authority according to the data output instruction;

[0052] The output data stored in the shared memory is read according to the operation permission.

[0053] A dual-CPU data interaction method provided by the present invention is applied to a control station CPU, comprising obtaining an operation authority of a shared memory; the control station CPU and a DP main station CPU share the same shared memory; sending a data input instruction to the DP main station CPU and releasing the operation authority, so that the DP main station CPU obtains the operation authority according to the data input instruction, and stores input data in the shared memory according to the operation authority; after sending the data input instruction to the DP main station CPU and releasing the operation authority, obtaining the operation authority released by the DP main station CPU, and reading input data from the shared memory according to the operation authority; performing operations on the input data to obtain output data; storing the output data in the shared memory according to the operation authority; after storing the output data in the shared memory according to the operation authority, sending a data output instruction to the DP main station CPU and releasing the operation authority, so that the DP main station CPU obtains the operation authority according to the data output instruction, and reads the output data stored in the shared memory according to the operation authority.

[0054] The control station CPU and the DP master station CPU can realize data interaction by sending corresponding instructions and alternately obtaining shared memory operation permissions. At the same time, when writing and reading data to the shared memory, this method can prevent other devices that cannot obtain operation permissions from tampering with the data, thereby greatly reducing the risk of data leakage and effectively improving the security of data transmission.

[0055] The present invention also provides a dual-CPU data interaction device and a dual-CPU data interaction system, which also have the above-mentioned beneficial effects and will not be described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0057] Figure 1 A flow chart of a dual CPU data interaction method provided by an embodiment of the present invention;

[0058] Figure 2 A structural block diagram of a dual CPU data interaction device provided by an embodiment of the present invention;

[0059] Figure 3 A flowchart of a specific dual CPU data interaction method provided by an embodiment of the present invention;

[0060] Figure 4 A structural block diagram of a specific dual-CPU data interaction device provided by an embodiment of the present invention;

[0061] Figure 5 The present invention provides a dual-CPU data interaction system according to an embodiment of the present invention. DETAILED DESCRIPTION

[0062] The core of the present invention is to provide a dual CPU data interaction method. In the prior art, the "mailbox method" is usually used for data communication, that is, the control station CPU puts the data into the mailbox address, and then notifies the DP master station CPU to read the data. At this time, the control station CPU will wait for the DP master station CPU to feedback the response in a query manner to confirm whether the DP master station CPU has received the mailbox data; the DP master station CPU will also put the data into the mailbox address, and then notify the control station CPU to read the data. At this time, the DP master station CPU will wait for the control station CPU to feedback the response in a query manner to confirm whether the control station CPU has received the mailbox data; in this way, a one-shot non-periodic data communication is completed. However, this communication method has the risk of data leakage when the CPU of the control station interacts with the CPU of the DP master station.

[0063] A dual-CPU data interaction method provided by the present invention is applied to the control station CPU, including obtaining the operation authority of the shared memory; the control station CPU and the DP main station CPU share the same shared memory; sending a data input instruction to the DP main station CPU and releasing the operation authority, so that the DP main station CPU obtains the operation authority according to the data input instruction, and stores the input data in the shared memory according to the operation authority; after sending the data input instruction to the DP main station CPU and releasing the operation authority, obtaining the operation authority released by the DP main station CPU, and reading the input data from the shared memory according to the operation authority; performing operations on the input data to obtain output data; storing the output data in the shared memory according to the operation authority; after storing the output data in the shared memory according to the operation authority, sending a data output instruction to the DP main station CPU and releasing the operation authority, so that the DP main station CPU obtains the operation authority according to the data output instruction, and reads the output data stored in the shared memory according to the operation authority.

[0064] The control station CPU and the DP master station CPU can realize data interaction by sending corresponding instructions and alternately obtaining shared memory operation permissions. At the same time, when writing and reading data to the shared memory, this method can prevent other devices that cannot obtain operation permissions from tampering with the data, thereby greatly reducing the risk of data leakage and effectively improving the security of data transmission.

[0065] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0066] Please refer to Figure 1 , Figure 1 The present invention provides a flowchart of a dual-CPU data interaction method.

[0067] In the embodiment of the present invention, the dual CPU data interaction method is specifically applied to the control station CPU. The method provided by the embodiment of the present invention is specifically a specific interaction mode between the control station CPU and the DP main station CPU.

[0068] See also Figure 1 , dual CPU data interaction methods include:

[0069] S101: Obtaining the shared memory operation permission.

[0070] In an embodiment of the present invention, the control station CPU and the DP main station CPU share the same shared memory. The usage record of the above-mentioned operation authority, such as which component is currently obtaining the operation authority, is usually stored in the preset configuration parameter area of ​​the shared memory, and only the device that obtains the operation authority can perform operations such as reading and writing data to the shared memory in the embodiment of the present invention. The above-mentioned shared memory is the shared memory of the control station CPU and the DP main station CPU. Under normal circumstances, only the control station CPU or the DP main station CPU is allowed to operate the shared memory to ensure the security of the data transmission process.

[0071] In this step, the control station CPU will specifically obtain the operation authority of the shared memory to ensure that the DP master station CPU can obtain the operation authority in the subsequent process. The specific content of the operation authority can refer to the existing technology and will not be repeated here.

[0072] This step can be specifically as follows: when the operation cycle is reached, the operation permission of the shared memory is obtained. That is, the embodiment of the present invention can be specifically applicable to the application scenario of "periodic data communication" between the control station CPU and the DP main station CPU, that is, the trigger condition of this step is that every time the time limit of an operation cycle is reached, the following process is executed, so that the control station CPU can operate on the data collected by the DP main station CPU. The specific duration of the operation cycle can be set according to the actual situation, and is not specifically limited here.

[0073] Of course, the data interaction method provided in the embodiment of the present invention is also applicable to "non-periodic data communication", that is, the interaction condition is event-triggered interaction, that is, data interaction is performed only in certain specific control scenarios, and data interaction is not performed at other times. The corresponding triggering condition of this step can be a preset triggering condition to be applicable to the communication scenario of "non-periodic data communication".

[0074] S102: Sending a data input instruction to the DP master station CPU and releasing the operation authority, so that the DP master station CPU obtains the operation authority according to the data input instruction, and inputs data to the shared memory storage according to the operation authority.

[0075] In this step, the control station CPU will send a data input instruction to the DP main station CPU and release the operation permission, so that when the DP main station CPU receives the data input instruction, it can obtain the operation permission of the shared memory according to the data input instruction, and further write the input data to the shared memory according to the operation permission, usually to the preset input data area in the shared memory.

[0076] In the embodiment of the present invention, the input data is usually the data collected by the DP master station CPU through various field devices, that is, the DP master station CPU usually collects data from various field devices as input data in a periodic manner, and in the embodiment of the present invention, the control station CPU can obtain the input data through the shared memory. The specific content of the input data can be set according to the actual situation and is not specifically limited here.

[0077] S103: After sending a data input instruction to the DP master station CPU and releasing the operation authority, obtaining the operation authority released by the DP master station CPU, and reading input data from the shared memory according to the operation authority.

[0078] It should be noted that after the DP master station CPU writes the input data to the shared memory, it needs to release the operation permission of the shared memory. In this step, the control station CPU will specifically obtain the operation permission released by the DP master station CPU, and then further read the input data from the shared memory based on the operation permission, thereby realizing the interaction of input data from the DP master station CPU to the control station CPU.

[0079] S104: Perform operation on the input data to obtain output data.

[0080] In this step, the control station CPU will specifically perform operations on the input data, and the operation will use the results of the operations as output data. The specific process of the above operations can be set according to actual conditions and is not specifically limited here.

[0081] S105: Outputting data to the shared memory storage according to the operation authority.

[0082] It should be noted that in S104, the control station CPU usually does not release the operation authority, so in this step, the output data can be further written into the shared memory according to the operation authority, usually into a preset output data area of ​​the shared memory.

[0083] S106: After outputting data to the shared memory storage according to the operation authority, a data output instruction is sent to the DP master station CPU and the operation authority is released, so that the DP master station CPU obtains the operation authority according to the data output instruction and reads the output data stored in the shared memory according to the operation authority.

[0084] In this step, after writing the output data into the shared memory, the control station CPU will send a data output instruction to the DP master station CPU and release the operation authority. After receiving the data output instruction, the DP master station CPU will obtain the operation authority and read the output data from the shared memory according to the operation authority. Furthermore, the DP master station CPU can also control various field devices according to the output data.

[0085] Normally, after the DP master station CPU reads the above output data, it is necessary to release the operation authority of the shared memory so as to execute the data interaction between the control station CPU and the DP master station CPU next time. That is, this step is usually specifically as follows: after storing the output data in the shared memory according to the operation authority, sending a data output instruction to the DP master station CPU and releasing the operation authority, so that the DP master station CPU obtains the operation authority according to the data output instruction, reads the output data stored in the shared memory according to the operation authority, and releases the operation authority after the DP master station CPU reads the output data.

[0086] In an embodiment of the present invention, the configuration parameter area usually also stores public information such as data attributes, which usually include the transmission direction of the above-mentioned input data, output data and other data, etc., which is used to indicate the identification information of the data flow direction in the shared memory, and is used to realize the data interaction between the control station CPU and the DP main station CPU.

[0087] A dual-CPU data interaction method provided in an embodiment of the present invention can realize data interaction between the control station CPU and the DP master station CPU by sending corresponding instructions and alternately obtaining shared memory operation permissions. At the same time, when writing and reading data to the shared memory, the method can prevent other devices that cannot obtain operation permissions from tampering with the data, thereby greatly reducing the risk of data leakage and effectively improving the security of data transmission.

[0088] A dual-CPU data interaction device provided by an embodiment of the present invention is introduced below. The dual-CPU data interaction device described below and the dual-CPU data interaction method described above can be referred to each other.

[0089] Figure 2 This is a structural block diagram of a dual-CPU data interaction device provided by an embodiment of the present invention. The dual-CPU data interaction device is applied to a control station CPU to implement interaction between the control station CPU and the DP main station CPU.

[0090] Reference Figure 2 , the dual CPU data interaction device may include:

[0091] The first acquisition module 100 is used to acquire the operation authority of the shared memory; the control station CPU and the DP main station CPU share the same shared memory.

[0092] Input instruction module 200: used to send a data input instruction to the DP main station CPU and release the operation authority, so that the DP main station CPU obtains the operation authority according to the data input instruction, and inputs data to the shared memory according to the operation authority.

[0093] The second acquisition module 300 is used to acquire the operation authority released by the DP master station CPU after sending a data input instruction to the DP master station CPU and releasing the operation authority, and read the input data from the shared memory according to the operation authority.

[0094] Operation module 400: used to operate on the input data to obtain output data.

[0095] Storage module 500: used to output data to the shared memory storage according to the operation authority.

[0096] Output instruction module 600: used to send a data output instruction to the DP master station CPU and release the operation authority after outputting data to the shared memory storage according to the operation authority, so that the DP master station CPU obtains the operation authority according to the data output instruction and reads the output data stored in the shared memory according to the operation authority.

[0097] Preferably, in the embodiment of the present invention, the first acquisition module 100 is specifically used for:

[0098] When the operation cycle is reached, the shared memory operation permission is obtained.

[0099] Preferably, in the embodiment of the present invention, the output instruction module 600 is specifically used for:

[0100] After outputting data to the shared memory storage according to the operation authority, a data output instruction is sent to the DP master station CPU and the operation authority is released, so that the DP master station CPU obtains the operation authority according to the data output instruction, reads the output data stored in the shared memory according to the operation authority, and releases the operation authority after the DP master station CPU reads the output data.

[0101] Preferably, in an embodiment of the present invention, the input data is data collected by the DP master station CPU through various field devices.

[0102] Preferably, in an embodiment of the present invention, the usage record of the operation authority is stored in a configuration parameter area of ​​the shared memory.

[0103] The dual-CPU data interaction device of this embodiment is used to implement the aforementioned dual-CPU data interaction method. Therefore, the specific implementation method of the dual-CPU data interaction device can be seen in the embodiment part of the dual-CPU data interaction method in the previous text. For example, the first acquisition module 100, the input instruction module 200, the second acquisition module 300, the operation module 400, the storage module 500, and the output instruction module 600 are respectively used to implement steps S101, S102, S103, S104, S105 and S106 in the aforementioned dual-CPU data interaction method. Therefore, its specific implementation method can refer to the description of the corresponding embodiments of each part, which will not be repeated here.

[0104] Please refer to Figure 3 , Figure 3 The present invention provides a flowchart of a specific dual-CPU data interaction method.

[0105] In the embodiment of the present invention, the dual CPU data interaction method is specifically applied to the DP master station CPU. The method provided by the embodiment of the present invention is specifically a specific interaction mode between the control station CPU and the DP master station CPU.

[0106] See also Figure 3 , dual CPU data interaction methods include:

[0107] S201: Obtain a data input instruction and obtain the operation permission of the shared memory according to the data input instruction.

[0108] In an embodiment of the present invention, the DP station CPU and the control station CPU share the same shared memory; the data input instruction is an instruction sent by the control station CPU when releasing the operation authority. The control station CPU needs to obtain the operation authority of the shared memory first, and the control station CPU can obtain the operation authority of the shared memory every time the operation cycle is reached. After the control station CPU obtains the operation authority, it can send a data input instruction to the DP station CPU, and in this step, the DP station CPU can obtain the operation authority of the shared memory according to the data input instruction.

[0109] The usage records of the above-mentioned operation permissions, such as which component currently obtains the operation permissions, are usually stored in the preset configuration parameter area of ​​the shared memory, and the configuration parameter area usually also stores public information such as data attributes. The data attributes usually include the transmission direction of the above-mentioned input data, output data and other data, etc., which are used to indicate the identification information of the data flow direction in the shared memory, and are used to realize the data interaction between the control station CPU and the DP main station CPU.

[0110] S202: Writing input data to the shared memory according to the operation authority.

[0111] In this step, the DP master station CPU will write input data to the shared memory according to the operation authority. The specific content of the input data has been described in detail in the above-mentioned embodiment of the invention, and will not be repeated here. The above-mentioned input data is usually the data collected by the DP master station CPU through various field devices, that is, the above-mentioned DP master station CPU usually collects data from various field devices as input data in a periodic manner, and in the embodiment of the present invention, the control station CPU can obtain the input data through the shared memory.

[0112] S203: After writing the input data into the shared memory, releasing the operation permission.

[0113] In this step, the DP master station CPU will release the operation authority again, so that the control station CPU can obtain the operation authority again to read the input data.

[0114] S204: Obtain a data output instruction and obtain an operation permission according to the data output instruction.

[0115] In the embodiment of the present invention, the data output instruction is an instruction sent by the control station CPU after writing output data to the shared memory according to the acquired operation authority, and the output data is output data obtained by the control station CPU by calculating the input data.

[0116] After obtaining the input data, the control station CPU will perform certain operations to obtain the output data, and write the output data into the shared memory according to the control authority, and then release the control authority and send the data output instruction to the DP master station CPU. In this step, the DP master station CPU will obtain the operation authority according to the data output instruction so as to carry out the following steps.

[0117] S205: Read the output data stored in the shared memory according to the operation authority.

[0118] In this step, the output data written in the shared memory will be read according to the operation authority to realize the data interaction between the control station CPU and the DP master station CPU.

[0119] After this step, it is usually necessary to release the operation authority so that the next data interaction between the control station CPU and the DP master station CPU can be carried out.

[0120] It should be noted that the dual-CPU data interaction method provided in the embodiment of the present invention and the dual-CPU data interaction method provided in the above-mentioned invention embodiment can refer to each other. The two methods act on the control station CPU and the DP master station CPU respectively, and correspond to each other to jointly realize the data interaction between the control station CPU and the DP master station CPU. Therefore, its specific implementation method can refer to the description of the corresponding parts of the embodiments, which will not be repeated here.

[0121] A dual-CPU data interaction device provided by an embodiment of the present invention is introduced below. The dual-CPU data interaction device described below and the dual-CPU data interaction method described above can be referred to each other.

[0122] Figure 4 The present invention provides a specific structural block diagram of a dual-CPU data interaction device provided in an embodiment of the present invention. The dual-CPU data interaction device is applied to a DP master station CPU to implement interaction between a control station CPU and a DP master station CPU.

[0123] Reference Figure 4 , the dual CPU data interaction device may include:

[0124] The third acquisition module 700 is used to obtain data input instructions and obtain the operation authority of the shared memory according to the data input instructions; the DP main station CPU and the control station CPU share the same shared memory; the data input instruction is the instruction sent by the control station CPU when releasing the operation authority.

[0125] Writing module 800: used for writing input data into the shared memory according to the operation authority.

[0126] Release module 900: used to release the operation permission after writing input data into the shared memory.

[0127] The fourth acquisition module 1000 is used to obtain a data output instruction and obtain the operation authority according to the data output instruction; the data output instruction is an instruction sent by the control station CPU after writing output data to the shared memory according to the obtained operation authority, and the output data is output data obtained by the control station CPU according to the input data.

[0128] Reading module 1100: used for reading the output data stored in the shared memory according to the operation authority.

[0129] Preferably, in an embodiment of the present invention, the data input instruction is specifically an instruction sent by the control station CPU when releasing the operation authority after acquiring the operation authority of the shared memory every time an operation cycle is reached.

[0130] Preferably, in the embodiment of the present invention, it also includes:

[0131] Secondary release module: used for releasing the operation permission after reading the output data.

[0132] Preferably, in an embodiment of the present invention, the input data is data collected by the DP master station CPU through various field devices.

[0133] Preferably, in an embodiment of the present invention, the usage record of the operation authority is stored in a configuration parameter area of ​​the shared memory.

[0134] The dual-CPU data interaction device of this embodiment is used to implement the aforementioned dual-CPU data interaction method. Therefore, the specific implementation of the dual-CPU data interaction device can be seen in the embodiment of the dual-CPU data interaction method in the previous text. For example, the third acquisition module 700, the write module 800, the release module 900, the fourth acquisition module 1000, and the read module 1100 are respectively used to implement steps S201, S202, S203, S204 and S205 in the aforementioned dual-CPU data interaction method. Therefore, its specific implementation can refer to the description of the corresponding embodiments of each part, which will not be repeated here.

[0135] A dual CPU data interaction system provided by an embodiment of the present invention is introduced below. The dual CPU data interaction system described below and the dual CPU data interaction method and dual CPU data interaction device described above can be referred to each other.

[0136] Figure 5 A structural block diagram of a dual CPU data interaction system provided by an embodiment of the present invention, referring to Figure 5 The dual-CPU data interaction system includes a control station CPU 11 and a DP main station CPU 12, and the control station CPU 11 and the DP main station CPU 12 share the same shared memory.

[0137] The control station CPU 11 is used for:

[0138] Obtain shared memory operation permissions.

[0139] Send a data input instruction to the DP master station CPU 12 and release the operation authority.

[0140] After sending a data input instruction to the DP master station CPU 12 and releasing the operation authority, the operation authority released by the DP master station CPU 12 is obtained, and the input data is read from the shared memory according to the operation authority.

[0141] The input data is operated to obtain output data.

[0142] Output data to the shared memory storage according to the operation authority.

[0143] After outputting the data to the shared memory storage according to the operation authority, a data output instruction is sent to the DP master station CPU 12 and the operation authority is released.

[0144] The DP master station CPU 12 is used for:

[0145] A data input instruction is obtained and operation permission of the shared memory is obtained according to the data input instruction.

[0146] Input data is written to the shared memory according to the operation permission.

[0147] After writing the input data into the shared memory, the operation permission is released.

[0148] Obtain a data output instruction and obtain the operation permission according to the data output instruction.

[0149] The output data stored in the shared memory is read according to the operation permission.

[0150] Preferably, in the embodiment of the present invention, the control station CPU 11 is specifically used for:

[0151] When the operation cycle is reached, the shared memory operation permission is obtained.

[0152] Preferably, in the embodiment of the present invention, the DP master station CPU 12 is also used for:

[0153] After reading the output data stored in the shared memory according to the operation authority, releasing the operation authority.

[0154] Preferably, in the embodiment of the present invention, the input data is data collected by the DP master station CPU 12 through various field devices.

[0155] Preferably, in an embodiment of the present invention, the usage record of the operation authority is stored in a configuration parameter area of ​​the shared memory.

[0156] The dual CPU data interaction system of this embodiment is used to install the aforementioned dual CPU data interaction device and implement the aforementioned dual CPU data interaction method. Therefore, the specific implementation of the dual CPU data interaction system can be seen in the embodiment of the dual CPU data interaction method in the foregoing text. Therefore, its specific implementation can refer to the description of the corresponding various partial embodiments, which will not be repeated here.

[0157] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0158] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0159] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0160] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0161] The above is a detailed introduction to a dual CPU data interaction method, a dual CPU data interaction device and a dual CPU data interaction system provided by the present invention. Specific examples are used herein to illustrate the principle and implementation of the present invention, and the description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.

Claims

1. A dual CPU data interaction method, characterized in that: Applicable to control station CPU, including: When the operation cycle is reached, the operation permission of the shared memory is obtained; the control station CPU and the DP main station CPU share the same shared memory; Sending a data input instruction to the DP master station CPU and releasing the operation authority, so that the DP master station CPU obtains the operation authority according to the data input instruction, and stores input data to the shared memory according to the operation authority; only the device that obtains the operation authority can read and write data to the shared memory; the input data is the data collected by the DP master station CPU through various field devices; After sending a data input instruction to the DP master station CPU and releasing the operation authority, obtaining the operation authority released by the DP master station CPU, and reading the input data from the shared memory according to the operation authority; Performing operations on the input data to obtain output data; Outputting data to the shared memory storage according to the operation authority; After outputting data to the shared memory storage according to the operation authority, sending a data output instruction to the DP master station CPU and releasing the operation authority, so that the DP master station CPU obtains the operation authority according to the data output instruction, reads the output data stored in the shared memory according to the operation authority, and releases the operation authority after the DP master station CPU reads the output data; The usage record of the operation permission is stored in the configuration parameter area of ​​the shared memory, and the configuration parameter area also stores identification information for indicating the data flow direction in the shared memory.

2. A dual CPU data interaction device, characterized in that: Applicable to control station CPU, including: The first acquisition module is used to acquire the operation authority of the shared memory when the operation cycle is reached; the control station CPU and the DP main station CPU share the same shared memory; Input instruction module: used to send data input instructions to the DP master station CPU and release the operation authority, so that the DP master station CPU obtains the operation authority according to the data input instruction, and stores input data to the shared memory according to the operation authority; only the device that obtains the operation authority can read and write data to the shared memory; the input data is the data collected by the DP master station CPU through various field devices; A second acquisition module is used for acquiring the operation authority released by the DP master station CPU after sending a data input instruction to the DP master station CPU and releasing the operation authority, and reading the input data from the shared memory according to the operation authority; Operation module: used to operate on the input data to obtain output data; Storage module: used for outputting data to the shared memory storage according to the operation authority; Output instruction module: used for sending a data output instruction to the DP master station CPU and releasing the operation authority after outputting data to the shared memory storage according to the operation authority, so that the DP master station CPU obtains the operation authority according to the data output instruction, reads the output data stored in the shared memory according to the operation authority, and releases the operation authority after the DP master station CPU reads the output data; The usage record of the operation permission is stored in the configuration parameter area of ​​the shared memory, and the configuration parameter area also stores identification information for indicating the data flow direction in the shared memory.

3. A dual CPU data interaction method, characterized in that: Applicable to DP master station CPU, including: Obtaining a data input instruction and obtaining the operation authority of the shared memory according to the data input instruction; the DP main station CPU and the control station CPU share the same shared memory; the data input instruction is an instruction sent by the control station CPU when the operation cycle is reached, after obtaining the operation authority of the shared memory, and releasing the operation authority; Write input data to the shared memory according to the operation authority; only the device that obtains the operation authority can read and write data to the shared memory; the input data is the data collected by the DP master station CPU through various field devices; After writing the input data into the shared memory, releasing the operation permission; Obtaining a data output instruction and obtaining the operation authority according to the data output instruction; the data output instruction is an instruction sent by the control station CPU after writing output data to the shared memory according to the acquired operation authority, and the output data is output data obtained by the control station CPU by calculating the input data; Read the output data stored in the shared memory according to the operation authority, and then release the operation authority; The usage record of the operation permission is stored in the configuration parameter area of ​​the shared memory, and the configuration parameter area also stores identification information for indicating the data flow direction in the shared memory.

4. A dual CPU data interaction device, characterized in that: Applicable to DP master station CPU, including: The third acquisition module is used to acquire a data input instruction and acquire the operation authority of the shared memory according to the data input instruction; the DP main station CPU and the control station CPU share the same shared memory; the data input instruction is an instruction sent by the control station CPU when the operation cycle is reached, after acquiring the operation authority of the shared memory, and releasing the operation authority; Writing module: used to write input data to the shared memory according to the operation authority; only the device that obtains the operation authority can read and write data to the shared memory; the input data is the data collected by the DP master station CPU through various field devices; Release module: used for releasing the operation permission after writing input data into the shared memory; A fourth acquisition module: used to acquire a data output instruction and acquire the operation authority according to the data output instruction; the data output instruction is an instruction sent by the control station CPU after writing output data to the shared memory according to the acquired operation authority, and the output data is output data obtained by the control station CPU by performing calculations based on the input data; Reading module: used for reading the output data stored in the shared memory according to the operation authority, and then releasing the operation authority; The usage record of the operation permission is stored in the configuration parameter area of ​​the shared memory, and the configuration parameter area also stores identification information for indicating the data flow direction in the shared memory.

5. A dual CPU data interaction system, characterized in that: It includes a control station CPU and a DP main station CPU, wherein the control station CPU and the DP main station CPU share the same shared memory; The control station CPU is used for: When the operation cycle is reached, the shared memory operation permission is obtained; Sending a data input instruction to the DP master station CPU and releasing the operation authority; After sending a data input instruction to the DP master station CPU and releasing the operation authority, the operation authority released by the DP master station CPU is obtained, and input data is read from the shared memory according to the operation authority; only the device that obtains the operation authority can read and write data to the shared memory; Performing operations on the input data to obtain output data; Outputting data to the shared memory storage according to the operation authority; After outputting data to the shared memory storage according to the operation authority, sending a data output instruction to the DP master station CPU and releasing the operation authority; The DP master station CPU is used for: Obtaining a data input instruction and obtaining a shared memory operation permission according to the data input instruction; Write input data to the shared memory according to the operation authority; the input data is data collected by the DP master station CPU through various field devices; After writing the input data into the shared memory, releasing the operation permission; Obtaining a data output instruction and obtaining the operation authority according to the data output instruction; Read the output data stored in the shared memory according to the operation authority, and then release the operation authority; The usage record of the operation permission is stored in the configuration parameter area of ​​the shared memory, and the configuration parameter area also stores identification information for indicating the data flow direction in the shared memory.