A data transmission method, system, electronic device, and storage medium

By converting the access data of multibyte commands into binary strings and configuring the request signals of control fields, the problem of multibyte commands interrupting encoder position data is solved, enabling the acquisition of real-time position data and synchronous access to other information, thereby improving control accuracy.

CN116996593BActive Publication Date: 2026-07-31ZHEJIANG HECHUAN TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG HECHUAN TECH
Filing Date
2023-08-18
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

In the prior art, when the driver accesses the encoder with a multi-byte command, it interrupts the acquisition of encoder position data, making real-time control impossible.

Method used

By generating access data corresponding to multi-byte commands and converting it into a first string in binary format, configuring control fields for each character, generating request signals containing only control fields, sending them to the encoder in character order, receiving and processing the encoder's response signals to generate feedback data, and avoiding interruption of position data access.

Benefits of technology

This allows the acquisition of encoder position data to be completed without interrupting the access to other information, thereby improving the driver's control accuracy over the encoder.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116996593B_ABST
    Figure CN116996593B_ABST
Patent Text Reader

Abstract

This application discloses a data transmission method, system, electronic device, and storage medium, belonging to the technical field of digital communication technology. The data transmission method includes: determining a multi-byte command to be transmitted and generating access data corresponding to the multi-byte command; converting all bytes in the access data into binary to obtain a first string; configuring a corresponding control field for each character in the first string and generating a request signal containing only the control field; sequentially sending all the request signals to the encoder according to the character order of the first string, so that the encoder generates feedback data corresponding to the multi-byte command; receiving a response signal returned by the encoder; and generating the feedback data based on the control fields of all the response signals. This application can avoid interference from multi-byte commands in obtaining encoder position data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of digital communication technology, and in particular to a data transmission method, system, electronic device and storage medium. Background Technology

[0002] An encoder is a device that encodes and converts signals or data into a signal format that can be used for communication, transmission, and storage. A driver can send a request message to the encoder via the UART protocol, in which the encoder will return the corresponding data to the driver.

[0003] The commands sent by the driver to the encoder include position data read commands, data read commands, data write commands, and temperature read commands. Data read commands are single-byte commands, while other commands such as data read, data write, and temperature read commands are multi-byte commands. When the driver accesses the encoder with multi-byte commands, the single-byte commands must be interrupted, resulting in the encoder's position data not being acquired in a timely manner.

[0004] Therefore, how to avoid interference from multi-byte commands in obtaining encoder position data is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention

[0005] The purpose of this application is to provide a data transmission method, system, electronic device, and storage medium that can avoid interference from multi-byte commands in acquiring encoder position data.

[0006] To address the aforementioned technical problems, this application provides a data transmission method applied to a driver connected to an encoder, the data transmission method comprising:

[0007] Determine the multi-byte command to be transmitted and generate the access data corresponding to the multi-byte command;

[0008] Convert all bytes in the accessed data into binary to obtain the first string;

[0009] Configure a corresponding control field for each character in the first string, and generate a request signal containing only the control field; wherein, the driver reads the encoder's position data through the request signal containing only the control field; the encoder returns the position data through the data field in the response signal;

[0010] All the request signals are sent to the encoder in the character order of the first string, so that the encoder generates the feedback data corresponding to the multi-byte command;

[0011] Receive the response signal returned by the encoder; wherein the control field of the response signal is configured according to each character in the second string, and the second string is obtained by binary conversion of the feedback data;

[0012] The feedback data is generated based on the control fields of all the aforementioned response signals.

[0013] Optionally, if the multi-byte command is a data read command, then the access data corresponding to the multi-byte command is generated, including:

[0014] The control field value, address field value, and check field value are determined according to the multi-byte command, and the access data including the control field value, the address field value, and the check field value is generated.

[0015] Optionally, if the multi-byte command is a data write command, then the access data corresponding to the multi-byte command is generated, including:

[0016] The control field value, address field value, data content, and verification field value are determined according to the multi-byte command, and the access data including the control field value, address field value, data content, and verification field value is generated.

[0017] Optionally, the feedback data is generated based on the control fields of all the response signals, including:

[0018] A single character in the second string is determined based on the control field of the response signal;

[0019] The second string is obtained by concatenating all the individual characters of the second string according to the order in which the response signals are received;

[0020] Perform the inverse transformation of the binary conversion on the second string to obtain the feedback data.

[0021] Optionally, before determining a single character in the second string based on the control field of the response signal, the method further includes:

[0022] A request to read position data is initiated to the encoder by a request signal containing only the control field;

[0023] Accordingly, after performing the inverse transformation of the binary conversion on the second string to obtain the feedback data, the process further includes:

[0024] The current position data of the encoder is determined based on the data fields in the feedback data.

[0025] This application also provides a data transmission method applied to an encoder connected to a driver, the data transmission method comprising:

[0026] The driver receives multiple request signals sent by the driver in the character order of a first string; wherein the request signal contains only a control field configured according to a single character of the first string, and the first string is obtained by binary conversion of all bytes in the access data corresponding to a multi-byte command; the driver reads the encoder's position data through the request signal containing only the control field; the encoder returns the position data through the data field in the response signal;

[0027] Extract characters from the control field of the request signal, and concatenate all characters of the first string in the order of receipt to obtain the first string;

[0028] Perform the inverse transformation of the binary conversion on the first string to obtain the accessed data;

[0029] Execute the operation corresponding to the multi-byte command based on the access data, and generate feedback data corresponding to the multi-byte command;

[0030] The feedback data is converted to binary to obtain a second string;

[0031] Configure a corresponding control field for each character in the second string, and generate a response signal containing the control field;

[0032] All the response signals are sent to the controller in the order of the characters in the second string, so that the controller generates the feedback data based on the control fields of all the response signals.

[0033] This application also provides a data transmission system for use with a driver connected to an encoder, the data transmission system comprising:

[0034] The access data generation module is used to determine the multi-byte command to be transmitted and generate access data corresponding to the multi-byte command;

[0035] The first string conversion module is used to convert all bytes in the accessed data into binary to obtain the first string;

[0036] The request signal generation module is used to configure a corresponding control field for each character in the first string and generate a request signal containing only the control field; wherein, the driver reads the position data of the encoder through the request signal containing only the control field; the encoder returns the position data through the data field in the response signal;

[0037] The request signal sending module is used to send all the request signals to the encoder in the order of the characters of the first string, so that the encoder generates feedback data corresponding to the multi-byte command;

[0038] A response signal receiving module is used to receive the response signal returned by the encoder; wherein, the control field of the response signal is configured according to each character in the second string, and the second string is obtained by performing binary conversion on the feedback data;

[0039] The feedback data restoration module is used to generate the feedback data based on the control fields of all the response signals.

[0040] This application also provides a data transmission system for an encoder connected to a driver, the data transmission system comprising:

[0041] A request signal receiving module is configured to receive multiple request signals sent by the driver in the character order of a first string; wherein the request signal contains only a control field configured according to a single character of the first string, and the first string is obtained by binary conversion of all bytes in the access data corresponding to a multi-byte command; the driver reads the encoder's position data through the request signal containing only the control field; the encoder returns the position data through the data field in the response signal;

[0042] The splicing module is used to extract characters from the control field of the request signal, and splice all the characters of the first string in the receiving order to obtain the first string;

[0043] The access data restoration module is used to perform the inverse transformation of the binary conversion on the first string to obtain the access data;

[0044] The feedback data generation module is used to execute the operation corresponding to the multi-byte command based on the access data, and generate feedback data corresponding to the multi-byte command.

[0045] The second string conversion module is used to perform binary conversion on the feedback data to obtain a second string;

[0046] The response signal generation module is used to configure a corresponding control field for each character in the second string and generate a response signal containing the control field.

[0047] The response signal sending module is used to send all the response signals to the controller in the order of the characters in the second string, so that the controller generates the feedback data based on the control fields of all the response signals.

[0048] This application also provides a storage medium on which a computer program is stored, wherein the computer program, when executed, implements the steps of the above-described data transmission method.

[0049] This application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor invokes the computer program in the memory to implement the steps of the above-described data transmission method.

[0050] This application provides a data transmission method applied to a driver connected to an encoder. The data transmission method includes: determining a multi-byte command to be transmitted and generating access data corresponding to the multi-byte command; converting all bytes in the access data into binary to obtain a first string; configuring a corresponding control field for each character in the first string and generating a request signal containing only the control field; wherein the driver reads the encoder's position data through the request signal containing only the control field; the encoder returns the position data through a data field in a response signal; sequentially sending all the request signals to the encoder according to the character order of the first string, so that the encoder generates feedback data corresponding to the multi-byte command; receiving the response signal returned by the encoder; wherein the control field of the response signal is configured according to each character in a second string, the second string being obtained by converting the feedback data into binary; and generating the feedback data based on the control fields of all the response signals.

[0051] After determining the multi-byte command to be transmitted, this application generates access data corresponding to the multi-byte command. This application converts the access data into a first string in binary format and configures a corresponding control field for each character in the first string, thereby generating a request signal containing only the control field for each character. Each character in the first string corresponds to a request signal, and this application sends all the request signals sequentially to the encoder according to the character order of the first string. The encoder can generate feedback data corresponding to the multi-byte command based on the characters carried in the control fields of all the request signals, and performs binary conversion on the feedback data to obtain a second string. It then configures a corresponding control field for each character in the second string and generates a response signal corresponding to each character in the second string based on the control fields. The driver can reconstruct the feedback data after receiving the response signal. Since the driver reads the encoder's position data through request signals containing only control fields, and the encoder returns the position data through the data field in the response signal, this application transforms the process of accessing the encoder by a multi-byte command into a multi-cycle signal interaction, which avoids interruption of position access. Therefore, this application can avoid interference from multi-byte commands in obtaining encoder position data and improve the driver's control accuracy over the encoder. This application also provides a data transmission system, a storage medium, and an electronic device, which have the aforementioned beneficial effects, and will not be elaborated further here. Attached Figure Description

