Driver PROFIdrive communication double mapping table access processing method
By establishing a dedicated PROFIdrive database and dual mapping tables, the PROFIdrive protocol stack and the underlying drive are decoupled, a standardized access interface is implemented, code compatibility and coupling issues are resolved, the ease of drive adaptation and expansion is improved, and development and maintenance costs are reduced.
Patent Information
- Application Number
- CN202511409201.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-29
- Publication Date
- 2026-01-13
AI Technical Summary
In existing technologies, the PROFIdrive protocol stack and the driver have low code compatibility and high coupling, lack standardized access interfaces, and have inflexible function access methods, resulting in high development complexity, difficult maintenance, and poor scalability.
Establish a dedicated PROFIdrive database and two mapping tables, including a general data mapping table and a data callback mapping table. Complex function access is achieved through callback functions, a standardized intermediate access layer is constructed, and the PROFIdrive protocol stack is decoupled from the underlying driver implementation.
It improves code compatibility and maintainability, reduces coupling, simplifies driver adaptation and secondary development, enhances system flexibility and scalability, and reduces development and maintenance costs.
Smart Images

Figure CN121326423A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of industrial automation control, and particularly relates to a PROFIdrive communication double-mapping table access processing method. BACKGROUND
[0002] PROFIdrive is a communication standard for drives and control systems in the field of industrial automation formulated by PI International (PROFIBUS & PROFINET International). It realizes efficient interoperability between drives of different manufacturers and upper control systems by unifying device behavior specifications and drive data access methods. The core advantage is cross-manufacturer interoperability.
[0003] However, in actual engineering application and secondary development, although the protocol itself is standard, developers still have the following technical problems:
[0004] Code compatibility and coupling problem: different types and manufacturers of drives have significant differences in internal data structure, function instruction set and parameter definition; the existing technical solutions (such as directly transplanting the AC1 / AC4 reference code provided by Siemens) usually hard-code and tightly couple the PROFIdrive protocol stack, drive function instructions and upper application logic; this leads to the need to modify or even rewrite the underlying access code when adapting PROFIdrive functions for new types of drives, the code reuse rate is extremely low, maintenance is difficult, and any modification may produce unpredictable chain reactions, with high debugging complexity.
[0005] Lack of standardized access interface: the host computer application lacks a unified and standardized interface to access drive functions; developers must deeply understand the underlying details of each drive and directly handle these differences at the application layer, resulting in redundant, complex code logic, poor readability and testability.
[0006] Non-data function access rigidity: for PROFIdrive functions that cannot be directly mapped to the original data of the drive (such as complex safety control, dynamic parameter adjustment, unit conversion, etc.), the existing technology lacks a flexible extension mechanism; developers often need to implement it through a non-standard path, further exacerbating the confusion of the system architecture and the coupling degree of the code.
[0007] Therefore, aiming at the above problems, the present application provides a driver PROFIdrive communication double mapping table access processing method, which establishes a PROFIdrive special database and two mapping tables, constructs a standardized intermediate access layer, solves the problems of low code compatibility and high coupling, realizes the access of complex functions through a callback function by using a mapping table mechanism, simplifies the driver adaptation and secondary development, and improves the code maintainability and scalability through a standardized interface and a clear mapping relationship. SUMMARY
[0008] In order to overcome the problems of low code compatibility, high coupling, lack of standardized access interface and inflexible function access mode of the PROFIdrive implementation method in the prior art in actual application.
[0009] The technical scheme of the present application is as follows: a driver PROFIdrive communication double mapping table access processing method, comprising the following steps:
[0010] S1: establishing a PROFIdrive special database, each item of data in the special database containing data index and read-write callback function reference;
[0011] S2: establishing a data general mapping table, the data general mapping table being used for storing the direct mapping relationship between the PROFIdrive data index and the internal data index of the driver;
[0012] establishing a data callback mapping table, the data callback mapping table being used for storing the mapping relationship between the PROFIdrive data index and the read-write callback function pointer for accessing the non-data function of the driver;
[0013] S3: receiving an access request from a PROFIdrive protocol stack through a unified read-write access interface, the access request containing at least a target PROFIdrive data index;
[0014] S4: querying the data general mapping table and the data callback mapping table according to the target PROFIdrive data index to determine the access type;
[0015] if a matched mapping relationship is found in the data general mapping table, directly accessing the corresponding data of the driver according to the internal data index obtained by mapping;
[0016] if a matched mapping relationship is found in the data callback mapping table, calling the read-write callback function obtained by mapping to indirectly access the corresponding function of the driver by executing the callback function.
[0017] The core of the present application is to establish a decoupled and standardized intermediate layer between PROFIdrive protocol and driver implementation through a double mapping table mechanism; specifically:
[0018] In the step of establishing PROFIdrive special database, a special database for PROFIdrive protocol stack module is established in the firmware of the driver, which is independent of the original database of the driver; each item in the database is defined with a unique data index and associated with a unified read-write callback function reference; the data access request of PROFIdrive protocol is directed to a unified intermediate entry point, laying the foundation for subsequent mapping and decoupling processing;
[0019] In the step of establishing double mapping table, two mapping tables with different functions are included:
[0020] a. Data general mapping table, which is used to process simple data that can be directly mapped; it is composed of multiple records, each record is a structure body PDrvToDrvMap, which contains two core members: PROFIdrive data index and driver internal data index; this table establishes a direct and one-to-one mapping relationship between PROFIdrive parameters and driver internal parameters;
[0021] b. Data callback mapping table, which is used to process complex functions that cannot be directly mapped; it is composed of multiple records, each record is a structure body PDrvToDrvCB, which contains three core members: PROFIdrive data index, read callback function pointer and write callback function pointer; this table establishes a mapping relationship between PROFIdrive parameters and callback functions of specific implementation functions;
[0022] In the step of calling unified read-write access interface, when the upper computer initiates a data read-write request to the driver through PROFIdrive protocol, the PROFIdrive protocol stack will call the unified read-write access interface defined in the special database; the interface receives two key parameters: target PROFIdrive data index and a data pointer for passing read-write data;
[0023] In the step of mapping query and access execution, the unified read-write access interface queries the above two mapping tables in turn according to the received target PROFIdrive data index to determine the final access path:
[0024] Direct data access: first, the data general mapping table is queried; if a matching PROFIdrive data index is found, the mapped internal drive data index is obtained, and then the internal data pointed to by the internal drive data index is directly read and written through the drive bottom interface; data is transmitted through the data pointer;
[0025] Callback function access: if no matching item is found in the data general mapping table, then the data callback mapping table is queried; if a matching PROFIdrive data index is found, the corresponding callback function pointer (read callback function pointer or write callback function pointer) is called according to the read and write operation type, and the data pointer is passed in as a parameter; the callback function internally encapsulates all necessary logic (such as unit conversion, calling specific instructions, security verification, etc.), representing PROFIdrive protocol to complete access to specific functions of the drive.
[0026] As a preferred, the data general mapping table is composed of multiple records, and each record is a structure body, which at least includes two members: a PROFIdrive data index member and a drive data index member; a single record structure body in the data general mapping table can also include other auxiliary members, such as data length, data type, etc., to enhance the accuracy and security of mapping.
[0027] As a preferred, the data callback mapping table is composed of multiple records, and each record is a structure body, which at least includes three members: a PROFIdrive data index member, a read callback function pointer member, and a write callback function pointer member; a single record structure body in the data callback mapping table can also include other auxiliary members, such as function parameter description, permission identification, etc., to ensure that the callback function is correctly and safely called.
[0028] As a preferred, the unified read and write access interface is configured to receive the target PROFIdrive data index and a data pointer; the data pointer points to the data to be written into the drive in the write operation, and points to the memory address for storing the data read from the drive in the read operation.
[0029] As a preferred, the step of accessing according to the access type specifically includes:
[0030] For write operation, if it is direct data access, the data obtained through the data pointer is written into the internal drive data mapped by the data general mapping table; if it is callback function access, the write callback function mapped by the data callback mapping table is called, and the data pointer is passed to the write callback function;
[0031] For read operation, if it is direct data access, data is read from the internal data of the driver mapped by the data general mapping table and returned through the data pointer; if it is callback function access, the read callback function mapped by the data callback mapping table is called, and data returned by the read callback function is obtained through the data pointer.
[0032] The workflow of the unified read-write access interface is further refined; for write operation, the interface obtains data to be written through the data pointer, and then writes the data directly into the driver data or passes the data to the write callback function according to the mapping query result; for read operation, the interface reads data from the driver data according to the mapping query result, and then fills the data into the memory pointed by the data pointer, or calls the read callback function and passes the data pointer to it to receive the returned data; this process is transparent to the PROFIdrive protocol stack, which only interacts with the standardized interface.
[0033] As a preferred, the read-write callback function is a pre-defined, independent of specific driver model, intermediate layer function, which encapsulates the access logic to the specific driver model or data inside.
[0034] As a preferred, when the read-write callback function in the data callback mapping table is called, the operation performed by the callback function includes one or a combination of the following: unit conversion, data format conversion, calling of special function instructions of the driver, or execution of safety control logic; the read-write callback function is a pre-developed and compiled intermediate layer function; this process completely encapsulates the complex, model-dependent logic in the callback function, and isolates it from the upper protocol stack.
[0035] As a preferred, the query process in step S5 follows a priority order, including:
[0036] The data general mapping table is queried first, and if no match is found, the data callback mapping table is queried.
[0037] An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the PROFIdrive communication double mapping table access processing method of the driver when executing the program.
[0038] A computer readable storage medium, having a computer program stored thereon, wherein the program is executable by a processor to implement the PROFIdrive communication double mapping table access processing method of the driver.
[0039] The beneficial effects of the present application are:
[0040] 1. The PROFIdrive protocol stack and the driver bottom layer are completely decoupled by introducing a double mapping table intermediate layer; the protocol stack only needs to face a fixed standardized interface and index work, and no longer cares about the specific details of the bottom driver; when adapting a new driver, the developer does not need to modify the protocol stack code, only needs to incrementally update the contents of the two mapping tables and write a small amount of necessary callback functions, realizes a code with multiple adaptation, the code reuse rate is extremely high, the coupling degree is significantly reduced, thereby improving the code compatibility and reducing the coupling degree;
[0041] 2. Since the core protocol stack code remains stable, adapting a new driver is simplified to configuring the mapping table and writing the callback function, which greatly reduces the complexity and workload of development, debugging and testing; especially in a project with multiple models of drivers in parallel, there is no need to write and maintain an independent protocol stack branch for each model, which reduces the growth rate of test cases, thereby significantly speeding up the product launch rhythm, reducing the labor and time cost, significantly shortening the research and development cycle and reducing the development cost;
[0042] 3. The double mapping table mechanism in the method of the application, especially the data callback mapping table, provides strong flexibility; for new functions or special functions of the driver, a PROFIdrive index can be defined and a callback function can be written to integrate, without modifying the system core architecture; this makes the system easily cope with the expansion and change of the functions of the driver in the future, and has strong scalability; thereby enhancing the flexibility and scalability of the system;
[0043] 4. The standardized access process and modular design make the code structure clear and the logic clear; the mapping table as a centralized configuration point makes the parameter mapping relationship and special processing logic obvious at a glance, greatly reducing the risk of configuration errors and subsequent maintenance difficulty; any function or driver change is isolated in a specific mapping table item or callback function, the influence range of the modification is controllable, making the system as a whole more stable and reliable. BRIEF DESCRIPTION OF DRAWINGS
[0044] Figure 1 A simple step flowchart of the driver PROFIdrive communication double mapping table access processing method of the application is shown;
[0045] Figure 2 A detailed step flowchart of the driver PROFIdrive communication double mapping table access processing method of the application is shown;
[0046] Figure 3 A specific implementation step flowchart of the driver PROFIdrive communication double mapping table access processing method embodiment 2 of the application is shown. DETAILED DESCRIPTION
[0047] The application will be further explained in connection with the accompanying drawings and examples.
[0048] Example 1
[0049] Referring to Figure 1 and Figure 2 , the application provides an embodiment: a PROFIdrive communication double-mapping table access processing method, comprising the following steps:
[0050] S1: establishing a PROFIdrive special database, each item of the special database containing an item index and a read-write callback function reference;
[0051] S2: establishing a data general mapping table, the data general mapping table being used to store the direct mapping relationship between the PROFIdrive item index and the internal item index of the driver;
[0052] establishing a data callback mapping table, the data callback mapping table being used to store the mapping relationship between the PROFIdrive item index and the read-write callback function pointer for accessing the non-data function of the driver;
[0053] S3: receiving an access request from the PROFIdrive protocol stack through a unified read-write access interface, the access request containing at least a target PROFIdrive item index;
[0054] S4: according to the target PROFIdrive item index, querying the data general mapping table and the data callback mapping table to determine the access type;
[0055] if a matched mapping relationship is found in the data general mapping table, then directly accessing the corresponding item of the driver according to the internal item index obtained through the mapping;
[0056] if a matched mapping relationship is found in the data callback mapping table, then calling the read-write callback function obtained through the mapping to indirectly access the corresponding function of the driver by executing the callback function.
[0057] The core of the application is to establish a decoupled and standardized intermediate layer between the PROFIdrive protocol and the specific implementation of the driver through a double-mapping table mechanism; specifically:
[0058] In the step of establishing the PROFIdrive special database, a special database independent of the original database of the driver is established for the PROFIdrive protocol stack module in the firmware of the driver; each item of data in the database is defined with a unique data index and is associated with a unified read-write callback function reference; the data access request of the PROFIdrive protocol is directed to a unified intermediate entry point, laying a foundation for subsequent mapping and decoupling processing;
[0059] In the step of establishing the double mapping table, two mapping tables with different functions are included:
[0060] a. The general data mapping table is used to process simple data that can be directly mapped; it is composed of multiple records, each of which is a structure body PDrvToDrvMap, including two core members: the PROFIdrive data index and the internal driver data index; this table establishes a direct and one-to-one mapping relationship between the PROFIdrive parameters and the internal driver parameters;
[0061] b. The data callback mapping table is used to process complex functions that cannot be directly mapped; it is composed of multiple records, each of which is a structure body PDrvToDrvCB, including three core members: the PROFIdrive data index, the read callback function pointer, and the write callback function pointer; this table establishes a mapping relationship between the PROFIdrive parameters and the callback functions of the specific implementation functions;
[0062] In the step of calling the unified read-write access interface, when the host computer initiates a data read-write request to the driver through the PROFIdrive protocol, the PROFIdrive protocol stack calls the unified read-write access interface defined in the special database; the interface receives two key parameters: the target PROFIdrive data index and a data pointer for transmitting read-write data;
[0063] In the step of mapping query and access execution, the unified read-write access interface queries the above two mapping tables in turn according to the received target PROFIdrive data index to determine the final access path:
[0064] Direct data access: first query the general data mapping table; if the matching PROFIdrive data index is found, the mapped internal driver data index is obtained, and then the read-write operation is performed on the internal data pointed to by the internal driver data index through the driver bottom interface; the data is transmitted through the data pointer;
[0065] Callback function access: if no match is found in the data general mapping table, then the data callback mapping table is queried; if a matching PROFIdrive data index is found, then a corresponding callback function pointer (read callback function pointer or write callback function pointer) is called according to the read-write operation type, and a data pointer is passed in as a parameter; the callback function internally encapsulates all necessary logic (such as unit conversion, calling specific instructions, security verification, etc.), and represents the PROFIdrive protocol to complete access to the specific functions of the drive.
[0066] Further, the data general mapping table is composed of multiple records, and each record is a structure body, which at least contains two members: a PROFIdrive data index member and a drive data index member; a single record structure body in the data general mapping table can also contain other auxiliary members, such as data length, data type, etc., to enhance the accuracy and security of mapping.
[0067] Further, the data callback mapping table is composed of multiple records, and each record is a structure body, which at least contains three members: a PROFIdrive data index member, a read callback function pointer member, and a write callback function pointer member; a single record structure body in the data callback mapping table can also contain other auxiliary members, such as function parameter description, permission identification, etc., to ensure that the callback function is correctly and safely called.
[0068] Further, the unified read-write access interface is configured to receive a target PROFIdrive data index and a data pointer; the data pointer points to the data to be written into the drive in the write operation, and points to the memory address used to store the data read from the drive in the read operation.
[0069] Further, the step of accessing according to the access type specifically includes:
[0070] For the write operation, if it is direct data access, the data obtained through the data pointer is written into the internal data of the drive mapped by the data general mapping table; if it is callback function access, the write callback function mapped by the data callback mapping table is called, and the data pointer is passed to the write callback function;
[0071] For the read operation, if it is direct data access, data is read from the internal data of the drive mapped by the data general mapping table, and returned through the data pointer; if it is callback function access, the read callback function mapped by the data callback mapping table is called, and the data returned by the read callback function is obtained through the data pointer.
[0072] The workflow of the unified read-write access interface is further refined; for write operation, the interface obtains the data to be written through a data pointer, and then according to the mapping query result, either directly writes the data into the driver data, or passes it to the write callback function for processing; for read operation, the interface, according to the mapping query result, either reads data from the driver data and fills it into the memory pointed by the data pointer, or calls the read callback function and passes the data pointer to it to receive the returned data; this process is transparent to the PROFIdrive protocol stack, which only interacts with the standardized interface.
[0073] Further, the read-write callback functions are pre-defined, intermediate layer functions independent of specific driver models, which encapsulate the access logic to the functions or data of specific driver models.
[0074] Further, when calling the read-write callback functions in the data callback mapping table, the operations performed by the callback functions include one or a combination of the following: unit conversion, data format conversion, calling of special function instructions of the driver, or execution of safety control logic.
[0075] The read-write callback functions are pre-developed and compiled intermediate layer functions; for example, a write callback function for handling speed setting, which can implement the following steps internally:
[0076] Obtain the speed value in RPM sent by the PROFIdrive protocol from the data pointer;
[0077] Convert the value according to the required unit of the driver model (e.g. 0.1 RPM);
[0078] Call a function specific to the driver model to issue the converted value;
[0079] This process completely encapsulates the complex, model-dependent logic in the callback function, isolating it from the upper protocol stack.
[0080] Further, the query process in step S5 follows a priority order, including:
[0081] First query the data general mapping table, and if no match is found, then query the data callback mapping table.
[0082] The query process can adopt an optimization strategy, for example, pre-labeling each PROFIdrive data index with its mapping table type, so as to avoid querying both tables every time and improve access efficiency.
[0083] An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements a PROFIdrive communication double-mapping table access processing method when executing the program.
[0084] A computer readable storage medium, having stored thereon a computer program, which, when executed by a processor, implements a driver PROFIdrive communication double mapping table access processing method.
[0085] Through the above steps, the PROFIdrive protocol stack and the driver bottom layer implementation are completely decoupled by introducing a double mapping table intermediate layer; the protocol stack only needs to face the fixed standardized interface and index work, and no longer cares about the specific details of the bottom driver; when adapting a new driver, the developer does not need to modify the protocol stack code, only needs to incrementally update the contents of the two mapping tables and write a small amount of necessary callback functions, realizes a code multiple adaptation, the code reuse rate is extremely high, and the coupling degree is significantly reduced, thereby improving the code compatibility and reducing the coupling degree; since the core protocol stack code remains stable, adapting a new driver is simplified to configuring the mapping table and writing the callback function, which greatly reduces the complexity and workload of development, debugging and testing; especially in a project with multiple models of drivers in parallel, there is no need to write and maintain independent protocol stack branches for each model, the test case growth rate is reduced, thereby significantly accelerating the product launch rhythm, reducing the manpower and time cost, significantly shortening the research and development cycle and reducing the development cost; the double mapping table mechanism in the method, especially the data callback mapping table, provides strong flexibility; for new functions or special functions of the driver, a PROFIdrive index can be defined and a callback function can be written to integrate, without modifying the system core architecture; this enables the system to easily cope with the expansion and changes of future driver functions, and the scalability is extremely strong; thereby enhancing the flexibility and scalability of the system; the standardized access process and modular design make the code structure clear and the logic clear; the mapping table as a centralized configuration point makes the parameter mapping relationship and special processing logic obvious, greatly reducing the risk of configuration errors and subsequent maintenance difficulty; any function or driver change is isolated in a specific mapping table item or callback function, the influence range of the modification is controllable, and the system as a whole is more stable and reliable.
[0086] Embodiment 2
[0087] Optionally, please refer to Figure 3 The embodiment provides an implementation mode of a driver PROFIdrive communication double mapping table access processing method, and the embodiment takes a servo driver (denoted as DrvA) supporting PROFIdrive communication as an example to illustrate in detail how to process the write request of an upper computer to a target rotating speed (PNU2-1) through a double mapping table mechanism.
[0088] The embodiment specifically implements the following steps:
[0089] S101: Establish a PROFIdrive special database;
[0090] In the firmware engineering of DrvA, a PROFIdrive_DataPool array is defined and initialized as a PROFIdrive special database; each item of the database is a structure, which is defined as follows:
[0091]
[0092]
[0093] The index (such as 0x2F01) in the database corresponds to the parameter number (PNU) defined by the PROFIdrive line rule one by one; at the same time, in the protocol stack configuration, the access interface function pointers of all parameters are all pointed to the uniform read-write access interface PDrv_Uniform_Access_Handler provided by the application.
[0094] S102: Establishing a double mapping table;
[0095] Firstly, the structure required by the mapping table is defined; specifically:
[0096] Defining the data general mapping table structure:
[0097]
[0098] Defining the data callback mapping table structure:
[0099]
[0100]
[0101] Subsequently, according to the characteristics of DrvA, the two mapping tables are initialized, specifically as follows:
[0102] Initialization of the data general mapping table:
[0103]
[0104] Initialization of the data callback mapping table:
[0105]
[0106] In this embodiment, 0x2F01 (target speed) is put into the callback mapping table, and its write callback function is specified as DrvA_Write_Target_Speed; this is because the internal speed unit of DrvA is 0.1 RPM, and the PROFIdrive protocol usually uses RPM, which needs to be converted.
[0107] S103: Calling the uniform read-write access interface;
[0108] When the host computer issues a command to write the target speed (PNU 2-1, value 1500 RPM), the PROFIdrive protocol stack parses the message and learns that it needs to write to index 0x2F01 with data 1500; the protocol stack then calls the uniform interface function:
[0109]
[0110]
[0111] In this embodiment, PDrv_Uniform_Access_Handler(0x2F01, &1500, TRUE) is called.
[0112] S104: Mapping query and access execution;
[0113] Query general mapping table: the interface traverses g_GeneralMapTable and does not find index 0x2F01, and turns to query the callback mapping table;
[0114] Query callback mapping table: traverse g_CallbackMapTable, find index 0x2F01, and the current is write operation (isWrite = TRUE), and its WriteFunc points to DrvA_Write_Target_Speed;
[0115] Execute callback function: the interface calls DrvA_Write_Target_Speed(0x2F01, &1500).
[0116] S105: Callback function processing;
[0117] The specific implementation of the callback function DrvA_Write_Target_Speed is as follows:
[0118]
[0119] At this point, a complete PROFIdrive write request processing is completed; the host computer thinks that it writes a standard PROFIdrive parameter, and the driver receives data in the format and unit it expects; the entire process is transparent to both parties, and all differences and special processing are digested by the double mapping table mechanism of the middle layer, achieving decoupling.
[0120] The embodiment clearly shows how to separate PROFIdrive protocol access and driver specific implementation through the double mapping table mechanism by the specific implementation. When a new driver DrvB needs to be adapted, if the speed unit of the new driver DrvB is also RPM, only 0x2F01 needs to be moved to the general mapping table and pointed to the internal address of DrvB, without the need to modify any protocol stack code. If DrvB has special processing requirements, a new callback function is written for it and configured into the mapping table, which greatly improves the compatibility and maintainability of the code.
[0121] The embodiments of the present application are described in detail above with reference to the drawings, but the present application is not limited to the above-described embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the spirit of the present application.
Claims
1. A method for handling dual-mapped table access in PROFIdrive communication for drivers, characterized in that: Includes the following steps: S1: Establish a dedicated database for PROFIdrive, where each item in the database contains a data index and read / write callback function references; S2: Establish a general data mapping table, which is used to store the direct mapping relationship between PROFIdrive data index and drive internal data index; Establish a data callback mapping table, which stores the mapping relationship between PROFIdrive data indexes and read / write callback function pointers used to access non-data functions of the drive; S3: Receive access requests from the PROFIdrive protocol stack through a unified read / write access interface, wherein the access request contains at least the target PROFIdrive data index; S4: Based on the target PROFIdrive data index, query the data general mapping table and the data callback mapping table to determine the access type; If a matching mapping relationship is found in the general data mapping table, the corresponding data of the drive is directly accessed based on the internal data index of the drive obtained from the mapping. If a matching mapping is found in the data callback mapping table, the read / write callback function obtained from the mapping is called, and the corresponding function of the driver is accessed indirectly by executing the callback function.
2. The driver PROFIdrive communication dual mapping table access processing method according to claim 1, characterized in that: The general data mapping table consists of multiple records, each of which is a structure containing at least two members: a PROFIdrive data index member and a drive data index member.
3. The driver PROFIdrive communication dual mapping table access processing method according to claim 1, characterized in that: The data callback mapping table consists of multiple records, each of which is a structure containing at least three members: a PROFIdrive data index member, a read callback function pointer member, and a write callback function pointer member.
4. The driver PROFIdrive communication dual mapping table access processing method according to claim 1, characterized in that: The unified read / write access interface is configured to receive the target PROFIdrive data index and a data pointer; the data pointer points to the data to be written to the drive during a write operation and to the memory address used to store the data read from the drive during a read operation.
5. The driver PROFIdrive communication dual mapping table access processing method according to claim 1, characterized in that: The steps for accessing based on access type specifically include: For write operations, if it is a direct data access, the data obtained through the data pointer is written to the internal data of the driver mapped by the data general mapping table; if it is a callback function access, the write callback function mapped by the data callback mapping table is called, and the data pointer is passed to the write callback function. For read operations, if it is a direct data access, the data is read from the internal data of the driver mapped by the general data mapping table and returned through the data pointer; if it is a callback function access, the read callback function mapped by the data callback mapping table is called and the data returned by the read callback function is obtained through the data pointer.
6. The driver PROFIdrive communication dual mapping table access processing method according to claim 1, characterized in that: The read / write callback function is a predefined, intermediate-level function that is independent of a specific driver model. It encapsulates the access logic for the functions or data of a specific driver model.
7. The driver PROFIdrive communication dual mapping table access processing method according to claim 6, characterized in that: When the read / write callback function in the data callback mapping table is invoked, the operation performed by the callback function includes one or a combination of the following: unit conversion, data format conversion, invoking the driver's dedicated function instructions, or executing security control logic.
8. The driver PROFIdrive communication dual mapping table access processing method according to claim 1, characterized in that: The query process described in step S5 follows a priority order, including: First, query the general mapping table of the data. If no matching item is found, then query the callback mapping table of the data.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the driver PROFIdrive communication dual mapping table access processing method as described in any one of claims 1-8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, this program implements the driver PROFIdrive communication dual mapping table access processing method as described in any one of claims 1-8.