Communication method of encoder, encoder and encoder control system

By introducing time data when transmitting position data in the servo control system, the encoder delays the acquisition and sending target position data, solving the problem of inconsistent position data acquisition timing and current sampling timing in the prior art, improving the real-time and Accuracy improves closed-loop control performance and reduces cost and complexity.

CN119011349APending Publication Date: 2024-11-22GEEHY SEMICON CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411147200.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

The prior art when transmitting position data in a servo control system has low closed-loop performance, resulting in inconsistent with the timing of position data acquisition and current sampling, affecting the system's real-time response performance and control accuracy.

Method used

By adding time data when transmitting position data between the servo driver and the encoder, the encoder acquires the target position data according to the time data delay, and sends the position data when the delay time is reached. The servo driver starts current sampling based on the time data. This accurately controls the acquisition timing of target position data and minimizes the delay of target position data.

Benefits of technology

It improves the real-time and accuracy of the servo control system, improves the performance of the closed-loop control system, and reduces the cost and complexity of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119011349A_ABST
    Figure CN119011349A_ABST
Patent Text Reader

Abstract

The invention provides a communication method of an encoder, the encoder and an encoder control system, and relates to the technical field of communication, the communication method of the encoder comprises the steps that a servo driver sends a first instruction to the encoder, and the first instruction is used for indicating transmission time data; the encoder obtains target position data in a delayed mode according to the time data; the servo driver sends a second instruction to the encoder according to the time data and starts current sampling, and the second instruction is used for indicating transmission position data; the encoder sends target position data to the servo driver according to the second instruction; the servo driver adjusts the drive signal based on the target position data. The performance of the closed-loop control system can be effectively improved, and the cost and complexity of the closed-loop control system can be reduced while the operation efficiency and precision of the closed-loop control system are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a communication method of an encoder, an encoder, and an encoder control system. Background Art

[0002] An encoder is a sensor used to measure position, speed or angle. It can convert mechanical motion into electrical signals and feed these signals back to the control system to achieve closed-loop control. For example, in a servo control system, high-precision motion control can be achieved through the collaborative work of the servo drive and the encoder.

[0003] At present, when performing closed-loop control, the servo driver first samples the current, and then sends a command to the encoder for obtaining position data; the encoder obtains the position data according to the command, and sends the position data to the servo driver, so that the servo driver adjusts the drive signal based on the position data. However, the closed-loop performance is not high when transmitting position data in the above manner. Summary of the invention

[0004] The present application provides an encoder communication method, an encoder, and an encoder control system to solve the problem of low closed-loop performance when transmitting position data through the current method.

[0005] In a first aspect, the present application provides a communication method of an encoder, comprising:

[0006] The servo driver sends a first instruction to the encoder, the first instruction is used to indicate transmission time data, and the encoder receives the first instruction;

[0007] The encoder obtains the target position data with delay according to the time data;

[0008] The servo driver sends a second instruction to the encoder according to the time data and starts current sampling. The second instruction is used to instruct the transmission of position data, and the encoder receives the second instruction.

[0009] The encoder sends the target position data to the servo driver according to the second instruction, and the servo driver receives the target position data;

[0010] The servo drive adjusts the drive signal based on the target position data.

[0011] Optionally, the time data does not include a delay duration, and the encoder obtains the target position data by delaying according to the time data, including: determining the delay duration, where the delay duration is the preparation time of the encoder for the target position data; sending the delay duration to the servo driver so that the servo driver sends a second instruction according to the delay duration; and obtaining the target position data when the delay duration is reached.

[0012] Optionally, the servo driver sends a second instruction to the encoder according to the time data and starts current sampling, including: receiving a delay time sent by the encoder; when the delay time is reached, sending a second instruction to the encoder and starting current sampling.

[0013] Optionally, the time data includes a delay duration, and the encoder obtains the target position data with a delay according to the time data, including: obtaining the target position data when the delay duration is reached.

[0014] Optionally, the servo driver sends a second instruction to the encoder according to the time data and starts current sampling, including: when the delay time is reached, sending the second instruction to the encoder and starting current sampling.

[0015] In a second aspect, the present application provides an encoder, comprising: a protocol communication module, a microcontroller unit (MCU) and a position decoding module;

[0016] The protocol communication module is used to receive a first instruction sent by the servo driver, the first instruction is used to indicate the transmission of time data, and send the time data to the MCU; and receive a second instruction sent by the servo driver, and send the second instruction to the MCU, the second instruction is used to indicate the transmission of position data, and the second instruction is sent by the servo driver at the same time as starting current sampling according to the time data;

[0017] MCU, used for receiving time data sent by the protocol communication module, controlling the position decoding module to delay obtaining target position data according to the time data; and receiving a second instruction sent by the protocol communication module, obtaining the target position data from the position decoding module according to the second instruction, and sending the target position data to the servo driver through the protocol communication module, so that the servo driver adjusts the driving signal based on the target position data;

