Slave station equipment information processing method and device, terminal equipment and industrial network system

By adding the slave count field in the Ethercat protocol frame structure, the complex problem of slave device information collection and number assignment is solved, the load bearing efficiency and real-time performance are improved, and the device search and number assignment are simply completed.

CN118694481APending Publication Date: 2024-09-24深圳市三旺通信股份有限公司
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202410823273.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

The Ethercat protocol is complicated in the process of slave device information collection and number allocation. It has problems such as complex frame structure, low load carrying efficiency, and poor real-time performance of periodic polling.

Method used

A slave count field is added to the frame structure of the Ethercat protocol to store the number of slave stations passing through. This field is used to implement device search and number allocation, simplifying the number allocation process and improving bearer efficiency and real-time performance.

Benefits of technology

The slave station count field simplifies the slave station number allocation process, improves the carrying efficiency and real-time performance of the Ethercat protocol, makes function expansion more convenient, and realizes simple completion of device search and number allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118694481A
    Figure CN118694481A
Patent Text Reader

Abstract

The invention relates to the technical field of industrial communication, in particular to a slave station equipment information processing method and device, terminal equipment and an industrial network system, and the method comprises the steps: receiving a command message generated based on an Ethercat protocol; when a command value in a command field in a message header area of the command message meets a set value, reading a count value in a count field of the slave station; according to a preset register address function table, determining a register address for storing the serial number of the slave station, determining the serial number of the slave station according to the count value, and writing the serial number of the slave station into a register corresponding to the register address; a set stepping value is added to the count value, the count value is stored back to the slave station count field, and an updated command message is obtained; and if the next adjacent slave station exists, the updated command message is sent to the next adjacent slave station, so that the problem that the process of distributing numbers for the slave stations by adopting an Ethercat protocol is complicated can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of industrial communication technology, and in particular to a method and apparatus for processing slave station equipment information, a terminal device, and an industrial network system. Background Art

[0002] At present, there are many protocols in the field of industrial control, such as manufacturing, energy, petrochemical and power collection, such as Modbus (Modicon Control System, serial communication protocol), Ethercat (Ethernet for Control Automation Technology, industrial Ethernet communication protocol), Profinet (Process Field Net) and CC-link (Control & Communication Link, control and communication link system), etc. Each protocol has its own characteristics. Among them, the Ethercat protocol is favored by the industry for its simple message structure, low latency and precise synchronization.

[0003] The most typical networking of Ethercat protocol is as follows Figure 1 As shown, the master station constructs the topology through broadcast messages, and configures a continuous station number for each slave station according to the distance from the master station, such as slave station 1, slave station 2, slave station 3, etc. Specifically, it is necessary to confirm that the target slave station is hit by decreasing the ADP (Address Position) field to 0, and then assign a number to the slave station. The process of assigning slave station numbers is complicated. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a slave device information processing method, apparatus, terminal equipment and industrial network system, which can effectively solve the problem of complex process of assigning numbers to slaves using the Ethercat protocol.

[0005] In a first aspect, an embodiment of the present application provides a method for processing slave device information, which is applied to an industrial slave, and the method includes:

[0006] Receiving a command message generated based on the Ethercat protocol; wherein the frame structure defined by the Ethercat protocol includes a slave count field located between a message header area and a message data area;

[0007] When the command value in the command field in the message header area of ​​the command message meets the set value, reading the count value in the slave count field;

[0008] According to a preset register address function table, determine the register address storing the slave station number, determine the slave station number according to the count value, and write the slave station number into the register corresponding to the register address;

[0009] Increasing the count value by a set step value and storing it back in the slave station count field to obtain an updated command message;

[0010] If there is an adjacent next slave station, the updated command message is sent to the adjacent next slave station.

[0011] In some embodiments, before sending the updated command message to the next adjacent slave station, the method further includes:

[0012] Get slave device information;

[0013] Adding a data unit at the end of the message data area of ​​the command message;

