A method for interrupting a call for motion control through an ethercat bus
By calling the motion control method through the EtherCAT bus interrupt, the EtherCAT bus master controller enters the bus cycle interrupt and calls the user-written C language algorithm, which solves the problem that the controller needs to be repackaged or replaced in the existing technology, realizes high-precision and fast-response motion control, and improves the controller's versatility and cost-effectiveness.
Patent Information
- Application Number
- CN202211089107.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-07
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2042-09-07
AI Technical Summary
Existing PLC programmable controllers or motion controllers with EtherCAT bus functionality often require manufacturers to repackage or replace the controller for complex calculations or motion control functions, increasing costs and making it difficult to meet accuracy requirements, while also causing inconvenience for users in developing underlying calculations.
The motion control method is invoked via an EtherCAT bus interrupt. The EtherCAT bus master controller enters a bus cycle interrupt, calls a user-written C language motion control algorithm through a ladder diagram program, and sends the calculation results to the slave servo driver with a synchronization period of 1ms, thereby realizing real-time data communication and motion control.
It enables user-level low-level computational development, meets the requirements of versatility and accuracy, has high precision and fast response, is not affected by the program scanning cycle, and has a high cost performance.
Smart Images

Figure CN116185926B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of motion control, and in particular to a method for invoking motion control via an EtherCAT bus interrupt. Background Technology
[0002] EtherCAT is a mainstream bus communication protocol in industrial Ethernet. It is a fieldbus system based on Ethernet and has been widely used in automation due to its simple structure, fast data transmission speed and high real-time performance.
[0003] When dealing with complex computational or motion control functions, PLCs or motion controllers with EtherCAT bus functionality commonly employ a method where the controller manufacturer encapsulates the functionality, allowing users to directly call the instructions to execute existing functions. However, when the controller's inherent functionality fails to meet user needs, the user typically contacts the manufacturer to modify the functionality and re-encapsulate it. In such cases, the manufacturer needs development time, thus delaying the user's product development. Alternatively, a more comprehensive controller product might be chosen, but this significantly increases costs. Some users write algorithms in C language and call them via ladder diagrams, but this often fails to meet the required accuracy. Therefore, existing solutions become quite passive when the goal is to maintain accuracy without increasing costs. Summary of the Invention
[0004] The main objective of this invention is to overcome the aforementioned deficiencies in the prior art and propose a method for motion control via EtherCAT bus interrupt, which enables user-level computational development, meets the requirements of versatility and accuracy, and features high accuracy, fast response speed, and is unaffected by the scanning cycle in the program.
[0005] The present invention adopts the following technical solution:
[0006] A method for invoking motion control via an EtherCAT bus interrupt includes:
[0007] The EtherCAT bus master controller enters a bus cycle interrupt; the EtherCAT bus master controller has a bus interrupt function.
[0008] The program calls a user-written motion control algorithm in C language using a ladder diagram and obtains the calculation results.
[0009] The EtherCAT bus master controller sends Ethernet data frames containing the calculation results to each slave station with a synchronization period of 1ms. After the data frame arrives at the slave station, each slave station extracts the corresponding data from the data frame according to the address and writes the feedback data into the data frame. When the data is sent to the last slave station, it returns and then returns to the master station through the first slave station, thus realizing data communication. The EtherCAT bus master controller also periodically sends the calculation result data to the target position of the slave servo driver in real time with a synchronization unit of 1ms.
[0010] The slave servo driver executes various motion commands based on the calculation results.
[0011] Specifically, the invocation of the user-written motion control algorithm in C language includes: invoking an internal function, which is specifically:
[0012] Set, reset, and read the state of the bit pointer / array: BOOL GET_BIT(int n); void SET_BIT(int n); void RST_BIT(int n);
[0013] Read input point X: BOOL GET_X(int n);
[0014] Read, set, and reset the Y output point: BOOL GET_Y(int n); void SET_Y(int n); void RST_Y(int n);
[0015] Read, set, and reset output point M: BOOL GET_M(int n); void SET_M(int n); void RST_M(int n);
[0016] Get the system timer clock 0.1ms: GetSysTick(void);
[0017] Reading and writing single words in area D: GET_D(int n); SET_D(int n, int16 val);
[0018] Reading and writing double words in area D: GET_DD(int n); SET_DD(int n, int32 val);
[0019] Reading and writing single-precision floating-point numbers in the D area: GET_FD(int n); SET_FD(int n, float val);
[0020] Get a 16-bit integer pointer / array from the D register: GET_DP(int n); GET_DDP(int n);
[0021] Get floating-point pointers / arrays in the D register: GET_FDP(int n).
[0022] Specifically, the method execution also includes the following:
[0023] Establish function libraries and variables;
[0024] Write motion control algorithms using C language functions.
[0025] As can be seen from the above description of the present invention, compared with the prior art, the present invention has the following beneficial effects:
[0026] This invention provides a method for invoking motion control via an EtherCAT bus interrupt. The method includes the EtherCAT bus master controller entering a bus cycle interrupt, calling a user-written motion control algorithm in C language via a ladder logic program, and obtaining the calculation results. The EtherCAT bus master controller periodically sends the calculation results data to the target position PDO object address 607Ah of the slave servo driver in real time, with a synchronization unit of 1ms. The slave servo driver executes various motion commands based on the calculation results. The method provided by this invention enables user-level low-level computation development, meets versatility and accuracy requirements, and features high accuracy, fast response speed, and is unaffected by the scanning cycle in the program. Attached Figure Description
[0027] Figure 1 A flowchart illustrating a method for invoking motion control via an EtherCAT bus interrupt, as provided in this embodiment of the invention;
[0028] Figure 2 The following are schematic diagrams related to examples of motion control algorithms provided in embodiments of the present invention, wherein Figure (a) is a dual-axis circular interpolation trajectory; Figure (b) is a schematic diagram of a newly created function library and input / output variables; and Figure (c) is a schematic diagram of the coordinate position curves of the X-axis and Y-axis.
[0029] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. Detailed Implementation
[0030] This invention provides a method for motion control via EtherCAT bus interrupt, which solves the technical problem that existing controllers cannot meet the requirements of versatility and accuracy, and are inconvenient for users to develop low-level operations. It enables users to develop low-level operations, meets the requirements of versatility and accuracy, and has high accuracy, fast response speed, and is not affected by the scanning cycle in the program.
[0031] like Figure 1As shown, our dedicated EtherCAT bus master controller is used, which has a bus interrupt function, and the corresponding bus interrupt vector number is I510. Our dedicated JUNCAUTO PLC programming software is used, which has mixed ladder diagram and C language programming capabilities. Users write motion control algorithms in C language within the application program. At this point, a bus cycle interrupt is entered. The ladder diagram program calls the calculation results from the C language. The EtherCAT bus controller master automatically sends Ethernet data frames to each slave station with a 1ms synchronization cycle. After the data frame arrives at the slave station, each slave station extracts the corresponding data from the data frame according to the address and writes the feedback data into the data frame. The data returns after being sent to the last slave station and then returns to the master station through the first slave station, thus achieving data communication. Therefore, the EtherCAT master controller periodically sends the calculation result data to the target position PDO object address 607Ah of the servo drive in real time with a 1ms synchronization unit, thereby controlling the bus servo to execute various motion commands, such as mechanical joint control, linear and circular interpolation commands, etc. Therefore, this method, which uses bus interrupt functionality to call control algorithms to control the slave station to issue motion control commands, has the following advantages:
[0032] With algorithm development capabilities: neither users nor controller manufacturers are limited to relying on calling the controller's underlying dedicated instructions to execute applications. There is no need to develop a dedicated controller. Algorithms can be written using C functions to implement underlying algorithm development capabilities at the application layer. Users can use conventional controllers to develop various algorithm operations without occupying a large number of D registers in the controller. This better reflects the value of the product for users, greatly improves cost-effectiveness, and makes the functions more open and versatile.
[0033] You can call our company's proprietary internal functions, as detailed below:
[0034] • Set, reset, and read the state of the bit pointer / array: BOOL GET_BIT(int n); void SET_BIT(int n); void RST_BIT(int n).
[0035] • Read input point X: BOOL GET_X(int n).
[0036] • Read, set, and reset the Y output point: BOOL GET_Y(int n); void SET_Y(int n); void RST_Y(int n).
[0037] • Read, set, and reset output point M: BOOL GET_M(int n); void SET_M(int n); void RST_M(int n).
[0038] • Get the system timer clock 0.1ms: GetSysTick(void).
[0039] • Read and write single words in area D: GET_D(int n); SET_D(int n,int16 val).
[0040] • Read and write double words in D area: GET_DD(int n); SET_DD(int n,int32 val).
[0041] • Read and write single-precision floating-point numbers in the D area: GET_FD(int n); SET_FD(int n,float val).
[0042] • Get a 16-bit integer pointer / array from the D register: GET_DP(int n); GET_DDP(int n).
[0043] • Get floating-point pointers / arrays in the D register: GET_FDP(int n).
[0044] It has a bus interrupt function: the bus interrupt vector number is I510, the interrupt cycle is 1ms. By executing the bus interrupt, the value generated by the C function algorithm is called periodically. The calculation result data is sent to the target position PDO object address 607Ah of the servo driver in real time through bus communication. The slave station executes motion control commands. It has the advantages of high precision and fast response speed, and is not affected by the scanning cycle in the program.
[0045] The present invention will be further explained below through specific embodiments:
[0046] Using our EtherCAT bus master controller to control EtherCAT slave servos, the brand of the slave servo is not limited. The EtherCAT master controller uses the bus interrupt function to call C function algorithms, and executes the results to control the slave servo via bus communication to perform motion control commands. The motion control trajectory is not limited and is determined by the user's application-layer algorithm. The following example demonstrates the execution... Figure 2 (a) An example of using the dual-axis (X-axis, Y-axis) circular interpolation algorithm for curve motion.
[0047] Step 1: Establish function library and variables
[0048] Using our JUNCAUTO PLC programming software, create a C function library, and add new input and output variables. Define the X and Y coordinate input variables as ox and oy respectively, the input radius variable as r, and the output curve motion completion signal variable as m. The function name for this variable is circle. Figure 2 As shown in (b):
[0049] Step 2: Write the trajectory algorithm using C functions
[0050] Using known input variables, the real-time X and Y coordinates on the arc are calculated, and the results are stored in D1648 and D1664 respectively. The code is as follows:
[0051]
[0052]
[0053] Step 3: Execute a bus interrupt and call the C function library.
[0054] Create a new bus interrupt routine. Write the C function named circle in step one using a ladder diagram, set M1 to 1, execute the circle instruction, and call the calculation results of D1648 and D1664 in the C function in step two with an interrupt cycle of 1ms.
[0055] Step 4: Execute the dual-axis circular arc trajectory using the slave axis servo.
[0056] like Figure 2 (c) shows the coordinate position curves of the X and Y axes. The EtherCAT master controller periodically sends the updated data of the D1648 and D1664 calculations to the target position PDO object address 607Ah of the servo driver in real time, with a synchronization unit of 1ms. Figure 2 The circular arc trajectory shown.
[0057] This invention provides a method for invoking motion control via an EtherCAT bus interrupt. The method includes the EtherCAT bus master controller entering a bus cycle interrupt, calling a user-written motion control algorithm in C language via a ladder logic program, and obtaining the calculation results. The EtherCAT bus master controller periodically sends the calculation results data to the target position PDO object address 607Ah of the slave servo driver in real time, with a synchronization unit of 1ms. The slave servo driver executes various motion commands based on the calculation results. The method provided by this invention enables user-level low-level computation development, meets versatility and accuracy requirements, and features high accuracy, fast response speed, and is unaffected by the scanning cycle in the program.
[0058] The above are merely specific embodiments of the present invention, but the design concept of the present invention is not limited thereto. Any non-substantial modifications made to the present invention using this concept shall be considered as infringing upon the protection scope of the present invention.
Claims
1. A method for invoking motion control via an EtherCAT bus interrupt, characterized in that, include: The EtherCAT bus master controller enters a bus interrupt cycle, and the EtherCAT bus master controller has a bus interrupt function. The ladder diagram program calls a user-written motion control algorithm in C language with an interrupt cycle of 1ms and obtains the calculation results. The EtherCAT bus master controller sends Ethernet data frames containing the calculation results to each slave station with a synchronization period of 1ms. After the data frame arrives at the slave station, each slave station extracts the corresponding data from the data frame according to the address and writes the feedback data into the data frame. When the data is sent to the last slave station, it returns and then returns to the master station through the first slave station, thus realizing data communication. The EtherCAT bus master controller also periodically sends the calculation result data to the target position of the slave servo driver in real time with a synchronization unit of 1ms. The slave servo driver executes various motion commands based on the calculation results.
2. The method for invoking motion control via EtherCAT bus interrupt according to claim 1, characterized in that, The calling of the user-written motion control algorithm in C language specifically includes: calling an internal function, which is: Set, reset, and read the state of the bit pointer / array: BOOL GET_BIT(int n); void SET_BIT(int n); void RST_BIT(int n); Read input point X: BOOL GET_X(int n); Read, set, and reset the Y output point: BOOL GET_Y(int n); void SET_Y(int n); void RST_Y(int n); Read, set, and reset output point M: BOOL GET_M(int n); void SET_M(int n); void RST_M(int n); Get the system timer clock 0.1ms: GetSysTick(void); Reading and writing single words in area D: GET_D(int n); SET_D(int n, int16 val); Reading and writing double words in area D: GET_DD(int n); SET_DD(int n, int32 val); Reading and writing single-precision floating-point numbers in the D area: GET_FD(int n); SET_FD(int n, float val); Get a 16-bit integer pointer / array from the D register: GET_DP(int n); GET_DDP(int n); Get floating-point pointers / arrays in the D register: GET_FDP(int n).
3. The method for invoking motion control via EtherCAT bus interrupt according to claim 1, characterized in that, The following also applies before the method is executed: Establish function libraries and variables; Write motion control algorithms using C language functions.
Citation Information
Patent Citations
Opening type mechanical arm control method based on Ethernet
CN104786221A
Multi-axis servo system architecture design method based on EtherCAT
CN113093658A