Quantcast
Channel: ADI Trinamic Blog
Viewing all articles
Browse latest Browse all 66

TMC7300 Example Script

$
0
0

Trinamic recently launched a new line of battery-powered motor driver chips. The TMC7300 is one of them, capable of driving 1 DC motor up to 2A, or 2 DC motors up to 2.4A (peak). In this post, I’ll show you a small example script to drive a DC motor using the TMC7300-EVAL-KIT.

First, I assemble the Evaluation Kit by using the Eselsbrücke connector board to connect the TMC7300-EVAL board with the Landungsbrücke interface board. Second, I connect a motor to the evaluation board. Finally, I plug in the USB-C cable for direct access with my computer using the TMCL-IDE.

With the setup complete, I can tune the TMC7300 DC driver IC and immediately see the motor’s behavior in real life, and in the graphical user interface.

Figure 1: Screenshot on how the movement looks like

Using the TMCL-IDE, I create a short example script that moves the DC motor as shown in figure 1. The motor PWM goes from 0% duty cycle to 30%, to 50% and back to zero. Afterwards, it shows the same values in negative direction.

Below is the script I used.

#module 1 COM16/USB/id1/Landungsbruecke [Landungsbruecke]

CALC ADD, 1               // Add 1 to accu
STOA 0, 0                    // Store local variable to accumulator

SAP 7, 0, 0, 1          // Deactivate Standby of TMC7300

Loop:
            SAP 0, 0, 30, 1     // Set duty cycle for Motor 1 to 30%
            WAIT TICKS, 0, 1000 // Wait 1 second
            SAP 0, 0, 50, 1     // Set duty cycle for Motor 1 to 50%
            WAIT TICKS, 0, 1000 // Wait 1 second
            SAP 0, 0, 30, 1     // Set duty cycle for Motor 1 to 30%
            WAIT TICKS, 0, 1000 // Wait 1 second
            SAP 0, 0, 0, 1      // Set duty cycle for Motor 1 to 0%
            WAIT TICKS, 0, 1000 // Wait 1 second
            SAP 0, 0, -30, 1        // Set duty cycle for Motor 1 to -30%
            WAIT TICKS, 0, 1000 // Wait 1 second
            SAP 0, 0, -50, 1        // Set duty cycle for Motor 1 to -50%
            WAIT TICKS, 0, 1000 // Wait 1 second
            SAP 0, 0, -30, 1        // Set duty cycle for Motor 1 to -30%
            WAIT TICKS, 0, 1000 // Wait 1 second
            SAP 0, 0, 0, 1      // Set duty cycle for Motor 1 to 0%
            WAIT TICKS, 0, 1000 // Wait 1 second
     
            CALC ADD, 1    // Add 1 to accu
            STOA   0, 0      // Store value to accumulator
            COMP 100       // <----- Amount of loops set here
            JC LE, Loop      // Jump to label Loop

SAP 7, 0, 1, 1          // Activate Standby of TMC7300

STOP

And that’s all there is to it. For more information on the TMC7300, please visit the TMC7300 product page here.


Viewing all articles
Browse latest Browse all 66

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>