[0014] The slave station device information is encapsulated into the newly added data unit.

[0015] In some embodiments, it also includes:

[0016] If the adjacent next slave station does not exist, the updated command message is used as a response message, and the response message is transmitted back in sequence through slave stations at all levels in a transparent transmission manner to the master station that is communicatively connected to slave stations at all levels.

[0017] In some embodiments, when the command value in the command field in the message header area of ​​the command message meets the set value, the count value in the slave count field is read, and the process also includes:

[0018] The protocol type of the command message is determined according to the field value of the reserved field in the message header area of ​​the command message, and the command message is parsed according to the protocol type.

[0019] In some embodiments, when the command value in the command field in the message header area of ​​the command message satisfies the set value, reading the count value in the slave count field includes:

[0020] Reading a command value in the command field, and reading a protocol value stored in a reserved field in the message header area;

[0021] Determine whether the command value is a first set value corresponding to the slave device search and number allocation, and whether the protocol value is a second set value;

[0022] If it is determined that the command value is equal to the set value, and the protocol value is equal to the second set value, then the count value in the slave count field is read.

[0023] In some embodiments, the count value in the slave count field is initially set to 0;

[0024] The set step value is 1.

[0025] In some embodiments, the slave device information includes: at least one of device type, device model, manufacturer information, device MAC address, and device IP;

[0026] The step of encapsulating the slave station device information into the newly added data unit includes:

[0027] At least one of the device type, the device model, the manufacturer information, the device MAC address and the device IP is stored in the data field of the data unit, and encapsulated to obtain the data unit.

[0028] In a second aspect, an embodiment of the present application provides a slave station device information processing device, including:

[0029] A command receiving module, used for receiving a command message generated by a master station based on an Ethercat protocol; wherein the frame structure defined by the Ethercat protocol includes a slave station count field located between a message header area and a message data area;

[0030] A count value reading module, configured to read the count value in the slave station count field when the command value in the command field in the message header area of ​​the command message meets a set value;

[0031] A slave station number allocation module, used to determine the register address storing the slave station number according to a preset register address function table, determine the slave station number according to the count value, and write the slave station number into the register corresponding to the register address;

[0032] A message updating module, used for increasing the count value by a set step value, and storing it back into the slave station count field to obtain an updated command message;

[0033] The message sending module is used to send the updated command message to the next adjacent slave station if there is one.

[0034] In a third aspect, an embodiment of the present application provides a terminal device, comprising a processor and a memory, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement a slave station device information processing method provided in the first aspect of the present application.

[0035] In a fourth aspect, an embodiment of the present application provides an industrial network system, the industrial network system comprising a master station and a plurality of slave stations;

[0036] The master station is used for command messages generated based on the Ethercat protocol; wherein the frame structure defined by the Ethercat protocol includes a slave station count field located between a message header area and a message data area;

[0037] The slave station is used to process the message information sent by the master station using a slave station device information processing method provided in the first aspect of the present application.

[0038] The embodiments of the present application have the following beneficial effects:

[0039] In the embodiment of the present application, the slave station count field is used to store the number of slave stations passed. The device search and slave station number allocation functions can be completed through one message command using the slave station count field and the CMD field (0x0F), and the process is simple. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1 A connection diagram of an industrial network system according to an embodiment of the present application is shown;

[0042] Figure 2 A schematic diagram of a frame structure of an existing Ethercat protocol is shown;

[0043] Figure 3 A schematic diagram of a frame structure of an improved Ethercat protocol provided in an embodiment of the present application is shown;

[0044] Figure 4 A flow chart showing a method for processing information of a slave device according to an embodiment of the present application is shown;

[0045] Figure 5 Another flow chart of the method for processing slave station device information according to an embodiment of the present application is shown;

[0046] Figure 6 A schematic diagram showing a change in the length of a command message in a method for processing information of a slave device in an embodiment of the present application is shown;

