Communication mode of PLC lifting device and rotary table based on Modbus protocol

By using a custom protocol and Modbus-RTU protocol between the PLC and the touch screen, combined with Modbus Poll software, efficient communication between the PLC and the touch screen is achieved, solving the tedious problem of providing a separate serial port for the touch screen and parsing PLC instructions.

CN120802819APending Publication Date: 2025-10-17JIUJIANG PRECISION MEASURING TECH RES INST
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511109876.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-08
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In the prior art, the process of separately providing a serial port for the touch screen and parsing PLC instructions is cumbersome, resulting in inconvenience in communication between the PLC and the touch screen.

Method used

A customized protocol between the touch screen and DSP is adopted, combined with the Modbus-RTU protocol. The DSP is used as the master station and the PLC is used as the slave station for communication. Modbus Poll software is used for command debugging and parsing to realize the communication between the PLC and the touch screen.

Benefits of technology

It simplifies the communication process between PLC and touch screen, improves communication efficiency and accuracy, and realizes unified communication based on the same touch screen to issue control instructions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120802819A_ABST
    Figure CN120802819A_ABST
Patent Text Reader

Abstract

The invention discloses a communication mode of a PLC lifting device and a rotary table based on a Modbus protocol, and relates to the technical field of communication of the PLC lifting device and the rotary table, movement of a single-rotating-shaft rotary table is controlled by a touch screen, a DSP and a corresponding servo driver, and the lifting device is controlled by a debugging upper computer, a PLC and a corresponding servo driver; in order to uniformly issue a control command based on a touch screen, the control command is sent to the DSP main control chip through a specified touch screen communication protocol format, the DSP analyzes the control command and sends the control command to the PLC according to a Modbus-RTU protocol format, and finally, the servo driving unit controls the operation of the servo motor, so that the ascending and descending of the single-degree-of-freedom lifting device are realized. Therefore, the trouble that a serial port is independently provided for the touch screen and a PLC instruction is analyzed is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the communication technology field of PLC lifting device and rotary table, and particularly relates to a communication mode of PLC lifting device and rotary table based on Modbus protocol. BACKGROUND

[0002] The servo system is also called a follow-up system, belongs to an automatic control system, is used for controlling the position or angle of a controlled object, and makes the controlled object automatically, continuously and accurately reproduce the change rule of input instructions. The motion rotary table and the lifting device are typical servo systems, and the core of the servo system is a controller. The digital signal processor (DSP) and the programmable logic controller (PLC) are widely used controllers in the industrial control field. In particular, the DSP and the PLC are usually used together in some controls, and data transmission is performed between the two. The DSP has strong advantages in terms of operation speed and data processing. The PLC is widely used in industrial fields due to its convenient programming and strong anti-interference capability. The common communication protocols of the PLC include Modbus, Profibus, EtherNet / IP, Profinet and the like. These interfaces and protocols support efficient and stable communication between different devices and can meet the complex needs of the automatic control system. Different communication protocols are used between different controllers and the upper computer. In order to facilitate unification, the effective information needs to be parsed and packaged, so that the controllers can communicate completely and accurately, thereby completing the control of different servo systems. Based on this, the present application provides a communication mode of PLC lifting device and rotary table based on Modbus protocol, which solves the trouble of separately providing a serial port and parsing PLC instructions for the touch screen. SUMMARY

[0003] In view of the above technical problems, in order to unify the control commands based on the touch screen, the specified touch screen communication protocol format is sent to the DSP master control chip. After the DSP is parsed, the PLC is sent according to the Modbus-RTU protocol format. Finally, the operation of the servo motor is controlled through the servo drive unit, the lifting and lowering of the single-degree-of-freedom lifting device are realized, and the trouble of separately providing a serial port and parsing PLC instructions for the touch screen is solved.

[0004] The application uses the scheme that the lifting device is assembled on the single-shaft rotary table, the self-defined protocol is used between the touch screen and the DSP, the RS422 is used for the serial port, the Modbus protocol format of master station and slave station is used between the DSP and the PLC lifting mechanism, the DSP is taken as the master station, the PLC is taken as the slave station, the address 0x01, the interrupt mode is used between the two to respond the instruction frame and the response frame; the debugging of the lifting device is separately completed by the Modbus Poll software, after the connection is completed, the coil or the register can be read or written, the software can separately send various Modbus protocol instructions to the PLC, since the same touch screen needs to be based to send the control instruction, the software is suitable for debugging and summarizing all Modbus-RTU instructions, after the instructions are obtained, the communication format between the DSP and the PLC is obtained, the communication format is parsed and packed, and the communication between the PLC and the touch screen can be indirectly completed.

