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: Reference Search with Wait Timeout

    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 perform a reference search with motor 0. The program stops either when the reference search is finished or when the timeout limit is reached. In case the timeout limit is reached, the reference search is stopped and the Port OUT_0 is set high before ending the program. In the easiest case connect an LED 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)
    vsearch = 1000				//reference search speed (0 ... 2047)
    vswitch = 100				//reference switch speed (0 ... 2047)
    searchMode = 1				//reference search mode
    tmax = 100					//max. time in 10ms for reference search to be finished
    
    // *** Initialization / Set up axis parameter *** //
    SAP 5, 0, amax				//set max. acceleration
    SAP 6, 0, cmax    			//set max. current
    
    SIO 0, 0, 1					//activate pull-up resistors for N.C. switches
    
    // *** Reference search initialization *** //
    SAP 12, 0, 0				//set right limit switch disable
    SAP 13, 0, 0				//set left limit switch disable
    SAP 149, 0, 1				//set soft stop flag: 0 = hard stop, 1 = soft stop
    SAP 193, 0, searchMode		//set refenrece search mode
    SAP 194, 0, vsearch			//set reference search speed
    SAP 195, 0, vswitch			//set reference switch speed
    
    SIO 0, 2, 0 				//switch OUT_0 low
    
    // *** Main Program *** //
    RFS START, 0				//start reference search
    WAIT RFS, 0, 1000			//wait until RFS is done or timeout happend after tmax * 10ms
    JC ETO, RefErr				//jump to RefErr if timeout occurs
    STOP 						//end of Program
    
    // *** Timeout subroutine *** //
    RefErr:
    	CLE 1					//delete Timeout-Flag
    	RFS STOP, 0				//stop reference search
    	SIO 0, 2, 1 			//switch OUT_0 high
    	STOP	
    

    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 24, 2015 / Jonas P. Proeger / 5

    Categories: Code Snippet, Tutorial

    Tags: Homing, TMCL

    TMCL: Different Microstep Resolutions Trinamic – stealthChop Silent Stepper Motor Driver 3D-Printer Demo

    Comments are currently closed.

    5 thoughts on “TMCL: Reference Search with Wait Timeout”

    • Christof says:
      March 14, 2017 at 11:57 pm

      Thanks for the sample.
      How can I retract more after the reference switch is hit the first time?
      I use a gearing of 1:10 and I need more retract to release the end switch before the search aproach.

      Thanks
      Christof

    • Lisa Teich says:
      March 17, 2017 at 4:29 pm

      Thanks for your message.
      Before I try to help you, can you tell me what kind of sample you have?

      Best reagrds, Lisa

    • Christof says:
      March 20, 2017 at 7:35 am

      Hi Lisa

      Thanks for your quick reply. Meanwhile we could solve our problem and the drive is working as expected.

      Cheers
      Christof

    • Parovel says:
      September 26, 2017 at 2:53 pm

      Thank you for the sample. I have noticed however that after using this script, I am not able to execute the ROR command. The ROL is working fine. The history log is showing no errors. After powering down/up the module everything goes to normal. I work with a Trinamic module TMCM 6110 v1.1.

    • Parovel says:
      September 28, 2017 at 11:37 am

      I found out to regain control over the motor I need to disable the pull-up resistors and as a precaution stop the motor.

      SIO 0, 0, 0 //de-activate pull-up resistors for N.C. switches
      MST 0, 0, 0 // stop the motor to prevent damage in case some command are waiting in line

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.