[0047] Figure 7A structural schematic diagram of a slave station device information processing apparatus according to an embodiment of the present application is shown.

[0048] Description of main component symbols:

[0049] 710 - command receiving module; 720 - count value reading module; 730 - slave station number allocation module; 740 - message updating module; 750 - message sending module. DETAILED DESCRIPTION

[0050] The technical solutions 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 only part of the embodiments of the present application, rather than all of the embodiments.

[0051] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. 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 application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0052] Hereinafter, the terms "including", "having" and their cognates used in various embodiments of the present application are intended only to indicate specific features, numbers, steps, operations, elements, components or a combination of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or a combination of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or a combination of the foregoing items. In addition, the terms "first", "second", "third" and the like are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.

[0053] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.

[0054] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0055] Although the Ethercat protocol has great advantages in data transmission, it also has some disadvantages. For example, each sub-PDU (data unit) of the Ethercat protocol Ethernet frame contains a WKC field, the frame structure is complex, the protocol carrying efficiency is low, the real-time performance of periodic polling is poor, the protocol functions are not easy to expand, and it is not easy to add new functional points. Especially for industrial network systems, when the master station collects information from the slave station and assigns slave station numbers, the collection and allocation process is complicated. For example, Figure 1 The present application proposes a method, device, terminal device and industrial network system for processing information of slave devices, which can effectively solve the problem of complex process of assigning numbers to slaves using Ethercat protocol.

[0056] First, this application improves the Ethercat protocol. The frame structure of the existing Ethercat protocol is as follows: Figure 2 As shown, it includes an Ethernet frame header, a load part Payload and an Ethernet frame tail. Among them, the Ethernet frame header includes the destination address DMAC (6B), the source address SMAC (6B), the virtual local area network VLAN (4B) and the Ethernet type EtherType (2B). The load part Payload includes the message header area PDU header (2B) and PDUs (data unit collection, also called message data area). The PDU header is also called the message header area. Each sub-PDU (data unit) contains a WKC field (2B) at the end.

[0057] like Figure 3 As shown, in the embodiment of the present application, the WKC field in the sub-PDU is removed, and a 2-byte slave station count field (Slave station Statistical value, SSV, slave station statistical value field, also called slave station count field) is added globally to obtain an improved Ethercat protocol. The slave station count field is used to store the number of slave stations passing through. The slave station count field is located between the message header area and the message data area.

[0058] Specifically, the frame structure of the Ethercat protocol in the embodiment of the present application includes an Ethernet frame header, a message header area, a slave station count field and a message data area in sequence; the message data area includes multiple data units; the data unit includes a command field CMD, an index field IDX, an address field ADP, a register address field ADO, LEN, Reserved, a loop flag C, an end data unit flag NEXT, IRQ and a unit data field DATA; the slave station count field is used to count the total number of slave stations connected to the master station communication.

[0059] The present application also provides an industrial network system, the industrial network system comprising a master station and a plurality of slave stations. The master station is communicatively connected to each of the slave stations. The industrial network system can be obtained by ring networking, multi-ring networking, star networking, etc.

[0060] The master station is used for generating command messages based on the Ethercat protocol; wherein the frame structure defined by the Ethercat protocol includes a slave station count field located between a message header area and a message data area.

[0061] The slave station is used for processing the message information sent by the master station using a slave station device information processing method provided in the present application.

[0062] The slave station device information processing method is described below in conjunction with some specific embodiments.

[0063] Figure 4 A flow chart of a method for processing slave station device information according to an embodiment of the present application is shown.

[0064] Exemplarily, the slave device information processing method includes the following steps:

[0065] S10, receiving a command message generated based on the Ethercat protocol. The frame structure defined by the Ethercat protocol includes a slave station count field located between the message header area and the message data area. The slave station count field is used to store the number of slave stations connected to the master station.

