Processing method of two input instruction modes of a stepper motor driver
By utilizing the internal resources of the DSP28335 processor to process single-pulse and double-pulse instructions and employing counter mode switching, the complexity of hardware circuits in existing technologies is resolved, thus achieving circuit simplification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- XIAN MICROMOTOR RES INST
- Filing Date
- 2022-12-14
- Publication Date
- 2026-04-17
AI Technical Summary
Existing stepper motor drivers require specialized hardware circuits to process single-pulse and double-pulse commands, which increases circuit complexity.
By utilizing the internal hardware circuit resources of the DSP28335 processor, the instruction mode is determined by the mode selection signal, and the first and second counters are used to process single-pulse and double-pulse instructions respectively to achieve mode switching, thus avoiding additional circuit design.
The circuit design was simplified, and the processing of single-pulse and double-pulse instructions was realized by utilizing the internal resources of the DSP28335 processor, thus reducing hardware complexity.
Smart Images

Figure CN115882756B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of motor drive, specifically relating to a method for processing two input command modes of a stepper motor driver. Background Technology
[0002] The stepper motor driver receives instructions from the host controller to control the stepper motor's angle, speed, and direction of rotation. The instructions include pulse information and direction information; the number of pulses determines the motor's rotation angle, the pulse frequency determines the motor's speed, and the direction information determines the motor's direction of rotation.
[0003] The rotation angle and direction of a stepper motor during operation are determined by the output state of the loop divider table set inside the DSP in the driver. The address value of the loop divider table is determined by the count value of the DSP's internal counter after calculation. Therefore, the driver needs to convert the instruction information from the host controller into the count value of the DSP's internal counter to determine the address value of the loop divider table.
[0004] Stepper motor drivers typically accept instruction input in either single-pulse or double-pulse mode. The input interface circuit is shared between these two modes. However, since DSP processors only support single-pulse counting and not double-pulse counting, the conventional approach is to use a mode selection signal and instruction mode switching circuit to convert the two instruction input modes into single-pulse mode, which the DSP processor's high-speed counter can receive. This approach requires specialized hardware circuitry, increasing circuit complexity. Summary of the Invention
[0005] This invention proposes a method for processing two input command modes of a stepper motor driver, in order to solve the problem in the prior art that processing single-pulse and double-pulse input commands requires the design of dedicated hardware circuits.
[0006] To achieve the above objectives, the present invention proposes the following technical solution:
[0007] A method for processing two input command modes of a stepper motor driver includes the following steps:
[0008] Step 1: Based on the external mode selection signal input to the DSP28335 processor, determine whether the input instruction mode is a single-pulse instruction mode. If yes, proceed to Step 2; otherwise, the input instruction is a double-pulse instruction signal, and proceed to Step 3.
[0009] The DSP28335 processor includes a first counter and a second counter. The single-pulse command signal includes a pulse signal CLK and a direction signal DIR. The double-pulse command signal includes a forward rotation pulse signal CCW and a reverse rotation pulse signal CW.
[0010] Step 2: The pulse signal CLK and the direction signal DIR are input to the counting terminal and the direction terminal of the first counter, respectively. The address value of the ring sub-table is obtained through the data obtained from the first counter.
[0011] Step 3: Input the forward pulse signal CCW to the counting terminal of the first counter, and input the reverse pulse signal CW to the counting terminal of the second counter. Obtain the address value of the ring sub-table by using the data obtained from the first and second counters.
[0012] Preferably, both the first counter and the second counter are reversible counters.
[0013] Preferably, in step two, the first counter is set to a pulse + direction counting mode.
[0014] Preferably, in step two, the pulse signal CLK is input to the counting terminal EQEP1A of the first counter, and the direction signal DIR is input to the direction terminal EQEP1B of the first counter.
[0015] Preferably, in step three, the forward pulse CCW is input to the counting terminal EQEP1A of the first counter.
[0016] Preferably, in step three, the inverted pulse CW is input to the counting terminal EQEP2A of the second counter.
[0017] Preferably, in step three, the first counter and the second counter are set to increment counting mode.
[0018] Preferably, in step two, the specific steps for obtaining the address value of the ring partition table using the data obtained from the first counter are as follows:
[0019] Subtract the count value of the previous period from the count value of the current period, and then add the difference to the ring sub-address value of the previous period to obtain the address value of the ring sub-table for the current period.
[0020] Preferably, in step three, the count value of the first counter in the current cycle is subtracted from the count value of the previous cycle to obtain the first difference value of the first counter;
[0021] Subtract the count value of the previous cycle from the count value of the second counter in the current cycle to obtain the second difference value of the second counter;
[0022] Subtracting the second difference from the first difference yields the third difference. Adding the third difference to the ring sub-address value from the previous period gives the address value of the ring sub-table for the current week.
[0023] The advantages of this invention are:
[0024] By utilizing the internal hardware circuit resources of the DSP28335 processor, the processing mode can be switched between single-pulse and dual-pulse instruction modes without the need for additional circuitry, thus simplifying the circuit design. Attached Figure Description
[0025] The accompanying drawings, which form part of this specification, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:
[0026] Figure 1 This is a flowchart illustrating the processing method for two input command modes of a stepper motor driver.
[0027] Figure 2 This is a schematic diagram illustrating the processing method of two input command modes for a stepper motor driver.
[0028] Figure 3 This is a schematic diagram of existing technology. Detailed Implementation
[0029] The present invention will now be described in detail with reference to the accompanying drawings and embodiments. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0030] The following detailed description is exemplary and intended to provide further detailed explanation of the invention. Unless otherwise specified, all technical terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this invention is for describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention.
[0031] Example 1:
[0032] Please see Figure 1 As shown, this invention provides a method for processing two input command modes of a stepper motor driver, specifically as follows:
[0033] The DSP28335 processor receives an external mode selection signal through the I / O port and determines whether the input instruction is a single-pulse instruction or a double-pulse instruction based on the external mode selection signal; the external mode selection signal is either a high-level signal or a low-level signal.
[0034] In single-pulse command mode, the first single-pulse command signal is the pulse signal CLK, and the second single-pulse command signal is the direction signal DIR; in double-pulse command mode, the first double-pulse command signal is the forward rotation pulse signal CCW, and the second double-pulse command signal is the reverse rotation pulse signal CW.
[0035] The DSP28335 processor includes a first counter and a second counter, both of which are reversible counters.
[0036] When the external mode selection signal determines that the input instruction is a single pulse instruction, the DSP software sets the first counter in the DSP28335 processor to pulse + direction counting mode. The pulse signal CLK is input to the counting terminal EQEP1A of the first counter, and the direction signal DIR is input to the direction terminal EQEP1B of the first counter, thus realizing reversible counting of the pulse signal. In each PWM cycle, the DSP28335 processor performs difference calculation on the count value of the first counter, that is, the count value of the current cycle is subtracted from the count value of the previous cycle. This difference is then added to the ring division address value of the previous cycle to obtain the address value of the ring division table for the current cycle.
[0037] When the external mode selection signal determines that the input instruction is a dual-pulse instruction, the DSP28335 processor's internal reversible counter does not have a dual-pulse counting mode, so it cannot directly use the counter for dual-pulse counting. In dual-pulse mode, both the first and second counters must be used simultaneously, with both set to incrementing mode. When a forward pulse (CCW) is input, it is input to the counting terminal EQEP1A of the first counter, which counts the forward pulse. When a reverse pulse (CW) is input, it is input to the counting terminal EQEP2A of the second counter, which counts the reverse pulse. The DSP28335 processor calculates the difference between the count values of the first counter and the previous cycle within each PWM cycle, obtaining the first difference. Similarly, the DSP28335 processor calculates the difference between the count values of the second counter and the previous cycle within each PWM cycle, obtaining the second difference.
[0038] The DSP28335 processor then subtracts the values of the two counters, that is, subtracts the second difference from the first difference to obtain the third difference. The third difference is then added to the ring address value of the previous cycle to obtain the address value of the ring table for the current cycle.
[0039] The above judgment and switching process is implemented through DSP programming.
[0040] A schematic diagram of a stepper motor driver's processing method for two input command modes is shown below. Figure 2 As shown.
[0041] In existing technology, stepper motor drivers generally use single-pulse or double-pulse instruction input methods, with both methods sharing the same instruction signal input interface circuit. However, DSP processors only have single-pulse counting modes for their high-speed counters, lacking a double-pulse counting mode. Figure 3 As shown.
[0042] Compared to existing technologies, this invention utilizes only the internal hardware circuit resources of the DSP28335 processor to achieve switching between single-pulse and dual-pulse instruction processing modes.
[0043] As is known from common technical knowledge, this invention can be implemented through other embodiments that do not depart from its spirit or essential characteristics. Therefore, the disclosed embodiments described above are merely illustrative in all respects and are not the only ones. All modifications within the scope of this invention or its equivalents are included in this invention.
[0044] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0045] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0046] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0047] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0048] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the protection scope of the claims of the present invention.
Claims
1. A method for processing two input command modes of a stepper motor driver, characterized in that, Includes the following steps: Step 1: Based on the external mode selection signal input to the DSP28335 processor, determine whether the input instruction mode is a single-pulse instruction mode. If yes, proceed to Step 2; otherwise, the input instruction is a double-pulse instruction signal, and proceed to Step 3. The DSP28335 processor includes a first counter and a second counter. The single-pulse command signal includes a pulse signal CLK and a direction signal DIR. The double-pulse command signal includes a forward rotation pulse signal CCW and a reverse rotation pulse signal CW. Step 2: The pulse signal CLK and the direction signal DIR are input to the counting terminal and the direction terminal of the first counter, respectively. The address value of the ring sub-meter is obtained through the data obtained from the first counter. Step 3: Input the forward pulse signal CCW to the counting terminal of the first counter, and input the reverse pulse signal CW to the counting terminal of the second counter. Obtain the address value of the ring sub-table by using the data obtained from the first and second counters.
2. The processing method for two input command modes of a stepper motor driver as described in claim 1, characterized in that, Both the first counter and the second counter are reversible counters.
3. The processing method for two input command modes of a stepper motor driver as described in claim 1, characterized in that, In step two, the first counter is set to pulse + direction counting mode.
4. The processing method for two input command modes of a stepper motor driver as described in claim 1, characterized in that, In step two, the pulse signal CLK is input to the counting terminal EQEP1A of the first counter, and the direction signal DIR is input to the direction terminal EQEP1B of the first counter.
5. The method for processing two input command modes of a stepper motor driver as described in claim 1, characterized in that, In step three, the forward pulse CCW is input to the counting terminal EQEP1A of the first counter.
6. The method for processing two input command modes of a stepper motor driver as described in claim 1, characterized in that, In step three, the inverted pulse CW is input to the counting terminal EQEP2A of the second counter.
7. The method for processing two input command modes of a stepper motor driver as described in claim 1, characterized in that, In step three, the first counter and the second counter are set to increment counting mode.
8. The method for processing two input command modes of a stepper motor driver as described in claim 1, characterized in that, In step two, the specific steps for obtaining the address value of the ring partition table using the data obtained from the first counter are as follows: Subtract the count value of the previous period from the count value of the current period, and then add the difference to the ring sub-address value of the previous period to obtain the address value of the ring sub-table for the current period.
9. The method for processing two input command modes of a stepper motor driver as described in claim 1, characterized in that, In step three, the count value of the first counter in the current cycle is subtracted from the count value of the previous cycle to obtain the first difference value of the first counter; Subtract the count value of the previous cycle from the count value of the second counter in the current cycle to obtain the second difference value of the second counter; Subtracting the second difference from the first difference yields the third difference. Adding the third difference to the ring sub-address value from the previous cycle yields the address value of the ring sub-table for the current cycle.
Citation Information
Patent Citations
JP1991105824U
Bridge bidding indicator
US4030764A