Trinamic Blog

We transform digital information into physical motion.

 
  • Newsletter
  • Blog Ethics
  • Legal/Impressum
  • Main Website
Menu
  • Newsletter
  • Blog Ethics
  • Legal/Impressum
  • Main Website
  • TMCL: Different Microstep Resolutions

    TMCL is the simple way to implement your motion control application. With this series of simple coding examples we want to provide you an easy start.

    This program demonstrates how to turn a motor at the same speed (~1 RPS) with different microstep resolutions.

    Before use: Restore Factory Defaults

    // *** Values that have to be adapted *** //
    vmax = 1000					//max. speed (0 ... 2047)
    amax = 1000					//max. acceleration (0 ... 2047)
    cmax = 100					//max. current (0 ... 255)
    
    // *** Initialization / Set up axis parameter *** //
    SAP 6, 0, cmax    			//set max. current
    
    // *** Main Loop ***
    loop:
    	SAP 140, 0, 8			//set microstep resolution to 256
    	ROL 0, 1792				//turn motor left at 1792 (~1 RPS)
    	WAIT TICKS, 0, 500		//wait 5 seconds. 500 * 10ms
    	MST 0					//stop motor
    	WAIT TICKS, 0, 200		//wait 2 seconds. 200 * 10ms
    
    	SAP 140, 0, 7			//set 128 micorsteps
    	ROL 0, 896				//turn motor left at 896 = 1792/2 (~1 RPS)
    	WAIT TICKS, 0, 500		//wait 5 seconds. 500 * 10ms
    	MST 0					//stop motor
    	WAIT TICKS, 0, 200		//wait 2 seconds. 200 * 10ms
    
    	SAP 140, 0, 6			//set microstep resolution to 64
    	ROL 0, 448				//turn motor left at 448 = 1792/4 (~1 RPS)
    	WAIT TICKS, 0, 500		//wait 5 seconds. 500 * 10ms
    	MST 0					//stop motor
    	WAIT TICKS, 0, 200		//wait 2 seconds. 200 * 10ms
    
    	SAP 140, 0, 5			//set microstep resolution to 32
    	ROL 0, 224				//turn motor left at 224 = 1792/8 (~1 RPS)
    	WAIT TICKS, 0, 500		//wait 5 seconds. 500 * 10ms
    	MST 0					//stop motor
    	WAIT TICKS, 0, 200		//wait 2 seconds. 200 * 10ms
    
    	SAP 140, 0, 4			//set microstep resolution to 16
    	ROL 0, 112				//turn motor left at 112 = 1792/16 (~1 RPS)
    	WAIT TICKS, 0, 500		//wait 5 seconds. 500 * 10ms
    	MST 0					//stop motor
    	WAIT TICKS, 0, 200		//wait 2 seconds. 200 * 10ms
    
    	SAP 140, 0, 3			//set microstep resolution to 8
    	ROL 0, 56				//turn motor left at 56 = 1792/32 (~1 RPS)
    	WAIT TICKS, 0, 500		//wait 5 seconds. 500 * 10ms
    	MST 0					//stop motor
    	WAIT TICKS, 0, 200		//wait 2 seconds. 200 * 10ms
    
    	SAP 140, 0, 2			//set microstep resolution to 4
    	ROL 0, 28				//turn motor left at 28 = 1792/64 (~1 RPS)
    	WAIT TICKS, 0, 500		//wait 5 seconds. 500 * 10ms
    	MST 0					//stop motor
    	WAIT TICKS, 0, 200		//wait 2 seconds. 200 * 10ms
    
    	SAP 140, 0, 1			//set microstep resolution to 2 (half step)
    	ROL 0, 14				//turn motor left at 14 = 1792/128 (~1 RPS)
    	WAIT TICKS, 0, 500		//wait 5 seconds. 500 * 10ms
    	MST 0					//stop motor
    	WAIT TICKS, 0, 200		//wait 2 seconds. 200 * 10ms
    
    	SAP 140, 0, 0			//set microstep resolution to 1 (full step)
    	ROL 0, 7				//turn motor left at 7 = 1792/256 (~1 RPS)
    	WAIT TICKS, 0, 500		//wait 5 seconds. 500 * 10ms
    	MST 0					//stop motor
    	WAIT TICKS, 0, 200		//wait 2 seconds. 200 * 10ms
    	
    	JA loop					//jump to loop

    For more details look at TMCL_reference.pdf  at http://www.trinamic.com/software-tools/tmcl-ide

    Basic Commands, this sample can be used with any TMCL module with one or multiple axes tested with TMCM-1140, TMCM-1161, TMCM-6110.

    Share this:

    • Twitter
    • Facebook
    • LinkedIn
    • Pinterest
    • Print
    • Email

    Related

    September 16, 2015 / Jonas P. Proeger / 0

    Categories: Code Snippet, Tutorial

    Tags: microstepping, TMCL

    TMCL: Turn One Motor to an Absolute Position TMCL: Reference Search with Wait Timeout

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

Recent Posts

  • Guest Blog: Designing My Own 3D Printer Mainboard
  • Field Bus Systems in Motion Control – Trinamic’s View
  • Writing Endless Lines of Code Is a Thing of the Past
  • Myths About Motor Control – Myth 3
  • Myths About Motor Control – Myth 2

Social

  • View trinamic.mc’s profile on Facebook
  • View Trinamic_MC’s profile on Twitter
  • View trinamic’s profile on GitHub
  • View UC4SHA5_GAw1Wbm2T2NWpWbA’s profile on YouTube

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Newsletter

 

Info

Waterloohain 5
22769 Hamburg
+49 40 514 806 40

Tags

3D printer 3d printing 10 myths arduino arduino stepper motor shield BLDC cDriver coolStep Driver ease of use electrical motors ethercat evaluation Hamburg heliostat How-To IC motion control motion controller motor control myth myths myths on motors open source hardware PMSM RAMPS reference design renewable energy silent silentstepstick solar stealthChop stepper stepper motor stepper motor driver stepper motor driver ic stepper motors stepRocker technology tmc5130 TMC5160 TMCL TRAMS TRINAMIC TRINAMIC Motion Control

Tag Cloud

    3D printer 3d printing 10 myths arduino arduino stepper motor shield BLDC cDriver coolStep Driver ease of use electrical motors ethercat evaluation Hamburg heliostat How-To IC motion control motion controller motor control myth myths myths on motors open source hardware PMSM RAMPS reference design renewable energy silent silentstepstick solar stealthChop stepper stepper motor stepper motor driver stepper motor driver ic stepper motors stepRocker technology tmc5130 TMC5160 TMCL TRAMS TRINAMIC TRINAMIC Motion Control

Pages

  • Blog Ethics
  • Legal/Impressum
  • Newsletter

Categories

  • Competition
  • Industry News
  • Jobs
  • Myths about Motors
  • Open Source Hardware
  • Products
  • Projects
    • DIY
  • Research
  • Social
  • Software
  • technology
  • Trade Shows
  • Tutorial
    • Code Snippet
  • Uncategorized

Copyright © 2015 TRINAMIC BlogTheme created by PWT. Powered by WordPress.org

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.