[0018] The position decoding module is used to obtain target position data.

[0019] Optionally, the first instruction is sent when the MCU of the servo driver triggers a CMPA synchronization signal of the first comparison register.

[0020] Optionally, the second instruction is sent when the MCU of the servo driver triggers a synchronization signal of the second comparison register CMPB.

[0021] Optionally, the protocol rule corresponding to the first instruction includes frame data corresponding to the time data, and the protocol rule corresponding to the second instruction includes frame data corresponding to the target position data.

[0022] In a third aspect, the present application provides an encoder control system, comprising: an encoder and a servo driver;

[0023] An encoder and a servo driver are used to execute the communication method of the encoder as described in the first aspect of the present application.

[0024] The communication method, encoder and encoder control system of the encoder provided in the present application, send a first instruction to the encoder through the servo driver, the first instruction is used to indicate the transmission time data; the encoder obtains the target position data with a delay according to the time data; the servo driver sends a second instruction to the encoder according to the time data and starts current sampling, the second instruction is used to indicate the transmission position data; the encoder sends the target position data to the servo driver according to the second instruction; the servo driver adjusts the drive signal based on the target position data. In the present application, based on the time data indicated by the first instruction, the encoder obtains the target position data with a delay, and the servo driver starts current sampling, and obtains the target position data from the encoder through the second instruction, which can accurately control the acquisition timing of the target position data, minimize the delay of the target position data, so that the target position data obtained by the servo driver from the encoder is real-time and up-to-date, improve the real-time, accuracy and stability of the servo control system, thereby improving the performance of the closed-loop control system, while ensuring the operating efficiency and accuracy of the closed-loop control system, the cost and complexity of the closed-loop control system can be reduced. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0026] Figure 1 A timing diagram of a servo control system provided by current related technologies;

[0027] Figure 2 The process of the communication method of the encoder provided in the embodiment of the present application Figure 1 ;

[0028] Figure 3 The process of the communication method of the encoder provided in the embodiment of the present application Figure 2 ;

[0029] Figure 4 A timing relationship diagram of a servo control system provided in one embodiment of the present application;

[0030] Figure 5 The process of the communication method of the encoder provided in one embodiment of the present application Figure 3 ;

[0031] Figure 6A schematic diagram of the structure of an encoder provided in one embodiment of the present application;

[0032] Figure 7 A schematic diagram of an implementation example of a bus interaction protocol provided in an embodiment of the present application;

[0033] Figure 8 The process of the communication method of the encoder provided in one embodiment of the present application Figure 4 ;

[0034] Fig. 9 A schematic diagram of an encoder control system provided in one embodiment of the present application;

[0035] Fig.10 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0037] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0038] At present, in a servo control system, when closed-loop control is performed, the servo driver first samples the current, and then sends an instruction to the encoder for obtaining position data; the encoder obtains the position data according to the instruction, and sends the position data to the servo driver, so that the servo driver adjusts the drive signal based on the position data. However, the transmission of position data in the above manner has the problem of low closed-loop performance.

[0039] Specifically, current encoders usually implement RS485 (a standard for serial communication) communication, and the general protocol rules are similar. However, the key information provided by the current encoder is mainly position data, in addition, there are status information and alarm information. Taking the currently common Tamagawa protocol as an example, when obtaining single-turn position data, the servo drive sends a command (CF command) for obtaining single-turn position data to the encoder. After a delay of 2 microseconds to 4 microseconds, the single-turn position data can be obtained through the data frame returned by the encoder. However, when the servo drive sends the CF command, the encoder cannot complete the data decoding from receiving the CF command within 4 microseconds. Therefore, the single-turn position data obtained by the servo drive is the data of the previous cycle. For closed-loop control, there are two key factors for the feedback of position data, namely the accuracy of position data and the timing of acquisition. The current bus protocol often only pays attention to completing the acquisition of position data, but ignores the importance of the timing of acquisition. Since the position data must participate in the closed-loop calculation or part of the compensation algorithm, the responsiveness of the position data is extremely important for the performance of the closed-loop system. If the timing of current sampling is too different from the timing of obtaining position data, it will have a great impact on the closed-loop performance, resulting in poor closed-loop performance.

