Method for quickly configuring PLC Modbus slave station data
By building the Modbus slave protocol stack in the PLC and automatically importing the data point table, the frequent programming problem caused by the infixed PLC slave data points is solved, and the rapid configuration and efficient maintenance of Modbus slave data is realized.
Patent Information
- Application Number
- CN202411763989.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-03-07
AI Technical Summary
In Modbus communication, the PLC slave data points are not fixed, resulting in frequent reprogramming, downloading and debugging by development engineers, which increases the complexity of the workflow and inefficiency of workflows.
Build a Modbus slave protocol stack in PLC. The PLC automatically imports the Modbus data point table into the PLC program, and parses and extracts the information of the Modbus data point table through PLC to realize the rapid configuration of PLC Modbus slave data.
It realizes the rapid configuration of PLC Modbus slave data, reduces the complexity of development and maintenance, improves work efficiency, and makes the Modbus slave easy to maintain and modify.
Smart Images

Figure CN119583247A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of Modbus communication protocol, and in particular relates to a method for quickly configuring PLC Modbus slave station data. Background Art
[0002] Modbus is easy to use, highly scalable, and versatile, so it is widely used in the field of industrial control. Modbus is a master-slave protocol in which one device (master) sends requests to other devices (slaves), and the slaves respond to these requests. It can run on physical layers such as serial ports (such as RS-232, RS-485) and Ethernet, and supports different transmission media. The Modbus protocol is free to use, easy to get started, and easy to modify, and has become the implementation standard of communication protocols in the industrial field.
[0003] It connects to programmable logic controllers (PLCs), sensors, actuators and other devices to collect, transmit and process data. Through the Modbus protocol, remote monitoring, fault diagnosis and parameter adjustment of industrial automation systems can be achieved. In the manufacturing industry, Modbus is usually used to connect devices such as PLCs, sensors and actuators to achieve control and monitoring of automated production lines. In Modbus communication, the master station initiates data requests, and the slave station responds to the data requests. The slave station plays the role of a data server in Modbus communication, and is also called a server in some occasions.
[0004] When setting up Modbus communication, you need to consider the application scenario, determine the data points required in the scenario based on experience, and determine the Modbus data point table based on the data points. The data points serve as instructions in the subsequent master and slave stations, informing the master station of the data that the slave station can provide and the Modbus address to access the data. In the industrial control field, when the terminal equipment acts as a Modbus slave station, such as sensors and instruments, the functions are determined and the data point table is fixed, which is completed at one time when the product is developed.
[0005] When PLC participates in Modbus communication as a slave, its data points are not fixed because of the wide range of PLC application scenarios and the wide variety of equipment. The data required by the equipment needs to be implemented by the development engineer in PLC programming. In the PLC program, the business variables are mapped to the Modbus communication function block, and the Modbus communication function block serves as a data server. When the data point table is found to be inaccurate during equipment debugging, the development engineer needs to reprogram, download and debug the PLC. When the equipment is upgraded and the Modbus master station needs more data, or when certain data is adjusted, reprogramming is also required; especially when the PLC communicates with the host computer SCADA and local HMI via Modbus, because its data requirements are changeable, it will cause multiple writing and upgrading of the program.
[0006] Reprogramming to add or delete data points for Modbus can bring risks to program operation, lengthen workflows, and reduce work efficiency.
[0007] Therefore, the applicant hopes to seek technical solutions to improve the above technical problems. Summary of the invention
[0008] In view of this, the purpose of the present invention is to propose a method for quickly configuring PLC Modbus slave data, so as to realize the rapid configuration of PLC Modbus slave data and make the Modbus slave on PLC easy to maintain and modify.
[0009] To this end, the technical solution adopted in the present invention is as follows: A method for quickly configuring PLC Modbus slave data is disclosed. A Modbus slave protocol stack is built in the PLC. The PLC automatically imports the Modbus data point table into the PLC program. The information of the Modbus data point table is parsed and extracted by the PLC to realize the quick configuration of the PLC Modbus slave data.
[0010] Preferably, the Modbus data point table includes at least a function code, a variable name and a Modbus address.
[0011] Preferably, a Modbus slave protocol stack is built in the PLC, and the Modbus slave protocol is implemented by programming in the PLC.
[0012] Preferably, at least the following steps are included: S11) Build the Modbus slave protocol stack in the PLC; S12), compiling a data point table that complies with the Modbus specification and using it as the Modbus data point table; S13) PLC automatically imports the Modbus data point table into the PLC program; S14), after the PLC parses the information of the Modbus data point table, it extracts the variable name and Modbus address to make the variable accessible; S15), PLC converts the variable name into a memory address and maps it to a Modbus address, thereby realizing rapid configuration of PLC Modbus slave data.
[0013] Preferably, the following steps are also included between step S12) and step S13): S12a) Manually deploy the Modbus data point table file to the PLC; S13'), restart the PLC, and after the PLC is powered on, initialize the Modbus protocol.
[0014] Preferably, when there is a need to modify the Modbus data point table, the step S12) further comprises: modifying and updating the data point table that complies with the Modbus specification and using it as the Modbus data point table.
[0015] Preferably, the requirement to modify the Modbus data point table includes adding or deleting the Modbus data point table.
[0016] Preferably, the Modbus data point table not only serves as a communication bridge between the master station and the slave station, but also directly serves as a data configuration table of the PLC Modbus slave station, thereby efficiently ensuring data consistency.
[0017] The present invention proposes to build a Modbus slave station protocol stack in a PLC, the PLC automatically imports a Modbus data point table into a PLC program, and the PLC parses and extracts information of the Modbus data point table to realize rapid configuration of the PLC Modbus slave station data, so that the Modbus slave station implemented on the PLC becomes easy to maintain and easy to modify; when the present application is actually applied, a PLC program programming engineer only needs to complete the construction of the Modbus slave station once to complete the development work, and the program does not need to be adjusted for subsequent Modbus data changes; a PLC equipment operation and maintenance engineer only needs to modify the Modbus data point table to realize the addition and deletion of PLC Modbus slave station data, and realize rapid configuration of Modbus slave station data; by developing the Modbus slave station in this form, variables in the PLC program, including IO point variables and program intermediate variables, can be accessed arbitrarily, and the work efficiency is high. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1It is a flowchart of the steps of a method for quickly configuring PLC Modbus slave station data under a specific implementation mode of the present application. DETAILED DESCRIPTION
[0019] The embodiment of the present invention discloses a method for quickly configuring PLC Modbus slave station data. A Modbus slave station protocol stack is built in the PLC. The PLC automatically imports a Modbus data point table into a PLC program. The information of the Modbus data point table is parsed and extracted by the PLC to realize the quick configuration of the PLC Modbus slave station data.
[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in 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 recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] See also Figure 1 As shown, this embodiment provides a method for quickly configuring PLC Modbus slave station data, including the following steps: S11), building a Modbus slave protocol stack in the PLC, specifically implementing the Modbus slave protocol by programming in the PLC; S12), compile a data point table that complies with the Modbus specification and use it as the Modbus data point table, wherein the Modbus data point table at least includes a function code, a variable name and a Modbus address; when there is a need to modify the Modbus data point table, this step S12) also includes: modifying and updating the data point table that complies with the Modbus specification and using it as the Modbus data point table; wherein the need to modify the Modbus data point table includes adding or deleting the Modbus data point table; in Figure 1 In the example, this step S12) is abbreviated as "compile and modify the Modbus point table"; S12a) Manually deploy the Modbus data point table file to the PLC; Figure 1 In the example, this step S12a) is abbreviated as “deployment point table to PLC”; S13'), restart PLC (after PLC is powered on), and initialize Modbus protocol; S13) PLC automatically imports the Modbus data point table into the PLC program; Figure 1 In the example, this step S13) is abbreviated as "PLC import point table"; S14), after the PLC parses the information of the Modbus data point table, it extracts the variable name and Modbus address to make the variable accessible; Figure 1 In the example, this step S14) is abbreviated as "PLC analysis point table"; S15), PLC converts the variable name into a memory address and maps it to a Modbus address, thereby realizing rapid configuration of PLC Modbus slave data; Figure 1 In the example, this step S15) is abbreviated as "mapping variable memory address to Modbus address".
[0022] In this embodiment, the Modbus data point table not only serves as a communication bridge between the master station and the slave station, but also directly serves as a data configuration table of the PLC Modbus slave station, thereby efficiently ensuring data consistency.
[0023] When this embodiment 1 is actually applied, the PLC program programming engineer only needs to complete the construction of the Modbus slave station once to complete the development work, and the program does not need to be adjusted for subsequent Modbus data changes; the PLC equipment operation and maintenance engineer only needs to modify the Modbus data point table to implement the PLC Modbus slave station data addition and deletion work, and realize the rapid configuration of Modbus slave station data; by developing the Modbus slave station in this way, the variables in the PLC program can be arbitrarily accessed, including IO point variables and program intermediate variables, and the work efficiency is high.
[0024] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
[0025] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
Claims
1. A method for quickly configuring PLC Modbus slave data, characterized in that: Build a Modbus slave protocol stack in the PLC, and the PLC automatically imports the Modbus data point table into the PLC program. The PLC parses and extracts the information in the Modbus data point table to achieve rapid configuration of the PLC Modbus slave data.
2. The method for quickly configuring PLC Modbus slave station data according to claim 1, characterized in that: The Modbus data point table at least includes a function code, a variable name and a Modbus address.
3. The method for quickly configuring PLC Modbus slave station data according to claim 1, characterized in that: Build the Modbus slave protocol stack in PLC and implement the Modbus slave protocol by programming in PLC.
4. The method for quickly configuring PLC Modbus slave station data according to claim 1, characterized in that: At least the following steps are included: S11) Build the Modbus slave protocol stack in the PLC; S12), compiling a data point table that complies with the Modbus specification and using it as the Modbus data point table; S13) PLC automatically imports the Modbus data point table into the PLC program; S14), after the PLC parses the information of the Modbus data point table, it extracts the variable name and Modbus address to make the variable accessible; S15), PLC converts the variable name into a memory address and maps it to a Modbus address, thereby realizing rapid configuration of PLC Modbus slave data.
5. The method for quickly configuring PLC Modbus slave station data according to claim 4, characterized in that: The following steps are also included between step S12) and step S13): S12a) Manually deploy the Modbus data point table file to the PLC; S13'), restart the PLC, and after the PLC is powered on, initialize the Modbus protocol.
6. The method for quickly configuring PLC Modbus slave data according to claim 4, characterized in that In, When there is a need to modify the Modbus data point table, the step S12) further includes: modifying and updating the data point table that complies with the Modbus specification and using it as the Modbus data point table.
7. The method for quickly configuring PLC Modbus slave data according to claim 6, characterized in that In, The requirement for modifying the Modbus data point table includes adding or deleting the Modbus data point table.
8. The method for quickly configuring PLC Modbus slave station data according to claim 1, characterized in that In, The Modbus data point table not only serves as a communication bridge between the master station and the slave station, but also directly serves as a data configuration table of the PLC Modbus slave station, which efficiently ensures data consistency.