[0066] If the slave station is the first slave station adjacent to the master station, the command message received in step S10 is: the command message generated by the master station based on the Ethercat protocol. If the slave station is not the first slave station, the command message received in step S10 is the command message generated by the slave station based on the Ethercat protocol, that is, the updated command message mentioned later.

[0067] Further, when the command value in the command field in the message header area of ​​the command message meets the set value, the count value in the slave count field is read, and the method also includes:

[0068] According to the field value of the reserved field in the message header area of ​​the command message, the protocol type of the command message is determined, and the command message is parsed according to the protocol type. The reserved field (Reserved) in the message header area (PDUHead) is used to store the protocol type. Exemplarily, when the field value in the embodiment of the present application is 1, it indicates that the improved Ethercat protocol is adopted. When it is determined that the improved Ethercat protocol is used according to the field value, the command message is parsed according to the improved Ethercat protocol.

[0069] S20, when the command value in the command field in the message header area of ​​the command message meets the set value, read the count value in the slave station count field.

[0070] Further, when the command value in the command field in the message header area of ​​the command message meets the set value, reading the count value in the slave count field includes:

[0071] S21, reading the command value in the command field, and reading the protocol value stored in the reserved field in the message header area.

[0072] The master station initially sets the count value in the slave station count field to 0; the set step value is 1. The master station sets the count value in the slave station count field to 0 when framing based on the improved Ethercat protocol.

[0073] S22, judging whether the command value is a first setting value corresponding to the slave device search and number allocation, and whether the protocol value is a second setting value.

[0074] The master station sets different command values ​​in the command field (CMD) in the message header area according to different service functions. The command value corresponding to the command value segment in the embodiment of the present application is 0x0F, indicating a slave device search and number allocation command. The command value corresponding to the command value segment and the corresponding service function are shown in Table 1:

[0075] Table 1 Command value of command field CMD and corresponding service function description

[0076]

[0077] S23, if it is determined that the command value is equal to the first set value, and the protocol value is equal to the second set value, then read the count value in the slave count field. For example, if the number stored in the command field (CMD) of the message header area in the command message is 0x0F, the first set value = 0x0F, indicating a slave device search and number allocation command, then it is necessary to perform slave number allocation and collect slave device information of the slave device. The value of the Reserved field in PduHEAD is the second set value. In the embodiment of the present application, Reserved = 1 indicates the use of the improved Ethercat protocol.

[0078] S30, determining a register address for storing a slave station number according to a preset register address function table; determining the slave station number according to the count value, and writing the slave station number into a register corresponding to the register address.

[0079] Generally, the registers used to store the slave station numbers of each slave station correspond to the same register, and the register addresses are also the same. Therefore, in the register address function table, only one register address information may be stored for the register storing the slave station number.

[0080] S40, increasing the count value by a set step value, and storing it back into the slave station count field to obtain an updated command message.

[0081] The slave station count field is used to store the number of slave stations connected to the master station. Specifically, each time a command message passes through a slave station, its count value increases by a set step value, and the total number of slave stations is calculated according to the set step value. Therefore, the slave station count field is used to store the number of slave stations passed by the command message when it is sent downlink. Wherein, downlink is the direction from the master station to the last slave station. Preferably, the set step value is 1.

[0082] When the master station generates the command message, the master station sets the count value in the slave station count field to a default count value. If the count value stored in the slave station count field is 0 and the set step value is 1, the first slave station adjacent to the master station is numbered 1. The count value is increased by 1 for each subsequent slave station, and the second slave station is numbered 2, and the Nth slave station is numbered N.

[0083] S50, if there is an adjacent next slave station, the updated command message is sent to the adjacent next slave station. If the slave station is not the last slave station, the received command message is processed in the same way as steps S10 to S50.

[0084] Furthermore, before sending the updated command message to the next adjacent slave station, the method further includes:

[0085] S110, obtaining slave station device information; wherein the slave station device information includes: at least one of device type, device model, manufacturer information, device MAC address and device IP.