[0005] Further, the Modbus-RTU protocol communication features and processes include: one master and multiple slaves, only the master can initiate the request; only one data is transmitted at the same time, that is, in the unicast mode, the master sends the request, the slave responds, the master does not send, no data is transmitted, in the broadcast mode, the master sends, all slaves do not need to send the response, the protocol format is: slave address, function code, data and error check; the slave has only one lifting device, the realized function is enabling, disconnecting the enabling, zero resetting and walking position instruction, the stroke is 300mm, the slave address is 0x01.

[0006] Further, the communication basic parameters of the PLC are: the communication rate of 115200, the odd check bit, the station bit 1, the stop bit 1, the data length of 8bit, after the configuration is completed, the communication between the DSP can be carried out, the function code description of the Modbus-RTU protocol of the PLC is given in Table 1:

[0007] Table 1 Function code description

[0008] The address, type and authority of each coil and register in the PLC are shown in Table 2 and Table 3:

[0009] Table 2 Coil description

[0010] Table 3 Register description

[0011] With the slave address, function code and data, the last is to check the error, check is to ensure the integrity of the data in the transmission process, using a specified algorithm to calculate the original data, a check value; the PLC uses CRC check, there is a high and a low; the principle of CRC algorithm based on polynomial division, in the CRC check, the data is regarded as a coefficient of 0 or 1 polynomial sequence, and the CRC check code is obtained by using a predefined generator polynomial on the data polynomial modulo 2 division operation, here uses the commonly used CRC-16 algorithm, namely 0xA001 polynomial.

[0012] Therefore, there are host and slave request frame and response frame format, followed by the conversion to the touch screen and DSP between the request frame and response frame format, it should be noted that the communication protocol format between the touch screen and DSP is for the turntable, the defined format as shown in Figure 5 .

[0013] Here the protocol of the issued instructions and feedback instructions are three-axis turntable, so you can put the protocol in the inner shaft as the single axis rotation axis of the turntable, the protocol in the outer shaft as a lifting device. The stroke of the lifting device is 300mm, since the range of the shaft is 0~360°, therefore can be mm directly as ° to control, the lifting device as the outer shaft, the conversion relationship between them as shown in Figure 6 .

[0014] Lifting device used instructions have enable, disable, zero, position command, stop command and query the current position command, for example, the position command, the touch screen sends to the DSP request frame through the DSP package sent to the PLC Modbus protocol request frame part code for:

[0015] Uint16 RunCmd_Outer = pRecFram->Data

[31] ; / / Outer shaft movement mode

[0016] if(RunCmd_Outer == RS_CMD_RUN_POS)

[0017] {

[0018] GlobalSystem.LiftPosCmd = TRUE; / / Lifting device position command is set to TRUE

[0019] GlobalSystem.LiftPos = ByteToFloat(&pRecFram->Data

[32] ); / / Lifting device position command parameter 1

[0020] GlobalSystem.LiftSpd = ByteToFloat(&pRecFram->Data

[36] ); / / Lifting device position instruction parameter 2

[0021] GlobalSystem.LiftAcc = ByteToFloat(&pRecFram->Data

[40] ); / / Lifting device position command parameter 3

[0022] }

[0023] if(GlobalSystem.LiftPosCmd)

[0024] {

[0025] pSendFram->DataLength = 25; / / Total data length of the Modbus protocol frame

[0026] pSendFram->Data[i++] = 0x01; / / slave address

[0027] pSendFram->Data[i++] = 0x10; / / Function code

[0028] pSendFram->Data[i++] = 0x00; / / address starting high byte

[0029] pSendFram->Data[i++] = 0x66; / / Address starting low byte

[0030] pSendFram->Data[i++] = 0x00; / / high byte of register number

[0031] pSendFram->Data[i++] = 0x08; / / register number low byte

[0032] pSendFram->Data[i++] = 0x10; / / Number of bytes

[0033] FloatToByteLittle(GlobalSystem.LiftPos, &pSendFram->Data[i]); i +=FLOAT_SIZE; / / Data 1: target position

[0034] FloatToByteLittle(GlobalSystem.LiftSpd, &pSendFram->Data[i]); i +=FLOAT_SIZE; / / Data 2: target speed

[0035] FloatToByteLittle(GlobalSystem.LiftAcc, &pSendFram->Data[i]); i +=FLOAT_SIZE; / / Data 3: target acceleration

[0036] FloatToByteLittle(GlobalSystem.LiftAcc, &pSendFram->Data[i]); i +=FLOAT_SIZE; / / Data 4: target deceleration

[0037] pSendFram->Data[i++] =GetCRCData(&pSendFram->Data[0],23) & 0xFF; / / CRC check bit low

[0038] pSendFram->Data[i++] =(GetCRCData(&pSendFram->Data[0],23) >> 8) &0xFF; / / CRC checksum high bit

[0039] }

