Trinamic TMCL TMCM-142 Use and care manual

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 2
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
Table of contents
1Life support policy ....................................................................................................................................................... 4
2Features........................................................................................................................................................................... 5
3Order codes.................................................................................................................................................................... 6
4Overview ......................................................................................................................................................................... 7
5Putting the TMCM-142 into operation .................................................................................................................... 8
5.1 Starting up............................................................................................................................................................. 9
5.2 Testing with a simple TMCLTM program ......................................................................................................13
5.3 Operating the module in direct mode ........................................................................................................14
6TMCLTM and TMCL-IDE ................................................................................................................................................15
6.1 Binary command format..................................................................................................................................15
6.2 Reply format........................................................................................................................................................16
6.2.1 Status codes..................................................................................................................................................17
6.3 Stand-alone applications .................................................................................................................................17
6.4 TMCLTM command overview ............................................................................................................................17
6.4.1 Motion commands ......................................................................................................................................17
6.4.2 Parameter commands ................................................................................................................................18
6.4.3 I/O port commands.....................................................................................................................................18
6.4.4 Control commands......................................................................................................................................18
6.4.5 Calculation commands...............................................................................................................................19
6.5 TMCLTM commands.............................................................................................................................................20
6.6 The ASCII interface ...........................................................................................................................................22
6.6.1 Format of the command line...................................................................................................................22
6.6.2 Format of a reply.........................................................................................................................................22
6.6.3 Commands that can be used in ASCII mode .....................................................................................22
6.6.4 Configuring the ASCII interface ..............................................................................................................22
6.7 Commands...........................................................................................................................................................24
6.7.1 ROR (rotate right).........................................................................................................................................24
6.7.2 ROL (rotate left)............................................................................................................................................25
6.7.3 MST (motor stop).........................................................................................................................................26
6.7.4 MVP (move to position).............................................................................................................................27
6.7.5 SAP (set axis parameter) ...........................................................................................................................29
6.7.6 GAP (get axis parameter)...........................................................................................................................34
6.7.7 STAP (store axis parameter) .....................................................................................................................41
6.7.8 RSAP (restore axis parameter) .................................................................................................................46
6.7.9 SGP (set global parameter).......................................................................................................................51
6.7.10 GGP (get global parameter)......................................................................................................................54
6.7.11 STGP (store global parameter).................................................................................................................57
6.7.12 RSGP (restore global parameter).............................................................................................................59
6.7.13 RFS (reference search)................................................................................................................................61
6.7.14 SIO (set output) ...........................................................................................................................................62
6.7.15 GIO (get input/output) ...............................................................................................................................64
6.7.16 CALC (calculate) ............................................................................................................................................66
6.7.17 COMP (compare)...........................................................................................................................................67
6.7.18 JC (jump conditional)..................................................................................................................................68
6.7.19 JA (jump always)..........................................................................................................................................69
6.7.20 CSUB (call subroutine)................................................................................................................................70
6.7.21 RSUB (return from subroutine)................................................................................................................71
6.7.22 WAIT (wait for an event to occur) .........................................................................................................72
6.7.23 STOP (stop TMCLTM program execution) ................................................................................................73
6.7.24 SCO (set coordinate) ...................................................................................................................................74
6.7.25 GCO (get coordinate) ..................................................................................................................................75
6.7.26 CCO (capture coordinate)...........................................................................................................................76
6.7.27 ACO (accu to coordinate)...........................................................................................................................77
6.7.28 CALCX (calculate using the X register) ..................................................................................................78
6.7.29 AAP (accumulator to axis parameter) ....................................................................................................79

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 3
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
6.7.30 AGP (accumulator to global parameter) ...............................................................................................84
6.7.31 CLE (clear error flags) .................................................................................................................................87
6.7.32 Customer specific TMCLTM command extension (UF0…UF7/user function)...................................88
6.7.33 Request target position reached event.................................................................................................89
6.7.34 BIN (return to binary mode) ....................................................................................................................90
6.7.35 TMCL™ Control Functions.........................................................................................................................91
7Axis parameters ..........................................................................................................................................................93
7.1 Real world units vs. units of the TMC457 ..................................................................................................98
8Global parameters......................................................................................................................................................99
8.1 Bank 0 ...................................................................................................................................................................99
8.2 Bank 1 .................................................................................................................................................................101
8.3 Bank 2 .................................................................................................................................................................102
9Hints and tips ............................................................................................................................................................103
9.1 PID controller of the TMC457 - easyPIDTM ................................................................................................103
9.2 Reference search ..............................................................................................................................................104
9.3 Fixing microstep errors..................................................................................................................................105
9.4 Using the RS485 interface .............................................................................................................................106
10 Revision history ........................................................................................................................................................107
10.1 Firmware revision............................................................................................................................................107
10.2 Document Revision .........................................................................................................................................107
11 References...................................................................................................................................................................108

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 4
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
1Life support policy
TRINAMIC Motion Control GmbH & Co. KG does not
authorize or warrant any of its products for use in life
support systems, without the specific written consent of
TRINAMIC Motion Control GmbH & Co. KG.
Life support systems are equipment intended to support or
sustain life, and whose failure to perform, when properly
used in accordance with instructions provided, can be
reasonably expected to result in personal injury or death.
© TRINAMIC Motion Control GmbH & Co. KG 2009
Information given in this data sheet is believed to be
accurate and reliable. However neither responsibility is
assumed for the consequences of its use nor for any
infringement of patents or other rights of third parties,
which may result from its use.
Specifications are subject to change without notice.

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 5
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
2Features
The TMCM-142 is a high-performance single axis stepper motor controller/driver with encoder feedback. The
integrated TMC457 motion controller provides superior performance with regard to microstep resolution (up
to 1024), maximum velocity (integrated chopsync™), ramp calculation (S-shaped ramps, calculated in real-
time) and encoder feedback support (closing the loop in hardware with PID regulator). The driver stage
supports motors with up to 5A RMS coil current and offers exceptional low power dissipation.
Together with the TMCM-IF standard add-on interface/adapter board a large number of interface options is
available.
Applications
Compact high-resolution/high-performance stepper motor controller/driver solutions
Smooth movements with high microstep resolution and S-shaped ramps
High precision and high repeatability with encoder feedback and PID position regulator
Electrical data
Supply voltage: +18V… +78.5V DC
Motor current: up to 7A peak / 5A RMS (programmable)
Supported motors
Two phase bipolar motors with 1A to 5A RMS coil current
Incremental encoder (a/b + optional index channel, differential, open-collector or single ended signals)
Interfaces
Optically isolated inputs for home and stop switches
general purpose analogue and digital inputs and outputs
RS422, RS232, CAN and USB serial interfaces available
RS422, RS485, RS232, CAN or USB serial interfaces available on standard add-on interface board TMCM-IF
Features
1024 times micro stepping
Automatic ramp generation (trapezoid and S-shaped) in real-time in hardware
On the fly alteration of motion parameters (e.g. position, velocity, acceleration)
Uses TMC457 high performance controller
Chopsync™ for high speed
High-efficient operation, low power dissipation
Integrated protection: overtemperature/undervoltage
Software
Stand-alone operation using TMCLTM or remote controlled operation
Memory for 2048 TMCLTM commands
PC-based application development software TMCL-IDE included
CANopen ready

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 6
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
3Order codes
The TMCM-142 is currently available with the standard adapter/interface add-on board TMCM-IF:
Order code
Description
Dimensions [mm3]
TMCM-142-IF
Single axis stepper motor controller/driver,
5A RMS, 75V, with encoder feedback and the
standard adapter/interface board TMCM-IF
76x70x33
Related motors
QSH-5718
57mm/NEMA23, 1.8˚ step angle
57.2 x 57.2 x 41/55/
78.5 mm
QSH-6018
60mm/NEMA24, 1.8˚ step angle
60.5 x 60.5 x 45/56/
65/86 mm
Table 3.1: Order codes
Versions without the standard adapter/interface board TMCM-IF (just the baseboard) or custom interface
boards are available on request.

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 7
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
4Overview
As with most TRINAMIC modules the software running on the microprocessor of the TMCM-142 consists of
two parts, a boot loader and the firmware itself. Whereas the boot loader is installed during production and
testing at TRINAMIC and remains –normally –untouched throughout the whole lifetime, the firmware can
be updated by the user. New versions can be downloaded free of charge from the TRINAMIC website
(http://www.trinamic.com).
The firmware shipped with this module is related to the standard TMCLTM firmware shipped with most of
TRINAMIC modules with regard to protocol and commands. Corresponding, this module is based on the
TMC457 motion controller for stepper motors and the TMC239 power driver and supports the standard
TMCLTM with a special range of values. All commands and parameters available with this unit are explained
on the following pages.

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 8
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
5Putting the TMCM-142 into operation
Here you can find basic information for putting your module into operation. Further text contains a simple
example for a TMCLTM program and a short description of operating the module in direct mode.
The things you need:
TMCM-142-IF, consisting of TMCM-142 base and standard TMCM-IF adapter/interface add-on board.
Interface (RS232, RS485, USB or CAN) suitable to your TMCM-142-IF with cables
Nominal supply voltage +24V DC (+18…+78.5V DC) for your module
A stepper motor which fit to your module, for example QSH-5718 or QSH-6018.
TMCL-IDE program and PC
Encoder optional
Precautions:
Do not connect or disconnect the TMCM-142 and the TMCM-IF while powered!
Do not connect or disconnect the motor while powered!
Do not mix up connections or short-circuit pins.
Avoid bounding I/O wires with motor power wires as this may cause noise picked up from the
motor supply.
Do not exceed the maximum power supply of 78.5V DC.
Start with power supply OFF!

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 9
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
5.1 Starting up
1. Connect the TMCM-142 and the TMCM-IF
Usually TRINAMIC delivers the base board and the add-on board connected. If not for any reason,
this figure will show you how to do this.
Base
Terminal1
Pin 1
Connector 1
Connector 3
Connector 2
Pin 1 Pin 1
Connector 3
Connector 2
Pin 1
Connector 4
1
6 9
5
USB Connector 1
Terminal1
USB
Connector 3
Connector 2
Connector 4
D-SUB
Connector 1
Adapter
Side View
Figure 5.1: Connectors of the TMCM-142 and the TMCM-IF
2. Connect the motor and the power supply
Connect the motor and the power supply with connector 1 of the TMCM-142:
1
8
Pin
Label
Description
1
NC
Not connected
2
NC
Not connected
3
GND
Supply ground
4
+V
Supply Voltage
5
B 2
Motor connection, Coil B
6
B 1
Motor connection, Coil B
7
A 2
Motor connection, Coil A
8
A 1
Motor connection, Coil A
Table 5.1: Base connector 1 - 1x8 pin, 5mm pitch screw connector
Attention: Do not exceed the maximum power supply of 78.5V DC.

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 10
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
3. Connect the interface
In this case we choose the USB interface for serial communication. USB is one out of five different
interfaces available for communication with the TMCM-142-IF. You can refer to the hardware
manuals of the TMCM-142 and the TMCM-IF for further information about the pinning of other
interfaces.
Connect the USB interface:
Choose the USB port of the TMCM-IF and connect the interface with a USB cable. Accordingly, adjust
the DIP switches.
ON
ON
ON
Switch 101
Switch 102
1
1
8
8
Switch 100
1 8
Figure 5.2: Overview of DIP switches
For selecting the USB interface, configure the DIP switches 101 and 102 as shown below:
Figure 5.3: Configuration of DIP switches for USB
ON
Switch 102
1 8
ON
Switch 101
18
Switch 101 and 102 select
the different interfaces
(RS422 or RS232, CAN,
RS485 and USB).
DIP switch 100 adjusts the
address of the CAN and
RS-422 interfaces

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 11
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
4. Connect the encoder
Differential and single ended incremental encoders with/without zero/index channel are supported.
If you want to use an encoder to meet your needs, you can connect as follows:
Single ended encoder: GND to pin 20
+5V to pin 16
A to pin 34
N to pin 29
B to pin 33
Differential encoder: GND to pin 20
+5V to pin 16
A+ to pin 34, A- to pin 12
N+ to pin 29, N- to pin 18
B+ to pin 33, B- to pin 14
Pin
Name
Function
PIN
Name
Function
1
TX-
RS422 Transmit –(data out
from indexer)
2
TX+
RS422 Transmit + (data out from
indexer)
3
RX-
RS422 Receive –(data into
indexer)
4
RX+
RS422 Receive + (data out from
indexer)
5
Internally pulled down via 2k7
resistor. Not supported by
TMCL™.
6
IN0_A/D
Analog user controlled input #0.
No internal resistors.
7
REF R
Optically isolated, active low
limit switch input Right
8
STEP_
OUT/RXD
Step clock output from indexer
RS232 option: RS232 receive
9
OUT_1
User controlled output #1. No
internal resistors.
10
DIR_OUT/TXD
Direction output from indexer.
RS232 option: RS232 transmit
11
IN7
Digital user controlled input #7.
Optically isolated, active low
(needs power supply on pin 15)
12
ENC_A-
Differential encoder: Channel A-
input (optional)
13
IN2_A/D
Analog user controlled input #2.
No internal resistors.
14
ENC_B-
Differential encoder: Channel B-
input (optional)
15
+5V
DC bias for input opto couplers
16
+5VDC
Logic supply out for encoder
17
OUT_0
User controlled output #0. No
internal resistors.
18
ENC_N-
Differential encoder: Channel N-
input (optional)
19
REF L
Optically isolated, active low
limit switch input Left
20
GND
Logic supply ground connection
21
IN3
Digital user controlled input #3.
No internal resistors. (TTL)
22
OUT_2
User controlled output #2. No
internal resistors.
23
IN8
Digital user controlled input #8.
Optically isolated, active low
(needs power supply on pin 15)
24
Not supported by TMCL™.
25
IN5
Digital user controlled input #5.
No internal resistors. (TTL)
26
IN1_A/D
Analog user controlled input #1.
No internal resistors.
27
ALARM
High voltage open collector
output indicating driver fault
condition.
28
Not supported by TMCL™.
29
ENC_N+
Encoder option:
Single ended: Channel N input
Differential: Channel N+ input
30
IN6
Digital user controlled input #6.
No internal resistors. (TTL)
31
FS
Active for one clock pulse at
each on-pole fullstep position.
32
IN4
Digital user controlled input #4.
No internal resistors. (TTL)

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 12
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
Pin
Name
Function
PIN
Name
Function
33
ENC_B+
Encoder option:
Single ended: Channel B input
Differential: Channel B+ input
34
ENC_A+
Encoder option:
Single ended: Channel A input
Differential: Channel A+ input
Table 5.2: TMCM-IF connector 3 and TMCM-142 connector 3
5. Switch power supply ON
The LED for power should glow now. This indicates that the on-board +5V supply is available.
If this does not occur, switch power OFF and check your connections as well as the power
supply.
6. Start the TMCL-IDE software development environment
The TMCL-IDE is on hand on the TechLibCD and on www.trinamic.com.
Installing the TMCL-IDE:
Make sure the COM port you intend to use is not blocked by another program.
Open TMCL-IDE by clicking TMCL.exe.
Choose Setup and Options and thereafter the Connection tab.
Choose COM port and type with the parameters shown below (baud rate 9600). Click OK.

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 13
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
5.2 Testing with a simple TMCLTM program
Open the file test2.tmc. The following source code appears on the screen:
A description for the TMCL™ commands can be found in Appendix A.
Assemble
Download Run
Stop
7. Click on Icon Assemble to convert the TMCL™ into machine code.
8. Then download the program to the TMCM-142 module via the icon Download.
9. Press icon Run. The desired program will be executed.
10. Click Stop button to stop the program.
//A simple example for using TMCL™and TMCL-IDE
ROL 0, 500000 //Rotate motor 0 with speed 500000
WAIT TICKS, 0, 500
MST 0
ROR 0, 250000 //Rotate motor 1 with 250000
WAIT TICKS, 0, 500
MST 0
SAP 4, 0, 500000 //Set max. Velocity
SAP 5, 0, 50000 //Set max. Acceleration
Loop: MVP ABS, 0, 10000000 //Move to Position 10000
WAIT POS, 0, 0 //Wait until position reached
MVP ABS, 0, -1000000 //Move to Position -10000
WAIT POS, 0, 0 //Wait until position reached
JA Loop //Infinite Loop

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 14
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
5.3 Operating the module in direct mode
1. Start TMCL™ Direct Mode.
Direct Mode
2. If the communication is established the TMCM-142-IF is automatically detected. If the module is not
detected, please check all points above (cables, interface, power supply, COM port, baud rate).
3. Issue a command by choosing instruction, type (if necessary), motor, and value and click Execute
to send it to the module.
Examples:
ROR rotate right, motor 0, value 500 -> Click Execute. The first motor is rotating now.
MST motor stop, motor 0 -> Click Execute. The first motor stops now.
You will find a description of all TMCLTM commands in the following chapters.

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 15
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
6TMCLTM and TMCL-IDE
The TMCM-142 supports TMCLTM direct mode (binary commands or ASCII interface) and stand-alone TMCLTM
program execution. You can store up to 2048 TMCLTM instructions on it.
In direct mode and most cases the TMCLTM communication over RS485, RS232, RS422, USB or CAN follows a
strict master/slave relationship. That is, a host computer (e.g. PC/PLC) acting as the interface bus master will
send a command to the TMCM-142. The TMCLTM interpreter on the module will then interpret this command,
do the initialization of the motion controller, read inputs and write outputs or whatever is necessary
according to the specified command. As soon as this step has been done, the module will send a reply back
over RS485/RS232/RS422/USB/CAN to the bus master. Only then should the master transfer the next
command. Normally, the module will just switch to transmission and occupy the bus for a reply, otherwise
it will stay in receive mode. It will not send any data over the interface without receiving a command first.
This way, any collision on the bus will be avoided when there are more than two nodes connected to a
single bus.
The Trinamic Motion Control Language (TMCLTM) provides a set of structured motion control commands.
Every motion control command can be given by a host computer or can be stored in an EEPROM on the
TMCMTM module to form programs that run stand-alone on the module. For this purpose there are not only
motion control commands but also commands to control the program structure (like conditional jumps,
compare and calculating).
Every command has a binary representation and a mnemonic. The binary format is used to send commands
from the host to a module in direct mode, whereas the mnemonic format is used for easy usage of the
commands when developing stand-alone TMCLTM applications using the TMCL-IDE (Integrated Development
Environment).
There is also a set of configuration variables for the axis and for global parameters which allow individual
configuration of nearly every function of a module. This manual gives a detailed description of all TMCLTM
commands and their usage.
6.1 Binary command format
Every command has a mnemonic and a binary representation. When commands are sent from a host to a
module, the binary format has to be used. Every command consists of a one-byte command field, a one-byte
type field, a one-byte motor/bank field and a four-byte value field. So the binary representation of a
command always has seven bytes. When a command is to be sent via RS232, RS422, RS485 or USB interface,
it has to be enclosed by an address byte at the beginning and a checksum byte at the end. In this case it
consists of nine bytes.
This is different when communicating is via the CAN bus. Address and checksum are included in the CAN
standard and do not have to be supplied by the user.
The binary command format for RS232/RS422/RS485/USB is as follows:
Bytes
Meaning
1
Module address
1
Command number
1
Type number
1
Motor or Bank number
4
Value (MSB first!)
1
Checksum
The checksum is calculated by adding up all the other bytes using an 8-bit addition.
When using CAN bus, just leave out the first byte (module address) and the last byte (checksum).

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 16
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
Checksum calculation
As mentioned above, the checksum is calculated by adding up all bytes (including the module address byte)
using 8-bit addition. Here are two examples to show how to do this:
in C:
unsigned char i, Checksum;
unsigned char Command[9];
//Set the “Command” array to the desired command
Checksum = Command[0];
for(i=1; i<8; i++)
Checksum+=Command[i];
Command[8]=Checksum; //insert checksum as last byte of the command
//Now, send it to the module
in Delphi:
var
i, Checksum: byte;
Command: array[0...8] of byte;
//Set the “Command” array to the desired command
//Calculate the Checksum:
Checksum:=Command[0];
for i:=1 to 7 do Checksum:=Checksum+Command[i];
Command[8]:=Checksum;
//Now, send the “Command” array (9 bytes) to the module
6.2 Reply format
Every time a command has been sent to a module, the module sends a reply.
The reply format for RS485/RS422/RS232/USB is as follows:
Bytes
Meaning
1
Reply address
1
Module address
1
Status (e.g. 100 means no error)
1
Command number
4
Value (MSB first!)
1
Checksum
The checksum is also calculated by adding up all the other bytes using an 8-bit addition.
When using CAN bus, the first byte (reply address) and the last byte (checksum) are left out.
Do not send the next command before you have received the reply!

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 17
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
6.2.1 Status codes
The reply contains a status code.
The status code can have one of the following values:
Code
Meaning
100
Successfully executed, no error
101
Command loaded into TMCLTM
program EEPROM
1
Wrong checksum
2
Invalid command
3
Wrong type
4
Invalid value
5
Configuration EEPROM locked
6
Command not available
6.3 Stand-alone applications
The module is equipped with an EEPROM for storing TMCLTM applications. You can use TMCL-IDE for
developing stand-alone TMCLTM applications. You can load them down into the EEPROM and then it will run
on the module. The TMCL-IDE contains an editor and a TMCLTM assembler where the commands can be
entered using their mnemonic format. They will be assembled automatically into their binary
representations. Afterwards this code can be downloaded into the module to be executed there.
6.4 TMCLTM command overview
In this section a short overview of the TMCLTM commands is given.
6.4.1 Motion commands
These commands control the motion of the motor. They are the most important commands and can be used
in direct mode or in stand-alone mode.
Mnemonic
Command
number
Meaning
ROL
2
Rotate left
ROR
1
Rotate right
MVP
4
Move to position
MST
3
Motor stop
RFS
13
Reference search
SCO
30
Store coordinate
CCO
32
Capture coordinate
GCO
31
Get coordinate

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 18
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
6.4.2 Parameter commands
These commands are used to set, read and store axis parameters or global parameters. Axis parameters can
be set independently for the axis, whereas global parameters control the behavior of the module itself.
These commands can also be used in direct mode and in stand-alone mode.
Mnemonic
Command
number
Meaning
SAP
5
Set axis parameter
GAP
6
Get axis parameter
STAP
7
Store axis parameter into EEPROM
RSAP
8
Restore axis parameter from EEPROM
SGP
9
Set global parameter
GGP
10
Get global parameter
STGP
11
Store global parameter into EEPROM
RSGP
12
Restore global parameter from EEPROM
6.4.3 I/O port commands
These commands control the external I/O ports and can be used in direct mode and in stand-alone mode.
Mnemonic
Command
number
Meaning
SIO
14
Set output
GIO
15
Get input
6.4.4 Control commands
These commands are used to control the program flow (loops, conditions, jumps etc.). It does not make
sense to use them in direct mode. They are intended for stand-alone mode only.
Mnemonic
Command
number
Meaning
JA
22
Jump always
JC
21
Jump conditional
COMP
20
Compare accumulator with constant
value
CLE
36
Clear error flags
CSUB
23
Call subroutine
RSUB
24
Return from subroutine
WAIT
27
Wait for a specified event
STOP
28
End of a TMCLTM program

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 19
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
6.4.5 Calculation commands
These commands are intended to be used for calculations within TMCLTM applications. Although they could
also be used in direct mode it does not make much sense to do so.
Mnemonic
Command
number
Meaning
CALC
19
Calculate using the accumulator and a
constant value
CALCX
33
Calculate using the accumulator and the
X register
AAP
34
Copy accumulator to an axis parameter
AGP
35
Copy accumulator to a global parameter
ACO
39
Copy accu to coordinate
For calculating purposes there is an accumulator (or accu or A register) and an X register. When executed in
a TMCLTM program (in stand-alone mode), all TMCLTM commands that read a value store the result in the
accumulator. The X register can be used as an additional memory when doing calculations. It can be loaded
from the accumulator.
When a command that reads a value is executed in direct mode the accumulator will not be affected. This
means that while a TMCLTM program is running on the module (stand-alone mode), a host can still send
commands like GAP, GGP or GIO to the module (e.g. to query the actual position of the motor) without
affecting the flow of the TMCLTM program running on the module.

TMCM-142 TMCLTM Firmware Manual (V1.06 / 2014-JUN-24) 20
Copyright © 2009, TRINAMIC Motion Control GmbH & Co. KG
6.5 TMCLTM commands
The following TMCLTM commands are currently supported:
Command
Number
Parameter
Description
ROR
1
<motor number>, <velocity>
Rotate right with specified velocity
ROL
2
<motor number>, <velocity>
Rotate left with specified velocity
MST
3
<motor number>
Stop motor movement
MVP
4
ABS|REL|COORD, <motor
number>, <position|offset>
Move to position (absolute or
relative)
SAP
5
<parameter>, <motor number>,
<value>
Set axis parameter (motion control
specific settings)
GAP
6
<parameter>, <motor number>
Get axis parameter (read out motion
control specific settings)
STAP
7
<parameter>, <motor number>
Store axis parameter permanently
(non volatile)
RSAP
8
<parameter>; <motor number>
Restore axis parameter
SGP
9
<parameter>, <bank number>,
<value>
Set global parameter (module specific
settings, e.g. communication settings,
or TMCL™ user variables)
GGP
10
<parameter>, <bank number>
Get global parameter (read out
module specific settings e.g.
communication settings, or TMCL™
user variables)
STGP
11
<parameter>, <bank number>
Store global parameter (TMCL™ user
variables only)
RSGP
12
<parameter>, <bank>
Restore global parameter (TMCL™
user variables only)
RFS
13
START|STOP|STATUS, <motor
number>
Reference search
SIO
14
<port number>, <bank number>,
<value>
Set digital output to specified value
GIO
15
<port number>, <bank number>
Get value of analogue/digital input
CALC
19
<operation>, <value>
Process accumulator & value
COMP
20
<value>
Compare accumulator <-> value
JC
21
<condition>, <jump address>
Jump conditional
JA
22
<jump address>
Jump absolute
CSUB
23
<subroutine address>
Call subroutine
RSUB
24
Return from subroutine
WAIT
27
<condition>, <motor number>,
<ticks>
Wait with further program execution
STOP
28
Stop program execution
SCO
30
<coordinate number>, <motor
number>, <position>
Set coordinate
Table of contents
Other Trinamic Computer Hardware manuals

Trinamic
Trinamic TMCM-035 User manual

Trinamic
Trinamic PD-109 User manual

Trinamic
Trinamic TMCM-351 User manual

Trinamic
Trinamic TMCM-1316 StepRocker User manual

Trinamic
Trinamic TMCM-351 Use and care manual

Trinamic
Trinamic PANdrive PD013-42 User manual

Trinamic
Trinamic TMCM-1161 User manual

Trinamic
Trinamic TMCM-160 User manual

Trinamic
Trinamic TMCM-1633 User manual

Trinamic
Trinamic TMCM-101 User manual