[0052] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0053] Figure 1 This is a schematic diagram of the structure of a servo control system provided in an embodiment of this application;

[0054] Figure 2 This is a schematic diagram of the signal structure for a location data reading process provided in an embodiment of this application;

[0055] Figure 3 This is a schematic diagram of the signal structure for a data writing process provided in an embodiment of this application;

[0056] Figure 4 This is a schematic diagram of the signal structure for a data reading process provided in an embodiment of this application;

[0057] Figure 5 A flowchart illustrating a data transmission method provided in an embodiment of this application;

[0058] Figure 6 A flowchart illustrating another data transmission method provided in an embodiment of this application;

[0059] Figure 7 A schematic diagram illustrating the principle of an RS485 encoder protocol provided in an embodiment of this application;

[0060] Figure 8 This is a schematic diagram of the structure of a control field in the Tamagawa protocol provided in an embodiment of this application. Detailed Implementation

[0061] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0062] Please see Figure 1 , Figure 1 This is a schematic diagram of a servo control system provided in an embodiment of this application. The servo control system includes a controller, a driver, a motor, an actuator, and an encoder. The driver and encoder can interact based on the UART protocol. The interaction processes of position data reading, data writing, and data reading in several conventional solutions in the art are listed below.

[0063] Please see Figure 2 , Figure 2 This is a schematic diagram of the signal structure for a location data reading process provided in an embodiment of this application. The request signal sent by the driver to the encoder includes a control field (CF), and the response signal Data From Encoder returned by the encoder to the driver includes a control field (CF), a status field (SF), a data field (DF), and a check field (CRC field). The number of data items in the data field is determined based on the control field; for example, the data field may include DF0, DF1, ..., DF7. Figure 2 In this context, "Idle" indicates the idle state, and 0 and 1 represent the values ​​of the various fields. The encoder returns position data through the data field, which describes the angle of the motor connected to the encoder.

[0064] Please see Figure 3 , Figure 3This is a schematic diagram of the signal structure for a data writing process provided in an embodiment of this application. The request signal sent by the driver to the encoder includes a control field (CF), a data address field (ADF), a data content field (EDF), and a check field (CRC field). The response signal Data From Encoder returned by the encoder to the driver includes a control field (CF), a data address field (ADF), a data content field (EDF), and a check field (CRC field). Figure 3 In this context, "Idle" indicates an idle state.

[0065] Please see Figure 4 , Figure 4 This is a schematic diagram of the signal structure for a data reading process provided in an embodiment of this application. The request signal sent by the driver to the encoder includes a control field (CF), a data address field (ADF), and a check field (CRC field). The response signal DataFrom Encoder returned by the encoder to the driver includes a control field (CF), a data address field (ADF), a data content field (EDF), and a check field (CRC field). Figure 4 In this context, "Idle" indicates an idle state.

[0066] The position data read command described above is a single-byte command, while the data read and data write commands are multi-byte commands. The encoder protocol includes both multi-byte and single-byte commands. Single-byte commands are used to access the encoder's position data, and the access time for this position data must be sufficiently short to achieve real-time control; for example, the commonly used access cycle is 62.5 µs.

[0067] exist Figure 1 In the servo control system shown, the encoder is typically mounted on top of the motor to provide real-time feedback on the motor's rotor position. Therefore, while the driver's power line controls the motor, the encoder line simultaneously accesses the encoder to obtain the motor angle, and then controls the motor's operation based on this angle.

[0068] Because encoder access involves both single-byte and multi-byte commands, single-byte commands must be interrupted when accessing multi-byte commands. This means that encoder position information cannot be obtained when accessing the encoder using multi-byte commands. In the encoder protocol described above, multi-byte commands include not only reading and writing the EEP (Electronic Encoder Presence) but also functions such as obtaining encoder temperature. For example, a common operation involves real-time monitoring of the encoder temperature and real-time control of the motor movement, which is impossible to accomplish in the aforementioned protocol.

[0069] This application provides a novel encoder protocol that solves the technical problems existing in the aforementioned encoder protocols. By using this encoder protocol, real-time feedback of position information and other information can be achieved without interrupting the reading of position information while providing other information. The implementation of the above encoder protocol is illustrated below through several embodiments.

[0070] Please see below. Figure 5 , Figure 5 A flowchart of a data transmission method provided in this application embodiment, the specific steps of which may include:

[0071] S501: Determine the multi-byte command to be transmitted and generate the access data corresponding to the multi-byte command;

[0072] In this embodiment, the driver can be connected to the encoder. The driver can also be connected to the controller, and then determine the multi-byte command to be transmitted according to the controller's instructions. The multi-byte command can be a data read command, a data write command, or a temperature read command.