[0040] In order to keep track of the real-time position of the lifting device, it is necessary to continuously send current position query commands to the PLC. The interval here is set to query once every 10ms. Since the encoder used in the lifting device is an incremental encoder, it must be zeroed every time it is powered on. Therefore, after the DSP is powered on for a period of time, the DSP sends a frame of instructions to the PLC to enable zeroing. With the above preparations, the communication method between the touch screen and the lifting device can be summarized as follows:

[0041] (1) Power on the turntable control box, start the touch screen, and start the DSP. The program interrupt is triggered once every 1ms, and the time is counted according to the number of interruptions.

[0042] (2) Power on the lifting device control box within 5 seconds. The previous time is counted by the number of interruptions. At the 15th second, the program controls the DSP to give the lifting device an enable instruction, and at the 20th second, it gives the lifting device a change instruction.

[0043] (3) DSP sends a position query instruction to PLC at 10 ms intervals, and PLC gives a response frame of current position feedback, if the host computer has other instructions, the DSP will translate it into Modbus protocol and send it to PLC, and PLC will execute the corresponding operation and give a response frame.

[0044] (4) DSP analyzes all the response frames and feeds back to the touch screen according to the specified protocol format, and completes the synchronous display of the touch screen. The communication mode between the touch screen and the lifting device is shown in the flow chart as Figure 7 BRIEF DESCRIPTION OF DRAWINGS

[0045] Figure 1 is the control and communication structure diagram.

[0046] Figure 2 is the basic interface of Modbus Poll.

[0047] Figure 3 is the reading and writing of PLC coil or register.

[0048] Figure 4 is the debugging sending instruction.

[0049] Figure 5 is the communication protocol format between the touch screen and the DSP.

[0050] Figure 6 is the conversion relationship between the lifting device and the outer shaft.

[0051] Figure 7 is the communication mode between the touch screen and the lifting device. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the claimed present application, but only represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.

[0053] In this embodiment, the basic control and communication structure diagram is as shown in Figure 1 ​As shown, the lifting device is assembled on the single-axis rotary table, a self-defined protocol is used between the touch screen and the DSP, RS422 is used for the serial port, the Modbus protocol format of master-slave is used between the DSP and the PLC lifting mechanism, the DSP is taken as the master station, the PLC is taken as the slave station, the address is 0x01, and the interrupt mode is used between them to respond to the instruction frame and the response frame; the debugging of the lifting device is separately completed by the Modbus Poll software, the basic interface of the software is as shown in Figure 2 As shown, after the connection is completed, the coil or the register can be read or written, as shown in Figure 3 Through the software, various Modbus protocol instructions can be separately issued to the PLC, as shown in Figure 4 Since the control instructions need to be issued based on the same touch screen, the software is suitable for debugging and summarizing all Modbus-RTU instructions, after the instructions are obtained, the communication format between the DSP and the PLC is obtained, and the communication between the PLC and the touch screen can be indirectly completed by analyzing and packing the communication format.

[0054] Further, the Modbus-RTU protocol communication features and processes include: one master and multiple slaves, only the master can initiate a request; at the same time, only one data is in transmission, i.e. in unicast, the master sends a request, the slave responds, the master does not send, no data is in transmission, in broadcast, the master sends, all slaves do not need to send a response, the protocol format is: slave address, function code, data and error check; the slave has only one lifting device, the implemented functions are enable, disable, zero reset and position instruction, the stroke is 300mm, and the slave address is 0x01.

[0055] Further, the communication basic parameters of the PLC are: communication rate of 115200, even parity bit, station bit 1, stop bit 1, data length 8bit, after the configuration, the communication between the DSP and the PLC can be performed, and Table 1 shows the function code description of the Modbus-RTU protocol of the PLC:

[0056] Table 1 Function code description

[0057] The address, type and permission of each coil and register in the PLC are as shown in Table 2 and Table 3:

[0058] Table 2 Coil description

[0059] Table 3 Register description

[0060] With the slave address, function code and data, the last is to check the error, check is to ensure the integrity of the data in the transmission process, using a specified algorithm to calculate the original data, a check value; the PLC uses CRC check, there is a high and a low; the principle of CRC algorithm based on polynomial division, in the CRC check, the data is regarded as a coefficient of 0 or 1 polynomial sequence, and the CRC check code is obtained by using a predefined generator polynomial on the data polynomial modulo 2 division operation, here uses the commonly used CRC-16 algorithm, namely 0xA001 polynomial.

[0061] Therefore, there are host and slave request frame and response frame format, followed by the conversion to the touch screen and DSP between the request frame and response frame format, it should be noted that the communication protocol format between the touch screen and DSP is for the turntable, the defined format as shown in Figure 5 .

[0062] Here the protocol of the issued instructions and feedback instructions are three-axis turntable, so you can put the protocol in the inner shaft as the single axis rotation axis of the turntable, the protocol in the outer shaft as a lifting device. The stroke of the lifting device is 300mm, since the shaft range is 0~360°, so you can "mm" as "°" to control, the lifting device as the outer shaft, the conversion relationship between them as shown in Figure 6 .

[0063] Lifting device used instructions have enable, disable, zero, position command, stop command and query the current position command, for example, the position command, touch screen to DSP request frame after DSP packaging sent to the PLC Modbus protocol request frame part code is:

[0064] Uint16 RunCmd_Outer = pRecFram->Data

[31] ; / / Outer shaft movement mode

[0065] if(RunCmd_Outer == RS_CMD_RUN_POS)

[0066] {

[0067] GlobalSystem.LiftPosCmd = TRUE; / / Lifting device position command is TRUE

[0068] GlobalSystem.LiftPos = ByteToFloat(&pRecFram->Data

[32] ); / / Lifting device position command parameter 1

[0069] GlobalSystem.LiftSpd = ByteToFloat(&pRecFram->Data

[36] ); / / Lifting device position instruction parameter 2

[0070] GlobalSystem.LiftAcc = ByteToFloat(&pRecFram->Data

[40] ); / / Lifting device position command parameter 3

[0071] }

[0072] if(GlobalSystem.LiftPosCmd)

[0073] {

[0074] pSendFram->DataLength = 25; / / Total data length of the Modbus protocol frame

[0075] pSendFram->Data[i++] = 0x01; / / slave address

[0076] pSendFram->Data[i++] = 0x10; / / Function code

[0077] pSendFram->Data[i++] = 0x00; / / address starting high byte

[0078] pSendFram->Data[i++] = 0x66; / / Address starting low byte

[0079] pSendFram->Data[i++] = 0x00; / / high byte of register number

[0080] pSendFram->Data[i++] = 0x08; / / register number low byte

[0081] pSendFram->Data[i++] = 0x10; / / Number of bytes

[0082] FloatToByteLittle(GlobalSystem.LiftPos, &pSendFram->Data[i]); i +=FLOAT_SIZE; / / Data 1: target position

[0083] FloatToByteLittle(GlobalSystem.LiftSpd, &pSendFram->Data[i]); i +=FLOAT_SIZE; / / Data 2: target speed

[0084] FloatToByteLittle(GlobalSystem.LiftAcc, &pSendFram->Data[i]); i +=FLOAT_SIZE; / / Data 3: target acceleration

[0085] FloatToByteLittle(GlobalSystem.LiftAcc, &pSendFram->Data[i]); i +=FLOAT_SIZE; / / Data 4: target deceleration

[0086] pSendFram->Data[i++] =GetCRCData(&pSendFram->Data[0],23) & 0xFF; / / CRC check bit low

[0087] pSendFram->Data[i++] =(GetCRCData(&pSendFram->Data[0],23) >> 8) &0xFF; / / CRC checksum high bit

[0088] }