[0040] Figure 1 The timing relationship diagram of the servo control system provided by the current related technology, such as Figure 1 As shown, it can be understood that in the field of servo motor control, a pulse width modulation (PWM) wave is generally generated, and the PWM wave is used to provide current input to the servo motor to control the operation of the servo motor. Figure 1 The time relationship of the running nodes of each link in the servo motor control is shown. The core control program of the servo motor, taking space vector control as an example, in the embedded development of MCU, the corresponding code needs to be executed in the PWM interrupt. The triggering of the PWM interrupt involves the PWM counter. The counting mode can be selected as increase or decrease counting. After setting the counting cycle (prd), the triggering mode of the PWM interrupt is configured as the count value cnt=0, then the interrupt can be triggered periodically. In the PWM module, by setting the comparison value (compare), when the count value cnt of the timer is less than compare, the PWM output pin outputs a low level; when the count value cnt of the timer is greater than compare, the PWM output pin outputs a high level, thereby controlling the PWM output pin to output high and low level signals with different duty cycles, that is, PWM waves. The control of the servo motor is through closed-loop calculation, calculating the compare value at each time point, and generating a PWM wave output with a corresponding duty cycle. Reference Figure 1, current sampling is obtained through an analog-to-digital converter (ADC), and position data is obtained through data interaction with a position sensor via an RS485 bus. The current timing of obtaining position data is inconsistent with the timing of current sampling, that is, the timing of obtaining position data is after the timing of current sampling. There is a cycle delay in obtaining the encoder's position data because the encoder's data processing speed does not support giving the current position data within 2 microseconds, which affects the real-time response performance of the servo control system; for the interrupt status, the start point and the end point of the interrupt are shown, that is, a high level indicates that the interrupt is in operation; for the PWM output waveform, the waveform of the PWM wave output at the current moment is shown.

[0041] It can be seen that when transmitting position data in the current way, the bus protocol only focuses on completing the acquisition of position data, ignoring the importance of the acquisition timing. If the timing of current sampling is too different from the timing of position data acquisition, it will have a great impact on the closed-loop performance, resulting in low closed-loop performance. At the same time, due to the delay of the encoder processing position data, the acquired position data is the data of the previous cycle, which will also affect the real-time control performance of the system's servo control system.

[0042] Based on the above problems, the present application provides an encoder communication method, an encoder and an encoder control system. On the basis of transmitting position data between the servo drive and the encoder, the concept of timing for acquiring position data is added, that is, the data transmitted between the servo drive and the encoder not only includes position data but also time data; based on the time data, the encoder obtains target position data with a delay. At the same time, the servo drive starts current sampling and obtains target position data from the encoder. The timing for acquiring the target position data can be accurately controlled, and the delay of the target position data can be minimized, so that the target position data obtained by the servo drive from the encoder is real-time and up-to-date, thereby improving the real-time performance of the servo control system; the acquisition of the target position data is carried out synchronously with the current sampling, which helps to improve the accuracy and stability of the closed-loop control system, thereby effectively improving the performance of the closed-loop control system.

[0043] In addition, by separating the instructions of position data and time data and designing them according to different schemes, the flexibility and adaptability of the servo control system can be increased.

[0044] The technical solution of the present application is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0045] Figure 2 The process of the communication method of the encoder provided in the embodiment of the present application Figure 1 .like Figure 2 As shown, the method of the embodiment of the present application includes:

[0046] S201: The servo driver sends a first instruction to the encoder, where the first instruction is used to indicate transmission time data. Correspondingly, the encoder receives the first instruction sent by the servo driver.

[0047] In the embodiments of the present application, it can be understood that on the basis of the current transmission of position data between the servo drive and the encoder (for example, through the CF instruction), the concept of the timing of obtaining the position data is added, that is, the data transmitted between the servo drive and the encoder not only includes the position data, but also includes the time data. The instructions for transmitting the position data and the time data are set separately, and the instruction for transmitting the time data is the first instruction, and the first instruction is represented by the CF1 instruction, for example; the instruction for transmitting the position data is the second instruction, and the second instruction is represented by the CF2 instruction, for example. The latest position data is obtained in real time through the mutual cooperation of the first instruction and the second instruction. By separating the instructions for position data and time data, different designs can be used to increase the flexibility and adaptability of the system.

[0048] In this step, exemplarily, when the servo driver obtains the target position data from the encoder, it first sends a first instruction to the encoder through the bus, and the first instruction is used to indicate the transmission time data. Correspondingly, the encoder receives the first instruction sent by the servo driver. For example, if the time data does not include the delay duration for obtaining the target position data, the delay duration can be obtained from the encoder through the first instruction. If the time data includes the delay duration for obtaining the target position data, the encoder can decode the first instruction to obtain the delay duration.

[0049] S202, the encoder obtains target position data with delay according to the time data.

[0050] Exemplarily, the target position data is, for example, single-turn position data. The encoder can obtain the target position data with a delay according to the time data. For example, the encoder performs internal data processing and preparation within the delay time, and prepares accurate position data, i.e., the target position data, when the delay time is reached, so that when the second instruction sent by the servo driver is received, the prepared target position data is directly sent to the servo driver. For how the encoder obtains the target position data with a delay according to the time data, please refer to the subsequent embodiments, which will not be repeated here.

[0051] S203, the servo driver sends a second instruction to the encoder according to the time data and starts current sampling, the second instruction is used to instruct the transmission of position data. Correspondingly, the encoder receives the second instruction sent by the servo driver.