[0073] Each multi-byte command can have its corresponding access data, which is used to control the encoder to perform the corresponding operation. Specifically, if the multi-byte command is a data read command, the control field value, address field value, and check field value can be determined based on the multi-byte command to generate the access data including the control field value, address field value, and check field value. If the multi-byte command is a data write command, the control field value, address field value, data content, and check field value can be determined based on the multi-byte command to generate the access data including the control field value, address field value, data content, and check field value. If the multi-byte command is a temperature read command, the control field value, the command code corresponding to the temperature read command, and the check field value are determined. The data read command and data write instruction are used to perform data read and data write operations on the encoder's EEPROM (Electrically Erasable Programmable Read-Only Memory).

[0074] S502: Convert all bytes in the accessed data into binary to obtain the first string;

[0075] In this embodiment, after obtaining the accessed data, all bytes in the accessed data can be converted into binary to obtain a first string in binary format. For example, if the accessed data is in hexadecimal, each byte in the accessed data can be converted into an 8-byte binary string.

[0076] S503: Configure a corresponding control field for each character in the first string, and generate a request signal containing only the control field;

[0077] In this embodiment, each character in the first string can be configured with a corresponding control field. That is, each character in the first string has its own corresponding control field, and the value of the parity bit (IDpairty) of this control field is set to the corresponding character. This embodiment can generate a request signal corresponding to each character in the first string based on each control field. This request signal only contains the corresponding control field, so that a single request signal carries only a single byte from the first string. The control field may also include an identifier for a multi-byte command, for example, setting the data ID code bit to a preset value, such as 0101.

[0078] Furthermore, in this embodiment, the driver reads the encoder's position data via a request signal containing only a control field, and the encoder returns the position data via a data field in a response signal. That is, in this application, regardless of whether the driver needs to send a single-byte command or a multi-byte command, the single-frame request signal actually transmitted to the encoder only includes the control field.

[0079] S504: Send all the request signals to the encoder in the order of the characters in the first string, so that the encoder generates the feedback data corresponding to the multi-byte command;

[0080] After receiving all the request signals, all the request signals are sent to the encoder in the order of the characters in the first string.

[0081] The encoder can extract characters from the control field of the request signal, concatenate all characters of the first string in the receiving order to obtain the first string; perform the inverse transformation of the binary conversion (such as hexadecimal conversion) on the first string to obtain the access data; execute the operation corresponding to the multi-byte command according to the access data, and generate feedback data corresponding to the multi-byte command. The feedback data may include data writing results, data reading results, or temperature reading results.

[0082] S505: Receive the response signal returned by the encoder;

[0083] The control field of the response signal is configured based on each character of the second string, which is obtained by binary conversion of the feedback data.

[0084] Specifically, the encoder can perform the operation corresponding to the multi-byte command based on the access data and generate feedback data corresponding to the multi-byte command; the encoder can also perform binary conversion on the feedback data to obtain a second string, configure a corresponding control field for each character in the second string, and generate a response signal containing a control field, a status field, a data field, and a verification field; the encoder can also send all the response signals to the controller in the character order of the second string, so that the controller generates the feedback data based on the control fields of all the response signals.

[0085] S506: Generate the feedback data based on the control fields of all the aforementioned response signals.

[0086] Specifically, in this embodiment, a single character in the second string can be determined based on the control field of the response signal; all single characters of the second string are concatenated according to the receiving order of the response signal to obtain the second string; the inverse transformation of the binary conversion is performed on the second string to obtain the feedback data. The number system of the feedback data is the same as that of the access data.

[0087] As a feasible implementation, before determining a single character in the second string based on the control field of the response signal, a request to read position data can be initiated to the encoder via a request signal containing only the control field. Correspondingly, after performing the inverse binary transformation on the second string to obtain the feedback data, the current position data of the encoder can be determined based on the data field in the feedback data. This embodiment can also determine the current position data of the encoder based on the data field in a single response signal.

[0088] In this embodiment, after determining the multi-byte command to be transmitted, access data corresponding to the multi-byte command is generated. This embodiment converts the access data into a first string in binary format and configures a corresponding control field for each character in the first string, thereby generating a request signal containing only the control field for each character. Each character in the first string corresponds to a request signal. In this embodiment, all request signals are sent to the encoder sequentially according to the character order of the first string. The encoder can generate feedback data corresponding to the multi-byte command based on the characters carried in the control fields of all the request signals, and perform binary conversion on the feedback data to obtain a second string. A corresponding control field is configured for each character in the second string, and a response signal corresponding to each character in the second string is generated based on the control fields. The driver can reconstruct the feedback data after receiving the response signal. Since the driver reads the encoder's position data through request signals containing only control fields, and the encoder returns the position data through the data field in the response signal, this embodiment transforms the process of accessing the encoder by a multi-byte command into a multi-cycle signal interaction, avoiding interruptions to position access. Therefore, this embodiment can avoid interference from multi-byte commands in obtaining encoder position data and improve the driver's control accuracy over the encoder.

[0089] Please see below. Figure 6 , Figure 6 A flowchart of another data transmission method provided in this application embodiment, the specific steps of which may include:

[0090] S601: Receive multiple request signals sent by the driver in the character order of the first string;

[0091] This embodiment can be applied to an encoder connected to a driver, and the data transmission method implemented by this encoder is the same as... Figure 5 The corresponding embodiments correspond to each other.

[0092] The aforementioned request signal contains only a control field configured according to a single character of the first string, which is obtained by binary conversion of all bytes in the access data corresponding to the multi-byte command; the driver reads the encoder's position data through the request signal containing only the control field; the encoder returns the position data through the data field in the response signal.

[0093] S602: Extract characters from the control field of the request signal, and concatenate all characters of the first string in the order of receipt to obtain the first string;

[0094] Specifically, in this embodiment, the value of the ID pairty bit of the control field can be set to a character of the first string. The encoder can also excite the receiving order of each request signal, and then concatenate the extracted characters based on the above receiving order to restore the first string.

[0095] S603: Perform the inverse transformation of the binary conversion on the first string to obtain the accessed data;

[0096] The encoder can perform the inverse transformation of the binary conversion on the first string to obtain the access data. For example, the first string can be converted to hexadecimal to obtain the access data.

[0097] S604: Execute the operation corresponding to the multi-byte command according to the access data, and generate feedback data corresponding to the multi-byte command;

[0098] After obtaining the access data, the encoder performs the operations corresponding to the multi-byte commands according to the access data, such as data writing, data reading, temperature reading, etc., and generates feedback data corresponding to the completion of the multi-byte commands.

[0099] S605: Perform binary conversion on the feedback data to obtain a second string;

[0100] S606: Configure a corresponding control field for each character in the second string and generate a response signal containing the control field;

[0101] In this embodiment, each character in the second string can be configured with a corresponding control field. That is, each character in the second string has its own corresponding control field, and the value of the parity bit (IDpairty) of this control field is set to the corresponding character. This embodiment can generate a response signal based on each character in the second string, and this response signal can contain the corresponding control field, so that the response signal carries a single byte from the second string. The response signal can also contain a status field, a data field, and a check field.

[0102] S607: All the response signals are sent to the controller in the order of the characters in the second string, so that the controller generates the feedback data based on the control fields of all the response signals.

[0103] In this embodiment, the encoder and driver transmit data. After determining the multi-byte command to be transmitted, the driver generates access data corresponding to the multi-byte command. The driver converts the access data into a first string in binary format and configures a corresponding control field for each character in the first string, thereby generating a request signal containing only the control field for each character. Each character in the first string corresponds to a request signal, and the driver sends all the request signals to the encoder sequentially according to the character order of the first string. The encoder can generate feedback data corresponding to the multi-byte command based on the characters carried in the control fields of all the request signals, and convert the feedback data into binary to obtain a second string. It configures a corresponding control field for each character in the second string, and then generates a response signal corresponding to each character in the second string based on the control fields. After receiving the response signal, the driver can restore the feedback data. Since the driver reads the encoder's position data through a request signal containing only the control field, and the encoder returns the position data through the data field in the response signal, this embodiment transforms the process of accessing the encoder by a multi-byte command into a multi-cycle signal interaction, which can avoid interruption of position access. Therefore, this embodiment can avoid interference from multi-byte commands in obtaining encoder position data and improve the driver's control accuracy over the encoder.

[0104] The process described in the above embodiments is illustrated below through examples in practical applications.

[0105] This embodiment proposes an encoder protocol, which mainly improves encoder protocols based on RS485 electrical signal transmission, such as the Tamagawa protocol, Panasonic protocol, and Wagawa protocol for encoders. Please refer to... Figure 7 , Figure 7 This is a schematic diagram illustrating the principle of an RS485 encoder protocol provided in an embodiment of this application. Inside the driver, the driver processing circuit is connected to the RS485 serial port via the UART protocol, and the RS485 serial port is connected to the encoder processing circuit via the UART protocol. The UART protocol transmits data in bytes, typically including 1 start bit, 8 data bits, and 1 stop bit.

[0106] Please see Figure 8 , Figure 8This is a schematic diagram of the structure of a control field of the Tamagawa protocol provided in an embodiment of this application. The control field is 10 bits long and includes a start bit, a sink code, a data ID code, an ID parity bit, and a delimiter. The character bits of the data ID code include cc0, cc1, cc2, and cc3, and the character bits of the ID parity bit include cc4.

[0107] In the encoder protocol of this embodiment, all encoder accesses use only the control field CF. This embodiment uses [cc0,cc1,cc2,cc3] as [0,1,0,1] to indicate that the driver uses multi-byte commands to access other information, and cc4 indicates accessing 1 bit of other information. This embodiment also uses [cc0,cc1,cc2,cc3] as [0,0,0,0] to indicate that the driver uses single-byte commands to access other information, and cc4 = 0.

[0108] To illustrate the above embodiment, for example, if the data reads the corresponding control field value as EA, the address field value as 00, and the verification field value as EA, access data EA00EA is generated, which includes the control field value, the address field value, and the verification field value.