[0089] In order to keep track of the real-time position of the lifting device, it is necessary to continuously send current position query commands to the PLC. The interval here is set to query once every 10ms. Since the encoder used in the lifting device is an incremental encoder, it must be zeroed every time it is powered on. Therefore, after the DSP is powered on for a period of time, the DSP sends a frame of instructions to the PLC to enable zeroing. With the above preparations, the communication method between the touch screen and the lifting device can be summarized as follows:

[0090] (1) Power on the turntable control box, start the touch screen, and start the DSP. The program interrupt is triggered once every 1ms, and the time is counted according to the number of interruptions.

[0091] (2) Power on the lifting device control box within 5 seconds. The previous time is counted by the number of interruptions. At the 15th second, the program controls the DSP to give the lifting device an enable instruction, and at the 20th second, it gives the lifting device a change instruction.

[0092] (3) DSP sends a position query instruction to PLC at 10 ms intervals, and PLC gives a response frame with the current position feedback. If the host computer has other instructions, DSP translates them into Modbus protocol and sends them to PLC, which then executes the corresponding operation and gives a response frame.

[0093] (4) DSP analyzes all the response frames and feeds them back to the touch screen in the specified protocol format, completing the synchronous display of the touch screen. The communication mode flow chart between the touch screen and the lifting device is shown in Figure 7 .

Claims

1. A communication method between a PLC lifting device and a turntable based on the Modbus protocol, characterized by: The system includes a touch screen for inputting commands, a DSP, and a PLC lifting device mounted on a single-axis turntable. A custom protocol is used between the touch screen and the DSP, with the serial port adopting RS422. The DSP and the PLC use the Modbus protocol format of master and slave. The DSP acts as the master and the PLC as the slave, and they respond to command frames and response frames using interrupts. The lifting device is debugged solely using Modbus Poll software, which sends various Modbus-RTU protocol commands to the PLC. Control commands are sent based on the same touch screen, and the control commands are converted into the communication format between the DSP and the PLC. These communication formats are parsed and packaged to indirectly complete the communication between the PLC lifting device and the touch screen. The steps are as follows: Step 1: Power on the single-axis turntable control box, start the touch screen, start the DSP, and trigger the program interrupt once every 1ms. The time is counted according to the number of interrupts. Step 2: Power on the lifting device control box within 5 seconds. The previous timing is based on the number of interruptions. At the 15th second, the program controls the DSP to give the lifting device an enable instruction, and at the 20th second, it gives the lifting device a change instruction. Step 3: DSP sends position query instructions to PLC at 10ms intervals, and PLC gives a response frame of current position feedback. If the host computer has other instructions, DSP translates them into Modbus protocol and sends them to PLC, which then performs the corresponding operation and gives a response frame. Step 4: The DSP parses all response frames and feeds them back to the touch screen in accordance with the specified protocol format to complete the synchronous display of the touch screen.

2. The communication method between a PLC lifting device and a turntable based on the Modbus protocol according to claim 1, characterized in that: The Modbus-RTU protocol operates through one host and multiple slaves. Only the host can initiate a request. At the same time, only one data is transmitted. That is, the host sends a request and the slave responds. If the host does not send, no data is transmitted.

3. The communication method between the PLC lifting device and the turntable based on the Modbus protocol according to claim 1, characterized in that: The Modbus-RTU protocol format is: slave address, function code, data and error check; the slave has only one lifting device, which implements the functions of enabling, disconnecting, returning to zero and moving position instructions, and the slave address is 0x01.

4. The communication method between a PLC lifting device and a turntable based on the Modbus protocol according to claim 1, characterized in that: The basic communication parameters of the PLC are: communication rate of 115200, even parity bit, station bit 1, stop bit 1, data length 8 bits. Once configured, it can communicate with the DSP.

5. The communication method between the PLC lifting device and the turntable based on the Modbus protocol according to claim 3 is characterized in that: The error check is to ensure the integrity of data during transmission, and a specified algorithm is used to calculate the original data to obtain a check value.

6. The communication method between a PLC lifting device and a turntable based on the Modbus protocol according to claim 4, characterized in that: The PLC uses CRC check, which has a high bit and a low bit; the principle of the CRC algorithm is based on polynomial division. In CRC check, data is regarded as a polynomial sequence with coefficients of 0 or 1, and the CRC check code is obtained by using a predefined generating polynomial to perform modulo 2 division on the data polynomial, using the commonly used CRC-16 algorithm.

Citation Information

Cited By

  • Control method and system for synthesizing dihydrosphingosine based on catalytic hydrogenation

    CN121070116A