TMCL: If, Else and Subroutines
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 implement an if-else-statement by using subroutines. Connect a LED to Port OUT_0 will be toggling at 1 Hz.
Before use: Restore Factory Defaults
// *** Main Loop *** // loop: CSUB ifStatement WAIT TICKS, 0, 100 //wait 1 second. 100 * 10ms JA loop //jump to loop // *** begin (if-else-statement) *** // ifStatement: GIO 0, 2 //check state of OUT_0 JC NZ, Out0Off //if OUT_0 = high, jump to Out0Off else continue SIO 0, 2, 1 //switch OUT_0 high RSUB //end of subroutine Out0Off: SIO 0, 2, 0 //switch OUT_0 low RSUB //end of subroutine // *** end (if-eslse-statement) *** //
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.
November 5, 2015 / Jonas P. Proeger / 0