[0086] S120, adding a data unit at the end of the message data area of ​​the command message, that is, each slave station needs to insert a data unit after all the data in the message data area.

[0087] S130, encapsulating the slave station device information into the newly added data unit, specifically including:

[0088] At least one of the device type, the device model, the manufacturer information, the device MAC address and the device IP is stored in the data field of the data unit, and encapsulated to obtain the data unit.

[0089] The slave station number may also be encapsulated into the address field of the data unit to facilitate identification of the slave station corresponding to the data unit. The slave station number may also not be encapsulated into the address field of the data unit, in which case the corresponding slave station number may be inferred from the order of the data units in the message data area by the master station.

[0090] Furthermore, the slave device information processing method of the embodiment of the present application further includes:

[0091] If the adjacent next slave station does not exist, the updated command message is used as a response message, and the response message is transmitted back in sequence through slave stations at all levels in a transparent transmission manner to the master station that is communicatively connected to slave stations at all levels.

[0092] Determining the number of the slave station according to the count value includes:

[0093] The count value is used as the number of the slave station, or the count value plus the set step value is used as the number of the slave station, etc., and this application does not impose any restrictions on this.

[0094] In the embodiment of the present application, the order of the corresponding technical features of the update count value of step S40 and the allocation number of step S30 is not limited. If the allocation number of step S30 is in front and the update count value of step S40 is in the back, when the master station generates the command message, the master station sets the count value in the slave station count field to 1. That is, the default count value is 1, the set step value is 1, and the first slave station adjacent to the master station is numbered 1. The count value is increased by 1 for each subsequent slave station, and the second slave station is numbered 2, and the Nth slave station is numbered N.

[0095] If the default count value is 0 and the step value is set to 1, the count value plus the step value is used as the number, and the first slave station adjacent to the master station is numbered 1. The count value is increased by 1 for each subsequent slave station, and the second slave station is numbered 2, and the Nth slave station is numbered N.

[0096] The following is an introduction to the slave device information processing method of the present application embodiment according to the steps performed by the master station and the slave station. Figure 5 As shown, the following steps are included:

[0097] S210, the master station sends a slave station device search and number allocation command, wherein the value in the CMD field in the command message is 0x0F, the value in the slave station count field is 0, and the value of the Reserved field in the PDUHead is 1. Specifically, Figure 6 The frame format of the command message sent by the master station. The values ​​of each field in the command message are specifically shown in Table 2.

[0098] Table 2 Values ​​of each field in the command message

[0099]

[0100]

[0101] S220, when the first slave station receives the slave station device search and number allocation command sent by the master station, the first slave station increases the count value in the slave station count field by 1 and stores it back in the slave station count field to obtain the first updated command message, that is, count value = count value + 1 = 1.

[0102] S230, the first slave device writes the updated count value (count value equal to 1) into the register storing the slave ID (slave number) to complete the number allocation of the first slave.

[0103] S240, obtaining slave device information of the slave device. The slave device information includes: device type, device model, manufacturer information, device MAC address, device IP, etc.

[0104] S250, the first slave station adds a sub-PDU (NODE1_PDU) in the message data field of the command message, inserts the slave station device information into the sub-PDU, and obtains the second updated command message, such as Figure 6 The message after passing through slave 1 (the first slave) is used to complete the collection of slave device information.

[0105] S260, the first slave station forwards the second updated command message to the next slave station.

[0106] S270: For the next slave station, including the second slave station to the second to last slave station, the steps corresponding to the first slave station are executed, specifically including:

[0107] After receiving the command message, the count value in the slave station count field is increased by 1, that is, the count value = count value + 1, and updated and stored back in the slave station count field;

[0108] Write the updated count value into the register storing the slave ID to obtain the command message for the first update of the current slave;

[0109] Get the slave device information of the current slave device;

[0110] Add a sub-PDU (NODEi_PDU, 1<i<X) at the end of the actual data in the message data field of the command message, insert the slave device information into the sub-PDU, and obtain the second updated command message of the current slave, such as Figure 6The message after passing through slave i (the i-th slave) forwards the second updated command message of the current slave to the next slave.

