ADI 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: Read Analog Value

    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 read an analog value and adjust the velocity of motor 0. The velocity depends on the analog value obtained at Port AIN_0. In the easiest case connect a pontiometer to Port AIN_0.

    Before use: Restore Factory Defaults

    // *** Values that have to be adapted *** //
    amax = 1000				//max. acceleration (0 ... 2047)
    cmax = 100				//max. current (0 ... 255)
    
    // *** Initialization / Set up axis parameter *** //
    SAP 5, 0, amax			//set max. acceleration
    SAP 6, 0, cmax    		//set max. current
    
    MST 0					//switch to velocity mode
    
    // *** Main Loop *** //
    loop:
    	GIO 0, 1    		//get 12 bit analog value of AIN_0 (0 ... 4095) and store in the accumulator
    	CALC DIV, 2			//divide analog value by 2 and store in the accumulator
    	AAP 2, 0			//change the velocity (0 ... 2047) to the value stored in the accumulator
    	JA loop				//jump to loop
    

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

    This sample is tested with TMCM-1161 and is compatible with Modules with 12-Bit Analog input. Modules with 10Bit analog input are not compatible.

    Share this:

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

    Related

    October 15, 2015 / Jonas P. Proeger / 2

    Categories: Code Snippet, Tutorial

    Tags: analog input, TMCL

    EDN Editor Publishes Extensive Review of our Quiet Stepper Motor Technology Great Presentation on TMC Technologies at Engineering Design Show

    Comments are currently closed.

    2 thoughts on “TMCL: Read Analog Value”

    • Jess says:
      August 29, 2018 at 2:30 am

      This was very helpful but is there any way to do a 0-10v = 0-360 degrees or one full rotation??

    • Lars Jaskulski says:
      September 11, 2018 at 9:15 am

      Hi Jess,
      In general this is possible and by adapting the basis of the code you should be able to achieve that. You can read up the TMCL commands with the Firmware manual with the module you are writing the program. You might need a hysteresis as otherwise the motor axis might jitter caused by noise on the analog voltage signal.
      If you need further help and / or support please do not hesitate to use our support system. You will find a blue button on our main webpage on the bottom right corner: http://www.trinamic.com
      Best regards,
      Lars

Recent Posts

  • Guest Blog: UBC Thunderbots
  • Guest Blog: TURAG
  • Guest Blog: School of Engineering Telecom Physics University of Strasbourg
  • Guest Blog: STAR Dresden
  • Pushing the Limits of Stepper Motor Control in 3D Printing

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 arduino BLDC cDriver code code snippet coolStep drive Driver ease of use ethercat eval kit evaluation kit Field Oriented Control FOC GUI guide heliostat How-To IC linear stage motion controller motor driver open source hardware programming rtmi servo servo controller IC setup silentstepstick stealthChop stepper stepper motor stepper motor driver stepper motor driver ic stepper motors technology TMC4671 tmc5130 TMCL TMCL-IDE TRINAMIC TRINAMIC Motion Control tuning

Tag Cloud

    3D printer 3d printing arduino BLDC cDriver code code snippet coolStep drive Driver ease of use ethercat eval kit evaluation kit Field Oriented Control FOC GUI guide heliostat How-To IC linear stage motion controller motor driver open source hardware programming rtmi servo servo controller IC setup silentstepstick stealthChop stepper stepper motor stepper motor driver stepper motor driver ic stepper motors technology TMC4671 tmc5130 TMCL TMCL-IDE TRINAMIC TRINAMIC Motion Control tuning

Pages

  • Blog Ethics
  • Newsletter
  • Player Embed
  • Search Videos
  • User Videos
  • Video Category
  • Video Tag

Categories

  • Competition
  • Guest blog
  • Industry News
  • Jobs
  • Myths about Motors
  • Open Source Hardware
  • Products
  • Projects
    • DIY
    • University Projects
  • 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.