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

For more details look at TMCL_reference.pdf  at

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


  • Christof

    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.


  • Lisa Teich

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

    Best reagrds, Lisa

  • Christof

    Hi Lisa

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


  • Parovel

    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

    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

Leave a Reply

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