[0109] The request messages cc0 to cc4 sent by the driver to the encoder in each cycle are as follows:

[0110] The first cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,1];

[0111] The second cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,1];

[0112] The third cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,1];

[0113] The 4th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0114] The 5th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,1];

[0115] The 6th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0116] The 7th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,1];

[0117] The 8th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0118] The 9th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0119] The 10th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0120] The 11th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0121] The 12th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0122] The 13th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0123] The 14th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0124] The 15th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0125] The 16th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0126] The 17th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,1];

[0127] The 18th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,1];

[0128] The 19th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,1];

[0129] The 20th cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0130] The 21st cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,1];

[0131] The 22nd cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0];

[0132] The 23rd cycle: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,1];

[0133] The 24th period: [cc0,cc1,cc2,cc3,cc4] is [0,1,0,1,0].

[0134] The string 1110 composed of cc4 in the first to fourth cycles above can be converted to hexadecimal to obtain the first digit of the accessed data: E;

[0135] The string 1010 composed of cc4 in cycles 5 through 8 above can be converted to hexadecimal to obtain the second digit of the accessed data: A;

[0136] The string 0000 composed of cc4 in the 9th to 12th cycles above can be converted to hexadecimal to obtain the third bit in the accessed data: 0;

[0137] The string 0000 composed of cc4 in cycles 13 to 16 above, when converted to hexadecimal, gives the fourth bit in the accessed data: 0;

[0138] The string 1110 composed of cc4 in cycles 17-20 above can be converted to hexadecimal to obtain the fifth digit of the accessed data: E;

[0139] The string 1010 composed of cc4 in the 21st to 24th cycles above can be converted into hexadecimal to obtain the sixth digit of the accessed data: A.

[0140] The hexadecimal access data EA00EA consists of 3 bytes, which, when converted to binary, results in a string of 3 * 8 = 24 characters, corresponding to 24 cycles of request signals. If each cycle is 62.5us, then the above process takes 24 * 62.5us = 1500us.

[0141] Please see Figure 4 The feedback data returned by the encoder includes an additional data content field (EDF, EEPROM Field) compared to the access data. The data content field is one byte. For example, if the feedback data can be EA0012EA, the binary string will have 4*8=32 characters, which corresponds to 32 cycles of response signals. If each cycle is 62.5us, then the time taken by the above process is 32*62.5us=2000us.

[0142] 1500us + 2000us = 3500us = 3.5ms. In this protocol, completing one data read takes 3.5ms; however, the write-to-effective time for EEP data is generally 5ms. For non-real-time control components, this 3.5ms data acquisition time is fast enough to meet requirements. This protocol allows for access to position information without losing it while accessing other data. For example, when accessing encoder temperature information, if the encoder temperature access and EEPROM read formats are consistent, the obtained temperature will be delayed by 3.5ms compared to when the temperature occurs. However, for inertial variables like temperature, this 3.5ms delay does not affect detection accuracy. RS485 serial ports from companies like Hechuan, Tamagawa, and Panasonic can all effectively transmit data using the periodic decomposition method of this protocol. Furthermore, the data verification information transmitted in this protocol still serves to verify data stability.

[0143] This embodiment decomposes the data requiring access to other signals when accessing the encoder position into periodic signals for access. This ensures that the encoder's position access information is not lost while accessing other signals. Generally, apart from the real-time signals needed for the encoder's position feedback, other information can have a certain delay, which does not affect performance. This embodiment solves the problem of existing encoder protocols interrupting position access when accessing other information, thus improving the encoder's reliability.

[0144] This application embodiment also provides a data transmission system applied to a driver connected to an encoder, the data transmission system comprising:

[0145] The access data generation module is used to determine the multi-byte command to be transmitted and generate access data corresponding to the multi-byte command;

[0146] The first string conversion module is used to convert all bytes in the accessed data into binary to obtain the first string;

[0147] The request signal generation module is used to configure a corresponding control field for each character in the first string and generate a request signal containing only the control field; wherein, the driver reads the position data of the encoder through the request signal containing only the control field; the encoder returns the position data through the data field in the response signal;

[0148] The request signal sending module is used to send all the request signals to the encoder in the order of the characters of the first string, so that the encoder generates feedback data corresponding to the multi-byte command;

[0149] A response signal receiving module is used to receive the response signal returned by the encoder; wherein, the control field of the response signal is configured according to each character in the second string, and the second string is obtained by performing binary conversion on the feedback data;

[0150] The feedback data restoration module is used to generate the feedback data based on the control fields of all the response signals.

