TMCL: how to implement a for loop
This program demonstrates how to implement a for loop
For more details look at TMCL_reference.pdf
SGP 0, 2, 0 //set user variable #0 //for Loop forLoop: // add your code here // GGP 0, 2 //get user variable #0 to accu CALC ADD, 1 //add 1 to accu AGP 0, 2 //accu to user variable #0 COMP 5 //amount of loops JC LE, forLoop //jump to label forLoop STOP
Before use: Restore Factory Defaults
December 17, 2015 / Jonas P. Proeger / 1
Categories: Code Snippet, Tutorial
Silent Night: TRAMS 3D Printer Board for Holiday Tinkering Season TRINAMIC announces TMCC160 motionCookie™
Comments are currently closed.
One thought on “TMCL: how to implement a for loop”
Hello. I’ve implemented behavior similar to this in a program that’s meant to constantly run the motors to limit switches and count the number of times it completes a cycle. When I run the program through TMCL-PC.exe, I’d like to use the Local Variables window to “watch” my execution counter. Unfortunately, the Local Variable window is always showing a zero on Bank 2, Index 0. Do I have something incorrect? My code looks like:
I know I have some extra parameters on some of these commands, like the SGP, for example. When I leave off the extra parameters, however, TMCL-PC.exe refuses to complile my code and claims that I’m “missing parameters”. I’ve added zeroes after carefully consulting the TCML Reference and finding that there’s some “Don’t Care” parameters.