[0111] S280, for the last slave station, execute the steps corresponding to the execution of the first slave station, obtain the last updated command message as the response message, and use the last updated command message as the response message, and use the transparent transmission method to sequentially transmit the response message through the slave stations at all levels to the master station that is in communication with the slave stations at all levels. Specifically, it includes: after receiving the command message, increase the count value in the slave station count field by 1, that is, the count value = count value + 1, and update and store it back in the slave station count field;

[0112] Write the updated count value into the register storing the slave ID, and obtain the command message for the first update of the last slave;

[0113] Get the slave device information of the current slave device;

[0114] A sub-PDU (NODEX_PDU) is added to the end of the actual data in the message data field of the command message, and the slave device information is inserted into the sub-PDU to obtain the second updated command message of the last slave; the second updated command message is used as a response message, and the response message is transmitted back to the master station that is connected to the slave stations at all levels in a transparent transmission manner. That is, each slave station forwards the response message in turn until the first slave station returns to the master station. Thus, Ethercat searches for slaves (collects slave device information) and assigns slave IDs.

[0115] The embodiment of the present application removes the WKC in each sub-PDU and then adds a slave station count field globally, so that the DATA field of the Ethercat frame accounts for a larger proportion of the entire message, thereby improving the carrying efficiency of Ethercat and thus improving the carrying efficiency and saving bandwidth; the WKC field of the sub-PDU is removed to shorten the Ethercat frame, thereby shortening the period for the message to traverse all slave stations, improving the real-time performance of periodic polling; making the function expansion of the Ethercat protocol more convenient; by adding a global slave station count field, it is convenient to count the number of slave stations that the Ethercat message passes through, and many functions can be expanded through this field, such as slave station search and number allocation, sequential reading and writing, broadcast reading and writing, batch reading and writing, etc.

[0116] Most importantly, in the embodiment of the present application, the slave count field is used to store the number of slaves passed through. The device search and slave number allocation functions can be completed through one message command using the slave count field and the CMD field (0x0F), and the process is simple.

[0117] Figure 7A schematic diagram of the structure of a slave device information processing device according to an embodiment of the present application is shown. Exemplarily, the slave device information processing device includes: a command receiving module 710, a count value reading module 720, a slave number allocation module 730, a message updating module 740 and a message sending module 750.

[0118] The command receiving module 710 is used to receive a command message generated by the master station based on the Ethercat protocol; wherein the frame structure defined by the Ethercat protocol includes a slave station count field located between the message header area and the message data area;

[0119] A count value reading module 720, configured to read the count value in the slave count field when the command value in the command field in the message header area of ​​the command message meets a set value;

[0120] A slave station number allocation module 730 is used to determine the register address storing the slave station number according to a preset register address function table, determine the slave station number according to the count value, and write the slave station number into the register corresponding to the register address;

[0121] The message updating module 740 is used to increase the count value by a set step value and store it back into the slave station count field to obtain an updated command message;

[0122] The message sending module 750 is used to send the updated command message to the next adjacent slave station if there is one.

[0123] It can be understood that the device of this embodiment corresponds to the xx method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.

[0124] The present application also provides a terminal device, which exemplarily includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program to enable the terminal device to execute the functions of each module in the above-mentioned slave device information processing method or the above-mentioned slave device information processing device. Exemplarily, the terminal device is a slave in an industrial network system.

[0125] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. At least one of the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.

[0126] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.

[0127] The present application also provides a readable storage medium for storing the computer program used in the above-mentioned terminal device.

[0128] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0129] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0130] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.

[0131] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

Claims