[0151] In this embodiment, after determining the multi-byte command to be transmitted, access data corresponding to the multi-byte command is generated. This embodiment converts the access data into a first string in binary format and configures a corresponding control field for each character in the first string, thereby generating a request signal containing only the control field for each character. Each character in the first string corresponds to a request signal. In this embodiment, all request signals are sent to the encoder sequentially according to the character order of the first string. The encoder can generate feedback data corresponding to the multi-byte command based on the characters carried in the control fields of all the request signals, and perform binary conversion on the feedback data to obtain a second string. A corresponding control field is configured for each character in the second string, and a response signal corresponding to each character in the second string is generated based on the control fields. The driver can reconstruct the feedback data after receiving the response signal. Since the driver reads the encoder's position data through request signals containing only control fields, and the encoder returns the position data through the data field in the response signal, this embodiment transforms the process of accessing the encoder by a multi-byte command into a multi-cycle signal interaction, avoiding interruptions to position access. Therefore, this embodiment can avoid interference from multi-byte commands in obtaining encoder position data and improve the driver's control accuracy over the encoder.

[0152] Furthermore, if the multibyte command is a data read command, the process by which the access data generation module generates access data corresponding to the multibyte command includes: determining the control field value, address field value, and verification field value according to the multibyte command, and generating the access data including the control field value, the address field value, and the verification field value.

[0153] Furthermore, if the multi-byte command is a data write command, the process by which the access data generation module generates access data corresponding to the multi-byte command includes: determining the control field value, address field value, data content, and verification field value according to the multi-byte command, and generating the access data including the control field value, the address field value, the data content, and the verification field value.

[0154] Furthermore, the process by which the feedback data restoration module generates the feedback data based on the control fields of all the response signals includes: determining a single character in the second string based on the control fields of the response signals; concatenating all the single characters of the second string according to the receiving order of the response signals to obtain the second string; and performing the inverse transformation of the binary conversion on the second string to obtain the feedback data.

[0155] Furthermore, it also includes:

[0156] The location data acquisition module is configured to initiate a request to the encoder to read location data via a request signal containing only the control field before determining a single character in the second string based on the control field of the response signal; and is further configured to determine the current location data of the encoder based on the data field in the feedback data after performing the inverse transformation of the binary conversion on the second string to obtain the feedback data.

[0157] This application embodiment also provides a data transmission system applied to an encoder connected to a driver, the data transmission system comprising:

[0158] A request signal receiving module is configured to receive multiple request signals sent by the driver in the character order of a first string; wherein the request signal contains only a control field configured according to a single character of the first string, and the first string is obtained by binary conversion of all bytes in the access data corresponding to a multi-byte command; the driver reads the encoder's position data through the request signal containing only the control field; the encoder returns the position data through the data field in the response signal;

[0159] The splicing module is used to extract characters from the control field of the request signal, and splice all the characters of the first string in the receiving order to obtain the first string;

[0160] The access data restoration module is used to perform the inverse transformation of the binary conversion on the first string to obtain the access data;

[0161] The feedback data generation module is used to execute the operation corresponding to the multi-byte command based on the access data, and generate feedback data corresponding to the multi-byte command.

[0162] The second string conversion module is used to perform binary conversion on the feedback data to obtain a second string;

[0163] The response signal generation module is used to configure a corresponding control field for each character in the second string and generate a response signal containing the control field.

[0164] The response signal sending module is used to send all the response signals to the controller in the order of the characters in the second string, so that the controller generates the feedback data based on the control fields of all the response signals.

[0165] In this embodiment, the encoder and driver transmit data. After determining the multi-byte command to be transmitted, the driver generates access data corresponding to the multi-byte command. The driver converts the access data into a first string in binary format and configures a corresponding control field for each character in the first string, thereby generating a request signal containing only the control field for each character. Each character in the first string corresponds to a request signal, and the driver sends all the request signals to the encoder sequentially according to the character order of the first string. The encoder can generate feedback data corresponding to the multi-byte command based on the characters carried in the control fields of all the request signals, and convert the feedback data into binary to obtain a second string. It configures a corresponding control field for each character in the second string, and then generates a response signal corresponding to each character in the second string based on the control fields. After receiving the response signal, the driver can restore the feedback data. Since the driver reads the encoder's position data through a request signal containing only the control field, and the encoder returns the position data through the data field in the response signal, this embodiment transforms the process of accessing the encoder by a multi-byte command into a multi-cycle signal interaction, which can avoid interruption of position access. Therefore, this embodiment can avoid interference from multi-byte commands in obtaining encoder position data and improve the driver's control accuracy over the encoder.

[0166] Since the embodiments of the system part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the system part, and they will not be repeated here.

[0167] This application also provides a storage medium on which a computer program is stored, which, when executed, can perform the steps provided in the above embodiments. The storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0168] This application also provides an electronic device that may include a memory and a processor. The memory stores a computer program, and when the processor calls the computer program in the memory, it can implement the steps provided in the above embodiments. Of course, the electronic device may also include various network interfaces, power supplies, and other components.

[0169] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.

[0170] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A data transmission method, characterized by, The data transmission method, applied to a driver connected to an encoder, includes: Determine the multi-byte command to be transmitted and generate the access data corresponding to the multi-byte command; Convert all bytes in the accessed data into binary to obtain the first string; Configure a corresponding control field for each character in the first string, and generate a request signal containing only the control field; wherein, the driver reads the encoder's position data through the request signal containing only the control field; the encoder returns the position data through the data field in the response signal; All the request signals are sent to the encoder in the character order of the first string, so that the encoder generates the feedback data corresponding to the multi-byte command; Receive the response signal returned by the encoder; wherein the control field of the response signal is configured according to each character in the second string, and the second string is obtained by binary conversion of the feedback data; The feedback data is generated based on the control fields of all the aforementioned response signals.

