StepRocker Motor Control (TMCM-1110)

TMCM-1110 USB Driver:
TMCM-1110.inf

Program Downloads: pyro_example.tmc
limit_example.tmc

The Software
           Now, let's take a look at what the software looks like for this stepper controller board. They have a custom lanuage and custom IDE.

    -Main Program Loop
    -Interrupt Routine


           The IDE that trinamic provides with their software development suite is super simple and straight to the point. The different commands are explained in the firmware manual that you can download.
           The program that we're going to use will be super simple. First it will start out making our stage move to the right toward the limit switch. Once the limit switch is hit by the stage, it will trigger an interrupt which pauses the program, and then makes the stage move in the opposite direction away from the switch.

Limit Switch Testing Code

------------« Begin Code »------------
#include Interrupts.inc

VECT TI_STOPRIGHT0, LIMIT_IRQ    //Define Interrupt Vector
EI   TI_STOPRIGHT0              //Enable This Interrupt                                     
EI   255                        //Globally Switch On Interrupt Processing

//Main Program Tells Motor0 To Rotate Left or Right 
//Depending Upon The Current_Direction Variable

CURRENT_DIRECTION = 0         
SGP CURRENT_DIRECTION, 2, 0   //Set Initial Direction: Left

LOOP:
     WAIT TICKS, 0, 50        //Short Pause (50 Timer Ticks)
     
     GGP CURRENT_DIRECTION, 2 //Load CURRENT_DIRECTION Into Accumulator
     COMP 1                   //Compare Accumulator to 1
     JC ZE, ROTATE_LEFT       //If 0 Goto ROTATE_LEFT
     JC NZ, ROTATE_RIGHT      //If 1 Goto ROTATE_RIGHT

ROTATE_LEFT:
            ROL 0, 2000       //Rotate Left @ Speed 2000
            JA LOOP           //Jump-Always To LOOPs
          
ROTATE_RIGHT:
             ROR 0, 2000      //Rotated Right @ Speedd 2000
             JA LOOP          //Jump-Always To LOOP
             
LIMIT_IRQ:
             SGP CURRENT_DIRECTION, 2, 1 //Set Direction = 1
             MST 0                       //Stop Motor
             WAIT TICKS, 0, 100          //Short Pause
             RETI                        //Return To Main Loop 
------------« End Code »------------

           Luckily, the programming langauge is straight forward and mostly readable (with a few comments added in). The TCMC IDE comes with a lot of examples to learn from when you download it. Enough software! Let's test everything out!