[0052] Exemplarily, the servo driver can start an internal timer to count based on the time data. For example, when the timer count reaches the delay time, the servo driver sends a second instruction to the encoder through the bus to instruct the encoder to transmit the position data and start current sampling. Correspondingly, the encoder receives the second instruction sent by the servo driver. It can be understood that based on the time data, the encoder prepares the target position data. At the same time, based on the time data, the servo driver sends the second instruction to the encoder and starts current sampling, which can minimize the delay of the target position data, so that the target position data obtained by the servo driver from the encoder can be real-time and up-to-date.

[0053] It should be noted that the embodiment of the present application does not limit the order in which steps S202 and S203 are executed.

[0054] S204: The encoder sends the target position data to the servo driver according to the second instruction. Correspondingly, the servo driver receives the target position data sent by the encoder.

[0055] Exemplarily, after receiving the second instruction sent by the servo driver, the encoder packs the prepared target position data into a data frame and sends the target position data to the servo driver via the bus. Correspondingly, the servo driver receives the target position data sent by the encoder.

[0056] S205. The servo driver adjusts the drive signal based on the target position data.

[0057] For example, after receiving the target position data sent by the encoder, the servo driver can parse and obtain the current accurate position data. The servo driver compares the obtained position data with the expected value, executes the closed-loop control algorithm, and adjusts the drive signal to achieve precise control.

[0058] The communication method of the encoder provided in the embodiment of the present application is to send a first instruction to the encoder through the servo driver, the first instruction is used to indicate the transmission time data; the encoder obtains the target position data with a delay according to the time data; the servo driver sends a second instruction to the encoder according to the time data and starts current sampling, the second instruction is used to indicate the transmission position data; the encoder sends the target position data to the servo driver according to the second instruction; the servo driver adjusts the drive signal based on the target position data. In the embodiment of the present application, based on the time data indicated by the first instruction, the encoder delays to obtain the target position data, and the servo driver starts current sampling, and obtains the target position data from the encoder through the second instruction, which can accurately control the acquisition timing of the target position data, minimize the delay of the target position data, so that the target position data obtained by the servo driver from the encoder is real-time and up-to-date, improve the real-time, accuracy and stability of the servo control system, thereby improving the performance of the closed-loop control system, while ensuring the operating efficiency and accuracy of the closed-loop control system, the cost and complexity of the closed-loop control system can be reduced.

[0059] Based on the above embodiment, in a possible embodiment, the time data is given by an encoder. Figure 3 The process of the communication method of the encoder provided in the embodiment of the present application Figure 2 .like Figure 3 As shown, the method of the embodiment of the present application may include:

[0060] S301. The servo driver sends a first instruction to the encoder. The first instruction is used to indicate transmission time data, and the time data does not include a delay duration.

[0061] Correspondingly, the encoder receives the first instruction sent by the servo driver.

[0062] In this step, the time data is given by the encoder. Therefore, the servo driver sends the first instruction to the encoder through the bus. The time data does not include the delay time. The first instruction is used to request the encoder to obtain the preparation time for the position data of the next cycle, that is, the delay time. Accordingly, the encoder receives the first instruction sent by the servo driver. For other detailed descriptions of this step, please refer to Figure 2 Relevant description of S201 in the illustrated embodiment.

[0063] S302: The encoder determines a delay time, where the delay time is the preparation time of the encoder for the target position data.

[0064] Exemplarily, after receiving the first instruction sent by the servo driver, the encoder determines the preparation time of the position data of the next cycle according to the current working state and internal calculation logic, that is, determines the delay time for preparing the target position data.

[0065] S303: The encoder sends a delay time to the servo driver.

[0066] Correspondingly, the servo drive receives the delay time sent by the encoder.

[0067] Exemplarily, after determining the delay time, the encoder packages the delay time into a data frame and sends it to the servo driver via the bus. Correspondingly, the servo driver receives the delay time sent by the encoder.

[0068] S304: When the delay time is reached, the encoder obtains the target position data.

[0069] Exemplarily, the encoder performs internal data processing and preparation within the delay time, and prepares accurate position data, namely, target position data, when the delay time is reached.

[0070] S305. When the delay time is reached, the servo driver sends a second instruction to the encoder and starts current sampling. The second instruction is used to instruct the transmission of position data.

[0071] Correspondingly, the encoder receives the second instruction sent by the servo driver.

[0072] Exemplarily, after receiving a data frame including a delay time length sent by the encoder, the servo driver parses the data frame to obtain the delay time length. The servo driver starts an internal timer to count, and when the timer count reaches the delay time length, the servo driver sends a second instruction to the encoder through the bus to instruct the encoder to transmit position data and start current sampling. For example, if the servo driver sets a current sampling flag, the current sampling hardware module is turned on to prepare for collecting current data.

[0073] It should be noted that the embodiment of the present application does not limit the order in which steps S304 and S305 are executed.

[0074] S306: The encoder sends target position data to the servo driver according to the second instruction.

[0075] Correspondingly, the servo drive receives the target position data sent by the encoder.

[0076] The detailed description of this step can be found in Figure 2 The relevant description of S204 in the illustrated embodiment will not be repeated here.