2. The data transmission method of claim 1, wherein, If the multi-byte command is a data read command, then the access data corresponding to the multi-byte command is generated, including: The control field value, address field value, and check field value are determined according to the multi-byte command, and the access data including the control field value, the address field value, and the check field value is generated.

3. The data transmission method of claim 1, wherein, If the multi-byte command is a data write command, then the access data corresponding to the multi-byte command is generated, including: The control field value, address field value, data content, and verification field value are determined according to the multi-byte command, and the access data including the control field value, address field value, data content, and verification field value is generated.

4. The data transmission method of claim 1, wherein, The feedback data is generated based on the control fields of all the aforementioned response signals, including: A single character in the second string is determined based on the control field of the response signal; The second string is obtained by concatenating all the individual characters of the second string according to the order in which the response signals are received; Perform the inverse transformation of the binary conversion on the second string to obtain the feedback data.

5. The data transmission method of claim 4, wherein, Before determining a single character in the second string based on the control field of the response signal, the method further includes: A request to read position data is initiated to the encoder by a request signal containing only the control field; Accordingly, after performing the inverse transformation of the binary conversion on the second string to obtain the feedback data, the process further includes: The current position data of the encoder is determined based on the data fields in the response signal.

6. A data transmission method, characterized by, The data transmission method, applied to an encoder connected to a driver, includes: The driver receives multiple request signals sent by the driver in the character order of a first string; wherein the request signal contains only a control field configured according to a single character of the first string, and the first string is obtained by binary conversion of all bytes in the access data corresponding to a multi-byte command; the driver reads the encoder's position data through the request signal containing only the control field; the encoder returns the position data through the data field in the response signal; Extract characters from the control field of the request signal, and concatenate all characters of the first string in the order of receipt to obtain the first string; Perform the inverse transformation of the binary conversion on the first string to obtain the accessed data; Execute the operation corresponding to the multi-byte command based on the access data, and generate feedback data corresponding to the multi-byte command; The feedback data is converted to binary to obtain a second string; Configure a corresponding control field for each character in the second string, and generate a response signal containing the control field; All the response signals are sent to the driver in the character order of the second string, so that the driver generates the feedback data based on the control fields of all the response signals.

7. A data transmission system, characterized by The data transmission system, applied to a driver connected to an encoder, includes: The access data generation module is used to determine the multi-byte command to be transmitted and generate access data corresponding to the multi-byte command; The first string conversion module is used to convert all bytes in the accessed data into binary to obtain the first string; The request signal generation module is used to configure a corresponding control field for each character in the first string and generate a request signal containing only the control field; wherein, the driver reads the position data of the encoder through the request signal containing only the control field; the encoder returns the position data through the data field in the response signal; The request signal sending module is used to send all the request signals to the encoder in the order of the characters of the first string, so that the encoder generates feedback data corresponding to the multi-byte command; A response signal receiving module is used to receive the response signal returned by the encoder; wherein, the control field of the response signal is configured according to each character in the second string, and the second string is obtained by performing binary conversion on the feedback data; The feedback data restoration module is used to generate the feedback data based on the control fields of all the response signals.

8. A data transmission system, characterized by The data transmission system, applied to an encoder connected to a driver, includes: A request signal receiving module is configured to receive multiple request signals sent by the driver in the character order of a first string; wherein the request signal contains only a control field configured according to a single character of the first string, and the first string is obtained by binary conversion of all bytes in the access data corresponding to a multi-byte command; the driver reads the encoder's position data through the request signal containing only the control field; and the encoder returns the position data through the data field in the response signal. The splicing module is used to extract characters from the control field of the request signal, and splice all the characters of the first string in the receiving order to obtain the first string; The access data restoration module is used to perform the inverse transformation of the binary conversion on the first string to obtain the access data; The feedback data generation module is used to execute the operation corresponding to the multi-byte command based on the access data, and generate feedback data corresponding to the multi-byte command. The second string conversion module is used to perform binary conversion on the feedback data to obtain a second string; The response signal generation module is used to configure a corresponding control field for each character in the second string and generate a response signal containing the control field. The response signal sending module is used to send all the response signals sequentially to the driver according to the character arrangement order of the second string, so that the driver generates the feedback data based on the control fields of all the response signals.

9. An electronic device, comprising: It includes a memory and a processor, wherein the memory stores a computer program, and the processor, when calling the computer program in the memory, implements the steps of the data transmission method as described in any one of claims 1 to 6.

10. A storage medium, characterized by The storage medium stores computer-executable commands, which, when loaded and executed by a processor, implement the steps of the data transmission method as described in any one of claims 1 to 6.