1. A method for processing information from a slave device, It is characterized in that Applied to an industrial slave station, the method comprises: Receiving a command message generated based on the Ethercat protocol; wherein the frame structure defined by the Ethercat protocol includes a slave count field located between a message header area and a message data area; When the command value in the command field in the message header area of ​​the command message meets the set value, reading the count value in the slave count field; According to a preset register address function table, determine the register address storing the slave station number, determine the slave station number according to the count value, and write the slave station number into the register corresponding to the register address; Adding a set step value to the count value and storing it back to the slave station count field to obtain an updated command message; If there is an adjacent next slave station, the updated command message is sent to the adjacent next slave station.

2. The slave device information processing method according to claim 1, It is characterized in that Before sending the updated command message to the next adjacent slave station, the method further includes: Get slave device information; Adding a data unit at the end of the message data area of ​​the command message; The slave station device information is encapsulated into the newly added data unit.

3. The slave device information processing method according to claim 1 or 2, It is characterized in that Also includes: If the adjacent next slave station does not exist, the updated command message is used as a response message, and the response message is transmitted back in sequence through slave stations at all levels in a transparent transmission manner to the master station that is communicatively connected to slave stations at all levels.

4. The slave device information processing method according to claim 1, It is characterized in that When the command value in the command field in the message header area of ​​the command message meets the set value, reading the count value in the slave count field, the method further includes: The protocol type of the command message is determined according to the field value of the reserved field in the message header area of ​​the command message, and the command message is parsed according to the protocol type.

5. The slave device information processing method according to claim 1 or 4, It is characterized in that When the command value in the command field in the message header area of ​​the command message meets the set value, reading the count value in the slave count field includes: Reading a command value in the command field, and reading a protocol value stored in a reserved field in the message header area; Determine whether the command value is a first set value corresponding to the slave device search and number allocation, and whether the protocol value is a second set value; If it is determined that the command value is equal to the first setting value, and the protocol value is equal to the second setting value, then the count value in the slave station count field is read.

6. The slave device information processing method according to claim 1 or 4, It is characterized in that The count value in the slave station count field is initially set to 0; The set step value is 1.

7. The slave device information processing method according to claim 2, It is characterized in that The slave station device information includes: at least one of device type, device model, manufacturer information, device MAC address and device IP; The step of encapsulating the slave station device information into the newly added data unit includes: At least one of the device type, the device model, the manufacturer information, the device MAC address and the device IP is stored in the data field of the data unit, and encapsulated to obtain the data unit.

8. A slave device information processing device, It is characterized in that include: A command receiving module, used for receiving a command message generated by a master station based on an Ethercat protocol; wherein the frame structure defined by the Ethercat protocol includes a slave station count field located between a message header area and a message data area; A count value reading module, configured to read the count value in the slave station count field when the command value in the command field in the message header area of ​​the command message meets a set value; A slave station number allocation module, used to determine the register address storing the slave station number according to a preset register address function table, determine the slave station number according to the count value, and write the slave station number into the register corresponding to the register address; A message updating module, used for increasing the count value by a set step value, and storing it back into the slave station count field to obtain an updated command message; The message sending module is used to send the updated command message to the next adjacent slave station if there is one.

9. A terminal device, It is characterized in that The terminal device comprises a processor and a memory, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement the slave device information processing method according to any one of claims 1 to 7.

10. An industrial network system, It is characterized in that The industrial network system includes a master station and multiple slave stations; The master station is used for command messages generated based on the Ethercat protocol; wherein the frame structure defined by the Ethercat protocol includes a slave station count field located between a message header area and a message data area; The slave station is used to process the message information sent by the master station by using the slave station device information processing method described in any one of claims 1 to 7.

Citation Information

Cited By

  • Industrial data batch processing method, industrial data processing method and system

    CN119806081A

  • Industrial data batch processing method, industrial data processing method and system

    CN119806081B

  • One-master multi-slave high-speed serial communication and synchronous control method and system and medium

    CN120475090A

  • PDU message visualization method and device, equipment and medium

    CN121644398A

  • PDU message visualization methods, devices, equipment, and media

    CN121644398B