[0077] S307: The servo driver adjusts the drive signal based on the target position data.

[0078] The detailed description of this step can be found in Figure 2 The relevant description of S205 in the illustrated embodiment will not be repeated here.

[0079] Based on the above steps, Figure 4 A timing diagram of a servo control system provided in an embodiment of the present application, such as Figure 4 As shown, the delay time is represented by T, which is Figure 1 In comparison, "Original location data acquisition" corresponds to Figure 1 The current location data acquisition timing shown is based on the delay time T, the location data acquisition timing of the embodiment of the present application (corresponding to Figure 4 The "improved position data acquisition" in the figure is basically consistent with the timing of current sampling, which can minimize the target position data delay and make the target position data obtained by the servo drive from the encoder real-time and up-to-date.

[0080] The communication method of the encoder provided in the embodiment of the present application is to send a first instruction to the encoder through the servo driver, the first instruction is used to indicate the transmission time data, and the time data does not include the delay time; the encoder determines the delay time, the delay time is the preparation time of the encoder for the target position data, and sends the delay time to the servo driver; the encoder obtains the target position data when the delay time is reached, and at the same time, the servo driver sends a second instruction to the encoder when the delay time is reached, and starts current sampling; the encoder sends the target position data to the servo driver according to the second instruction, and the servo driver adjusts the drive signal based on the target position data. In the embodiment of the present application, the encoder determines the delay time, and when the delay time is reached, the encoder obtains the target position data, and the servo driver starts current sampling, and obtains the target position data from the encoder through the second instruction, which can accurately control the acquisition timing of the target position data, minimize the delay of the target position data, so that the target position data obtained by the servo driver from the encoder is real-time and up-to-date, and the real-time, accuracy and stability of the servo control system are improved, thereby improving the performance of the closed-loop control system, while ensuring the operating efficiency and accuracy of the closed-loop control system, the cost and complexity of the closed-loop control system can be reduced.

[0081] Based on the above embodiment, in another possible embodiment, the time data is given by a servo driver. Figure 5 The process of the communication method of the encoder provided in one embodiment of the present application Figure 3 .

[0082] like Figure 5 As shown, the method of the embodiment of the present application may include:

[0083] S501. The servo driver sends a first instruction to the encoder, where the first instruction is used to indicate transmission time data, and the time data includes a delay duration.

[0084] Correspondingly, the encoder receives the first instruction sent by the servo driver.

[0085] In this step, the time data is given by the servo driver. Therefore, the servo driver sends a first instruction to the encoder through the bus. The first instruction is used to indicate the transmission time data. The time data includes the delay time. The servo driver requests the encoder to prepare the target position data within the delay time through the first instruction. The format of the first instruction is, for example: CF1+delay time T+specific request parameters, where the specific request parameters may include the current status information of the encoder. For other detailed descriptions of this step, please refer to Figure 2 The relevant description of S201 in the illustrated embodiment will not be repeated here.

[0086] S502: When the delay time is reached, the encoder obtains target position data.

[0087] For example, the encoder performs internal data processing and preparation within the delay time, and when the delay time is reached, the accurate position data, i.e., the target position data, is prepared.

[0088] S503: When the delay time is reached, the servo driver sends a second instruction to the encoder and starts current sampling.

[0089] Correspondingly, the encoder receives the second instruction sent by the servo driver.

[0090] Exemplarily, after sending the first instruction, the servo driver starts the internal timer to count. When the timer count reaches the delay time, the servo driver sends the second instruction to the encoder through the bus. The format of the second instruction is, for example, CF2+specific position request parameter to instruct the encoder to transmit position data and start current sampling. For example, if the servo driver sets the current sampling flag, the current sampling hardware module is turned on to prepare for collecting current data.

[0091] It should be noted that the embodiment of the present application does not limit the order in which steps S502 and S503 are executed.

[0092] S504: The encoder sends target position data to the servo driver according to the second instruction.

[0093] Correspondingly, the servo drive receives the target position data sent by the encoder.

[0094] The detailed description of this step can be found in Figure 2 The relevant description of S204 in the illustrated embodiment will not be repeated here.

[0095] S505: The servo driver adjusts the drive signal based on the target position data.

[0096] The detailed description of this step can be found in Figure 2 The relevant description of S205 in the illustrated embodiment will not be repeated here.

[0097] Based on the above steps, we can obtain Figure 4 The timing relationship shown, that is, the timing of acquiring the target position data in the embodiment of the present application is basically consistent with the timing of current sampling, which can minimize the delay of the target position data.

[0098] The communication method of the encoder provided in the embodiment of the present application is to send a first instruction to the encoder through the servo driver, the first instruction is used to indicate the transmission time data, and the time data includes the delay time; when the encoder reaches the delay time, the target position data is obtained, and at the same time, when the servo driver reaches the delay time, the encoder sends a second instruction to the encoder and starts current sampling; the encoder sends the target position data to the servo driver according to the second instruction, and the servo driver adjusts the drive signal based on the target position data. In the embodiment of the present application, the delay time is determined by the servo driver, and when the delay time is reached, the encoder obtains the target position data, and the servo driver starts current sampling, and the target position data is obtained from the encoder through the second instruction, which can accurately control the acquisition timing of the target position data, minimize the delay of the target position data, so that the target position data obtained by the servo driver from the encoder is real-time and up-to-date, and the real-time, accuracy and stability of the servo control system are improved, thereby improving the performance of the closed-loop control system, and while ensuring the operating efficiency and accuracy of the closed-loop control system, the cost and complexity of the closed-loop control system can be reduced.

[0099] Based on the above embodiments, Figure 6 This is a schematic diagram of the structure of an encoder provided in one embodiment of the present application. Figure 6 As shown, the encoder 600 of the embodiment of the present application includes: a protocol communication module 601, an MCU 602 and a position decoding module 603. Among them:

[0100] The protocol communication module 601 is used to receive a first instruction sent by the servo driver, the first instruction is used to indicate the transmission time data, and send the time data to the MCU 602; and receive a second instruction sent by the servo driver, and send a second instruction to the MCU 602, the second instruction is used to indicate the transmission position data, and the second instruction is sent by the servo driver at the same time as starting current sampling according to the time data.

[0101] MCU 602 is used to receive the time data sent by the protocol communication module 601, and control the position decoding module 603 to delay obtaining the target position data according to the time data; and receive the second instruction sent by the protocol communication module 601, obtain the target position data from the position decoding module 603 according to the second instruction, and send the target position data to the servo driver through the protocol communication module 601, so that the servo driver adjusts the drive signal based on the target position data.

[0102] The position decoding module 603 is used to obtain target position data.

[0103] Optionally, the first instruction is sent when the MCU of the servo driver triggers a CMPA synchronization signal of the first comparison register.

[0104] Optionally, the second instruction is sent when the MCU of the servo driver triggers a synchronization signal of the second comparison register CMPB.

[0105] It can be understood that the time data can be controlled by using a PWM timer through the MCU of the servo driver, that is, the MCU of the servo driver triggers the CMPA synchronization signal to send a first instruction to the encoder, and the MCU of the servo driver triggers the CMPB synchronization signal to send a second instruction to the encoder. The time difference between the first instruction and the second instruction can be specifically changed by controlling the load values ​​of CMPA and CMPB.

[0106] Optionally, the protocol rule corresponding to the first instruction includes frame data corresponding to the time data, and the protocol rule corresponding to the second instruction includes frame data corresponding to the target position data.

[0107] It can be understood that the functional implementation of the embodiment of the present application includes the control logic of the servo drive, the control logic of the encoder and the bus interaction protocol. For example, Figure 7 A schematic diagram of an implementation example of a bus interaction protocol provided in an embodiment of the present application is shown as follows: Figure 7 As shown, the relevant information of data transmission and data reception corresponding to the first instruction and the relevant information of data transmission and data reception corresponding to the second instruction are shown. Among them, for the relevant information of data transmission corresponding to the first instruction, CF1 is the first instruction, DT1 represents the low 8 bits of the delay time, DT2 represents the middle 8 bits of the delay time, DT3 represents the high 8 bits of the delay time, and the cyclic redundancy check (CRC) is used to verify the transmitted data, and the DT1, DT2 and DT3 are the frame data corresponding to the time data; for the relevant information of data reception corresponding to the first instruction, CF1 is the first instruction, ST represents the state of the encoder, and CRC is used to verify the received data. For the relevant information of data transmission corresponding to the second instruction, CF2 is the second instruction; for the relevant information of data reception corresponding to the second instruction, CF2 is the second instruction, ST represents the state of the encoder, DT1 represents the low 8 bits of the position data, DT2 represents the middle 8 bits of the position data, and DT3 represents the high 8 bits of the position data. In the embodiment of the present application, the DT1, DT2 and DT3 are the frame data corresponding to the target position data, and CRC is used to verify the received data. Reference Figure 7,By changing the bus interaction protocol, the responsiveness and reliability of the ,position data can be effectively improved.

[0108] In this embodiment, it can be understood that the servo driver adjusts the drive signal based on the target position data to control the operation of the servo motor.

[0109] The encoder provided in the embodiment of the present application obtains target position data with a delay based on the time data indicated by the first instruction, and sends the target position data to the servo driver according to the second instruction, wherein the second instruction is sent by the servo driver at the same time as starting current sampling according to the time data. The encoder can accurately control the timing of obtaining the target position data and minimize the delay of the target position data, so that the target position data obtained by the servo drive from the encoder is real-time and up-to-date, thereby improving the real-time performance, accuracy and stability of the servo control system, thereby improving the performance of the closed-loop control system.

[0110] Figure 8 The process of the communication method of the encoder provided in one embodiment of the present application Figure 4 .based on Figure 6 , the embodiment of the present application further describes the communication method of the encoder. Figure 8 As shown, the method of the embodiment of the present application may include:

[0111] S801. Acquire the current sampling trigger time through the MCU of the servo driver to obtain the current sampling duration (for example, represented by T1).

[0112] S802, using a PWM timer through the MCU of the servo driver to control the delay time T. The MCU of the servo driver accurately controls the duty cycle based on the first comparison register (CMPA) or the second comparison register (CMPB) synchronization signal event, and the duty cycle represents the delay time T. Exemplarily, the delay time T is, for example, T=T1+T2+T3, wherein T2 represents the duration of encoder data communication, and T3 represents the duration of the encoder MCU performing position decoding and processing (i.e., the preparation time of the target position data).

[0113] S803, triggering a CMPA synchronization signal through the MCU of the servo driver, and sending a first instruction to the encoder; wherein the content of the first instruction is the delay time T; the format of the first instruction is, for example: CF1+delay time T+specific request parameters, wherein the specific request parameters may include the current state information of the encoder. Correspondingly, the encoder receives the first instruction.

[0114] S804. After receiving the delay time T, the encoder obtains the target position data through the MCU of the encoder according to the delay time T, that is, the delayed data is decoded through the MCU of the encoder. When the delay time T is reached, the current accurate position information is obtained and prepared through the MCU of the encoder to obtain the target position data.

[0115] S805, triggering the CMPB synchronization signal through the MCU of the servo driver, and the MCU of the servo driver sends a second instruction to the encoder, and the content of the second instruction is to obtain the target position data; wherein, the time difference between the first instruction and the second instruction can be specifically changed by controlling the loading values ​​of CMPA and CMPB, and at the same time, the current sampling flag is set by the MCU of the servo driver, and the current sampling hardware module is turned on to prepare to collect current data. Accordingly, the encoder receives the second instruction.

[0116] It should be noted that the embodiment of the present application does not limit the order in which steps S804 and S805 are executed.

[0117] S806: After receiving the second instruction, the encoder sends the target position data to the servo driver through the MCU of the encoder according to the second instruction. Correspondingly, the servo driver receives the target position data.

[0118] S807. After receiving the target position data sent by the encoder, the servo driver parses the target position data through the MCU of the servo driver and obtains the current precise position data, compares the obtained current precise position data with the expected value, executes the closed-loop control algorithm, and adjusts the drive signal to achieve precise control.

[0119] It can be understood that through the above steps, the position data of the encoder after a certain delay can be accurately obtained.

[0120] The communication method of the encoder provided in the embodiment of the present application obtains the sampling trigger time of the current through the MCU of the servo driver, obtains the current sampling duration, and adopts a PWM timer to control the delay duration; triggers the CMPA synchronization signal through the MCU of the servo driver, and sends a first instruction to the encoder, and the content of the first instruction is the delay duration; after receiving the delay duration, the encoder obtains the target position data through the MCU of the encoder according to the delay duration T; triggers the CMPB synchronization signal through the MCU of the servo driver, and the MCU of the servo driver sends the second instruction to the encoder; after receiving the second instruction, the encoder sends the target position data to the servo driver through the MCU of the encoder; after receiving the target position data sent by the encoder, the servo driver adjusts the drive signal based on the target position data through the MCU of the servo driver to achieve precise control. In an embodiment of the present application, the delay duration is determined by the MCU of the servo driver, and a PWM timer is used to control the delay duration T. When the delay duration is reached, the MCU of the encoder obtains the target position data, and the MCU of the servo driver starts current sampling, and obtains the target position data from the encoder through a second instruction. The timing of obtaining the target position data can be accurately controlled, and the delay of the target position data can be minimized, so that the target position data obtained by the servo driver from the encoder is real-time and up-to-date, thereby improving the real-time performance, accuracy and stability of the servo control system, thereby improving the performance of the closed-loop control system, and reducing the cost and complexity of the closed-loop control system while ensuring the operating efficiency and accuracy of the closed-loop control system.

[0121] Based on the above embodiments, by separating the instructions of position data and time data and designing according to different schemes to obtain the target position data in real time, the flexibility and adaptability of the servo control system can be increased.

[0122] Fig. 9 A schematic diagram of an encoder control system provided in an embodiment of the present application, such as Fig. 9 As shown, the encoder control system 900 includes an encoder 901 and a servo driver 902, and the encoder 901 is in communication connection with the servo driver 902. The encoder 901 can be used Figure 6 The structure of the embodiment can be executed accordingly. Figure 2 , Figure 3 , Figure 5 or Figure 8 The technical solution of the embodiment has similar implementation principles and technical effects, which will not be repeated here. The servo driver 902 can execute Figure 2 , Figure 3 , Figure 5 or Figure 8 The technical solutions of the embodiments have similar implementation principles and technical effects, which will not be described in detail here.

[0123] Fig.10 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Fig.10 As shown, the electronic device 1000 may include: at least one processor 1001 and a memory 1002 .

[0124] The memory 1002 is used to store programs. Specifically, the programs may include program codes, and the program codes include computer-executable instructions.

[0125] The memory 1002 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0126] The processor 1001 is used to execute the computer-executable instructions stored in the memory 1002 to implement the communication method of the encoder described in the aforementioned method embodiment. Among them, the processor 1001 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. Specifically, when implementing the communication method of the encoder described in the aforementioned method embodiment, the electronic device may be, for example, an electronic device with processing functions such as an encoder and a servo drive.

