User Manual

PD-x-1670 TMCL
Firmware Manual Firmware Version V2.0 | Document Revision V1.0 2018-Oct-29
74 / 82
Figure 5: Positioning Algorithm
7 TMCL Programming Techniques and Structure
7.1 Initialization
The rst task in a TMCL program (like in other programs also) is to initialize all parameters where dierent
values than the default values are necessary. For this purpose, SAP and SGP commands are used.
7.2 Main Loop
Embedded systems normally use a main loop that runs innitely. This is also the case in a TMCL application
that is running stand alone. Normally the auto start mode of the module should be turned on. After power
up, the module then starts the TMCL program, which rst does all necessary initializations and then enters
the main loop, which does all necessary tasks end never ends (only when the module is powered o or
reset).
There are exceptions to this, e.g. when TMCL routines are called from a host in direct mode.
So most (but not all) stand alone TMCL programs look like this:
1 // I n i tialization
SAP 4, 0, 50000 // define ma ximum positioning speed
3 SAP 5, 0, 10000 // define maxi mum accelerati o n
5 MainLoop :
// do something , in this example just running between two positions
7 MVP ABS , 0, 5000
WAIT POS , 0, 0
9 MVP ABS , 0, 0
WAIT POS , 0, 0
©2018 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com