EtherCAT bus communication method, storage medium, device and slave board
By using the timer interrupt instructions issued by the slave station to read and store data in EtherCAT communication, the communication cycle is shortened, the sampling delay problem is solved, the communication efficiency is improved, it is suitable for high-precision occasions, and supports a variety of encoders Input and digital multi-channel input and output.
Patent Information
- Application Number
- CN202410727275.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-06
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-06-06
AI Technical Summary
The sampling delay in EtherCAT communication is high, which affects communication efficiency and makes it difficult to meet the automation industry's demand for efficient communication.
The timer interrupt command issued by the slave station is used to continuously read and store external signal data, shortening the communication cycle, and uploading data and processing results after the master station issues an interrupt command to improve communication efficiency.
It effectively reduces sampling delay, improves communication efficiency, is suitable for high-precision and high-communication rate occasions, has lower cost, shorter development cycle, and supports a variety of encoder inputs and digital multi-channel input and output.
Smart Images

Figure CN118300919B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial Ethernet, and in particular to an EtherCAT bus communication method, a storage medium, a device and a slave board. Background Art
[0002] Compared with traditional fieldbuses, Ethernet fieldbuses have the advantages of high cost performance, fast transmission speed, and access to standard Ethernet. Among them, EtherCAT has the characteristics of flexible wiring, standard universality, fast and convenient compared with other real-time Ethernet.
[0003] However, with the continuous development of the automation industry, the requirements for communication efficiency are getting higher and higher. How to effectively reduce sampling delay to improve communication efficiency has become a problem to be solved in the EtherCAT communication field. Summary of the invention
[0004] Based on this, an EtherCAT bus communication method is provided, which can effectively reduce sampling delay and improve communication efficiency.
[0005] An EtherCAT bus communication method, comprising:
[0006] The slave station no longer reads external signal data according to the interrupt instruction issued by the master station, but continuously reads and stores external signal data according to the timer interrupt instruction issued by the slave station, thereby shortening the EtherCAT communication cycle and improving communication efficiency. The timer interrupt frequency issued by the slave station is higher than the interrupt instruction frequency issued by the master station. After obtaining the interrupt instruction issued by the master station for the first time, the slave station uploads the stored external signal data to the master station for processing. After obtaining the interrupt instruction issued by the master station for the second time, the slave station executes the signal processing result of the master station.
[0007] A computer storage medium stores at least one executable instruction, wherein the executable instruction enables a processor to execute the operation of the EtherCAT bus communication method.
[0008] A slave device for implementing the EtherCAT bus communication method comprises a housing and a slave board arranged in the housing, wherein the slave board comprises a power module and a communication module, wherein the power module is used to supply power to the communication module of the slave board, and a power interface is arranged on the housing, wherein the power interface is connected to the power module.
[0009] In one of the embodiments, the housing is provided with a guide rail buckle and a connector for fixing the guide rail.
[0010] In one of the embodiments, the encoder interface is an extensible encoder interface.
[0011] In one embodiment,
[0012] The communication module of the slave board includes a main control chip, an ECAT communication chip and a CPLD chip, and the main control chip is connected to the ECAT communication chip and the CPLD chip respectively.
[0013] The main control chip is also connected to the main control program burning interface, debugging interface, digital quantity input interface and digital quantity output interface.
[0014] The ECAT communication chip is connected to the EtherCAT interface.
[0015] The CPLD chip is connected to the encoder interface and the CPLD program burning interface respectively.
[0016] A slave board for implementing the EtherCAT bus communication method,
[0017] The slave station board includes a power module and a communication module, the communication module includes a main control chip, an ECAT communication chip and a CPLD chip, and the main control chip is connected to the ECAT communication chip and the CPLD chip respectively.
[0018] The main control chip is also connected to the main control program burning interface, debugging interface, digital quantity input interface and digital quantity output interface.
[0019] The ECAT communication chip is connected to the EtherCAT interface.
[0020] The CPLD chip is connected to the encoder interface and the CPLD program burning interface respectively.
[0021] The beneficial effects of this application are:
[0022] Through the asynchronous timer interrupt control method, the EtherCAT communication cycle is shortened, the sampling efficiency is improved, the sampling delay can be effectively reduced, and the communication efficiency can be improved. It is suitable for high-precision and high-communication rate occasions, and can be expanded to support a variety of encoder inputs, while supporting digital multi-channel input and output, with lower costs and shorter development cycles. The housing of the device of the present application can be installed on the electrical cabinet through a guide rail, so that the slave device of the present application can be reliably grounded and has stronger anti-interference ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 Flow chart of the EtherCAT bus communication method according to an embodiment of the present application.
[0024] Figure 2The schematic diagrams are for comparing the EtherCAT bus communication method of the embodiment of the present application with the traditional communication method. (a) is a schematic diagram of the traditional communication method without adding a timer interrupt, and (b) is a schematic diagram of the communication method of the present application after adding a timer interrupt.
[0025] Figure 3 The IO communication comparison diagram of the EtherCAT bus communication method of the embodiment of the present application and the traditional communication method. Among them, (a) is a test diagram of the communication cycle of the traditional method. (b) is a test diagram of the communication cycle of the method of the present application.
[0026] Figure 4 Schematic diagram of the external structure of a slave station device according to an embodiment of the present application.
[0027] Figure 5 Schematic diagram of the internal structure of a slave station device according to an embodiment of the present application.
[0028] Figure 6 This is a schematic diagram of the circuit principle of the slave station board of an embodiment of the present application.
[0029] in:
[0030] 1. Shell; 2. Slave board; 3. Connector; 4. Guide rail buckle; 5. EtherCAT interface; 6. Power interface; 7. Debug interface; 8. Digital input interface; 9. Digital output interface; 10. Encoder interface; 11. Master program burning interface; 13. Jtag debugging interface. DETAILED DESCRIPTION
[0031] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0032] like Figure 1As shown, an embodiment of the present application provides an EtherCAT bus communication method, the method comprising: both the master station and the slave station will issue an interrupt instruction, wherein the timer interrupt frequency issued by the slave station is higher than the interrupt instruction frequency issued by the master station, and the slave station will continue to read and store external signal data according to the timer interrupt instruction issued by the slave station, so as to ensure that the external signals uploaded by the slave station to the master station are the latest external signals. That is, the slave station no longer reads the external signal data according to the interrupt instruction issued by the master station, but reads and stores the external signal data according to the timer interrupt instruction issued by the slave station. Each timer interrupt instruction issued by the slave station will prompt the slave station to read and store the external signal data. According to the above method, before obtaining the interrupt instruction issued by the master station, the slave station will first receive the timer interrupt instruction of the slave station, and after receiving the timer interrupt instruction of the slave station, the slave station will give priority to reading and storing the external signal data. This is conducive to improving communication efficiency.
[0033] In one embodiment, in a data communication cycle, after the slave station obtains the interrupt instruction sent by the master station for the first time, the slave station uploads the latest stored external signal data to the master station for processing. It should be noted that after the master station sends the interrupt instruction this time, the slave station uploads the latest stored external signal data to the master station for processing, and at the same time, the slave station will also execute the master station signal processing result of the previous data communication cycle.
[0034] On the basis of the above, within a data communication cycle, after the slave station obtains the interrupt instruction sent by the master station for the second time, the slave station executes the signal processing result of the master station. The signal data used in the signal processing result of the master station here is the latest external signal data uploaded by the slave station to the master station after the slave station obtains the interrupt instruction sent by the master station for the first time. It should be noted that after the master station sends the interrupt instruction this time, the slave station executes the signal processing result of the master station, and at the same time, the slave station will also upload the latest external signal data to the master station for processing.
[0035] According to the above description, each time the master station sends an interrupt instruction, the slave station will have two actions, one is to upload the external signal data, and the other is to execute the master station signal processing result, but the two actions belong to different data communication cycles.
[0036] Specifically, the present application can effectively shorten the communication cycle by adding an asynchronous timer interrupt in the slave station, such as Figure 2 As shown in Figures (a) and (b), in traditional communication methods, such as Figure 2 As shown in Figure (a), a data communication cycle requires at least three master interrupt instructions to complete. In the communication method of the present application, Figure 2 As shown in Figure (b), a data communication cycle can be completed with only two master interrupt instructions, which reduces the delay of data sampling and improves sampling efficiency.
[0037] The entire process of the preferred method of the present application is as follows: within a data communication cycle, before obtaining the interrupt instruction issued by the master station, the slave station issues a timer interrupt, and after the interrupt, the slave station preferentially reads and stores the external signal data, after the slave station obtains the interrupt instruction issued by the master station for the first time, the slave station directly uploads the latest stored external signal data to the master station for processing, and after the slave station obtains the interrupt instruction issued by the master station for the second time, the slave station executes the signal processing result of the master station.
[0038] This application also conducted a comparative experiment, which was conducted in the Freerun mode of EtherCAT. Figure 3 As shown in Figures (a) and (b), line 2 is the key signal, line 3 is the master interrupt signal, and line 1 is the IO output signal. From the example test, it can be seen that the communication time of the traditional method is 680us, and the communication time of the method of the present application is 580us. This means that after adding an asynchronous timer interrupt in the slave station, the overall communication time is reduced by about 100us, that is, the communication time is shortened by about 15%. This also shows that the method of the present application can effectively reduce sampling delay and improve communication efficiency.
[0039] An embodiment of the present application further provides a computer storage medium, wherein the computer storage medium stores at least one executable instruction, and the executable instruction enables a processor to execute the operation of the EtherCAT bus communication method.
[0040] like Figure 4-5 As shown, the embodiment of the present application also provides a slave device for implementing the EtherCAT bus communication method, including a housing 1 and a slave board 2 arranged in the housing 1, the slave board 2 includes a power module and a communication module, the power module is used to power the communication module of the slave board 2, and the housing 1 is provided with a power interface 6, and the power interface 6 is connected to the power module. Specifically, the power module may include a DCDC buck chip and a plurality of LDO buck chips connected to the DCDC buck chip, wherein the DCDC buck chip is connected to the power interface 6. The power module is used to convert 24V input into 5V and 3.3V DC output.
[0041] On the basis of the above, in one of the embodiments, the outer shell 1 is provided with a guide rail buckle 4 and a connector 3 for fixing the guide rail, wherein the connector 3 may also be provided on the guide rail buckle 4. Specifically, a guide rail buckle 4 is provided at one side wall of the outer shell 1, and a plurality of connectors 3 are provided on the other opposite side wall. The guide rail buckle 4 and the connector 3 are both used for installing the guide rail. When the present application is in use, the outer shell 1 is grounded. Due to the reliably grounded protective outer shell 1, the device of the present application has a stronger anti-interference ability. The present application is compactly designed, and the design of the guide rail buckle 4 makes maintenance and replacement more convenient, and is suitable for smaller occasions.
[0042] In one embodiment, if Figure 6 As shown, the communication module of the slave board 2 includes a main control chip, an ECAT communication chip and a CPLD chip, the main control chip is connected to the ECAT communication chip and the CPLD chip respectively, and the main control chip is also connected to the main control program burning interface 11, the debugging interface 7, the digital quantity input interface 8 and the digital quantity output interface 9. The ECAT communication chip is connected to the EtherCAT interface 5. The CPLD chip is connected to the encoder interface 10 and the CPLD program burning interface respectively. Among them, the CPLD chip is connected to the encoder interface 10 through the RS485 conversion chip. In addition, the CPLD chip is also connected to the Jtag debugging interface 13.
[0043] Furthermore, the encoder interface 10 is an expandable encoder interface, that is, the expandable encoder interface is compatible with multiple protocols and can be connected to multiple types of encoders. For example, an encoder interface 10 can be connected to a BISS-C protocol encoder, an SSI protocol encoder, or an EnDat protocol encoder.
[0044] Specifically, the communication module of the slave board 2 includes a communication coupling unit, an encoder unit and an IO unit. The communication coupling unit is an ECAT communication chip and related peripheral circuits carried by the slave board 2, and is also provided with an EtherCAT interface 5, which is used to connect to the master station via an Ethernet cable, and the signal will be transmitted through the ECAT bus. The encoder unit is a CPLD chip, a 485 conversion chip and related peripheral circuits carried by the slave board 2, and is also provided with a multi-channel encoder interface 10, which can support 3-way Biss_C encoder input, which is conducive to subsequent expansion and support of communication protocols such as SSI and Endat. The IO unit is the GPIO input, output and related peripheral circuits of the ARM main control chip carried by the slave board 2. The digital input interface 8 includes an optical coupling isolation and input circuit, supporting 8-way NPN or PNP input, and the digital output interface 9 includes a Darlington tube and an output circuit, supporting 7-way NPN output.
[0045] This application realizes the collection of absolute encoder data based on EtherCAT bus, can collect three Biss-C encoding signals at the same time, and supports extended collection of Endat, SSI and other signals.
[0046] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. An EtherCAT bus communication method, Features include: The slave station no longer reads external signal data according to the interrupt instruction issued by the master station, but continuously reads and stores external signal data according to the timer interrupt instruction issued by the slave station. The timer interrupt frequency issued by the slave station is higher than the interrupt instruction frequency issued by the master station. After obtaining the interrupt instruction issued by the master station for the first time, the slave station uploads the stored external signal data to the master station for processing. After obtaining the interrupt instruction issued by the master station for the second time, the slave station executes the signal processing result of the master station. The slave station continuously reads and stores external signal data according to the timer interrupt instruction issued by the slave station, including: within a data communication cycle, before obtaining the interrupt instruction issued by the master station, the slave station issues a timer interrupt instruction, and after receiving the timer interrupt instruction from the slave station, the slave station preferentially reads and stores the external signal data.
2. A computer storage medium, It is characterized in that The computer storage medium stores at least one executable instruction, and the executable instruction enables the processor to perform the operation of the EtherCAT bus communication method according to claim 1.
3. A slave device for implementing the EtherCAT bus communication method according to claim 1, It is characterized in that It comprises a shell and a slave station board arranged in the shell, wherein the slave station board comprises a power module and a communication module, wherein the power module is used to supply power to the communication module of the slave station board, and a power interface is arranged on the shell, wherein the power interface is connected to the power module.
4. The slave device according to claim 3, It is characterized in that The shell is provided with a guide rail buckle and a socket for fixing the guide rail.
5. The slave device according to claim 3, It is characterized in that The communication module of the slave board includes a main control chip, an ECAT communication chip and a CPLD chip, and the main control chip is connected to the ECAT communication chip and the CPLD chip respectively. The main control chip is also connected to the main control program burning interface, debugging interface, digital quantity input interface and digital quantity output interface. The ECAT communication chip is connected to the EtherCAT interface. The CPLD chip is connected to the encoder interface and the CPLD program burning interface respectively.
6. A slave board for implementing the EtherCAT bus communication method according to claim 1, It is characterized in that The slave station board includes a power module and a communication module, the communication module includes a main control chip, an ECAT communication chip and a CPLD chip, and the main control chip is connected to the ECAT communication chip and the CPLD chip respectively. The main control chip is also connected to the main control program burning interface, debugging interface, digital quantity input interface and digital quantity output interface. The ECAT communication chip is connected to the EtherCAT interface. The CPLD chip is connected to the encoder interface and the CPLD program burning interface respectively.