[0127] Optionally, the electronic device 1000 may further include a communication interface 1003. In a specific implementation, if the communication interface 1003, the memory 1002 and the processor 1001 are implemented independently, the communication interface 1003, the memory 1002 and the processor 1001 may be interconnected through a bus and communicate with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc., but it does not mean that there is only one bus or one type of bus.

[0128] Optionally, in a specific implementation, if the communication interface 1003, the memory 1002 and the processor 1001 are integrated on a chip, the communication interface 1003, the memory 1002 and the processor 1001 can communicate through an internal interface.

[0129] The present application also provides a computer-readable storage medium, in which computer program instructions are stored. When a processor executes the computer program instructions, the communication method of the encoder as described above is implemented.

[0130] The present application also provides a computer program product, including a computer program, which implements the communication method of the encoder as described above when executed by a processor.

[0131] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable programmable read only memory (EPROM), programmable read only memory (PROM), read only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0132] An exemplary readable storage medium is coupled to the processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in a dedicated integrated circuit. Of course, the processor and the readable storage medium can also be present in the communication device of the encoder as discrete components.

[0133] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0134] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A communication method for an encoder, characterized in that: include: The servo driver sends a first instruction to the encoder, where the first instruction is used to indicate transmission time data, and the encoder receives the first instruction; The encoder obtains the target position data with a delay according to the time data; The servo driver sends a second instruction to the encoder according to the time data and starts current sampling, wherein the second instruction is used to instruct the transmission of position data, and the encoder receives the second instruction; The encoder sends the target position data to the servo driver according to the second instruction, and the servo driver receives the target position data; The servo driver adjusts a drive signal based on the target position data.

2. The communication method of the encoder according to claim 1, characterized in that: The time data does not include a delay duration, and the encoder obtains the target position data by delay according to the time data, including: Determine a delay time, where the delay time is the preparation time of the encoder for the target position data; Sending the delay time to the servo driver, so that the servo driver sends the second instruction according to the delay time; When the delay time is reached, the target position data is obtained.

3. The communication method of the encoder according to claim 2, characterized in that: The servo driver sends a second instruction to the encoder according to the time data and starts current sampling, including: Receiving the delay duration sent by the encoder; When the delay time is reached, a second instruction is sent to the encoder, and current sampling is started.

4. The communication method of the encoder according to claim 1, characterized in that: The time data includes a delay duration, and the encoder obtains the target position data by delay according to the time data, including: When the delay time is reached, the target position data is obtained.

5. The communication method of the encoder according to claim 4, characterized in that: The servo driver sends a second instruction to the encoder according to the time data and starts current sampling, including: When the delay time is reached, a second instruction is sent to the encoder, and current sampling is started.

6. An encoder, characterized in that include: Protocol communication module, microcontroller unit MCU and position decoding module; The protocol communication module is used to receive a first instruction sent by the servo driver, the first instruction is used to indicate the transmission of time data, and send the time data to the MCU; and receive a second instruction sent by the servo driver, and send the second instruction to the MCU, the second instruction is used to indicate the transmission of position data, and the second instruction is sent by the servo driver at the same time as starting current sampling according to the time data; The MCU is configured to receive the time data sent by the protocol communication module, and control the position decoding module to delay obtaining the target position data according to the time data; and receive the second instruction sent by the protocol communication module, obtain the target position data from the position decoding module according to the second instruction, and send the target position data to the servo driver through the protocol communication module, so that the servo driver adjusts the drive signal based on the target position data; The position decoding module is used to obtain the target position data.

7. The encoder according to claim 6, characterized in that The first instruction is sent when the MCU of the servo driver triggers a first comparison register CMPA synchronization signal.

8. The encoder according to claim 6, characterized in that The second instruction is sent when the MCU of the servo driver triggers a synchronization signal of the second comparison register CMPB.

9. The encoder according to any one of claims 6 to 8, characterized in that The protocol rule corresponding to the first instruction includes frame data corresponding to the time data, and the protocol rule corresponding to the second instruction includes frame data corresponding to the target position data.

10. An encoder control system, characterized in that: include: Encoders and servo drives; The encoder and the servo driver are used to execute the communication method of the encoder according to any one of claims 1 to 5.

Citation Information

Cited By

  • Method, system and device for improving precision of bus magnetic encoder and storage medium

    CN120869198A

  • Bus magnetic encoder precision improvement method, system, device, and storage medium

    CN120869198B