Trinamic PD57-1060 Use and care manual

MECHATRONIC DRIVES WITH STEPPER MOTOR PANdrives
TRINAMIC Motion Control GmbH & Co. KG
Hamburg, Germany
www.trinamic.com
V 1.04
TMCL™ FIRMWARE MANUAL
+ + TMCM-1060
PD57-1060
PD60-1060
1-axis stepper
controller / driver
2.8A RMS/ 12, 24 or 48V DC
USB (mini-USB), RS485, and CAN
step/dir interface
integrated sensOstep™encoder
+ +

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 2
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
Table of contents
1Life support policy ....................................................................................................................................................... 4
2Features........................................................................................................................................................................... 5
3Overview ......................................................................................................................................................................... 6
4Putting the PD57/60-1060 into operation.............................................................................................................. 7
4.1 Starting up............................................................................................................................................................. 7
4.2 Testing with a simple TMCLTM program ......................................................................................................10
4.3 Operating the module in direct mode ........................................................................................................11
5TMCL™ and TMCL-IDE................................................................................................................................................12
5.1 Binary command format..................................................................................................................................12
5.2 Reply format........................................................................................................................................................13
5.2.1 Status codes..................................................................................................................................................14
5.3 Stand-alone applications .................................................................................................................................14
5.4 TMCL™ command overview ...........................................................................................................................14
5.4.1 Motion commands ......................................................................................................................................14
5.4.2 Parameter commands ................................................................................................................................15
5.4.3 I/O port commands.....................................................................................................................................15
5.4.4 Control commands......................................................................................................................................15
5.4.5 Calculation commands...............................................................................................................................15
5.4.6 Interrupt commands...................................................................................................................................16
5.5 TMCL™ list of commands................................................................................................................................18
5.6 The ASCII interface ...........................................................................................................................................20
5.6.1 Format of the command line...................................................................................................................20
5.6.2 Format of a reply.........................................................................................................................................20
5.6.3 Commands that can be used in ASCII mode .....................................................................................20
5.6.4 Configuring the ASCII interface ..............................................................................................................21
5.7 Commands...........................................................................................................................................................22
5.7.1 ROR (rotate right).........................................................................................................................................22
5.7.2 ROL (rotate left)............................................................................................................................................23
5.7.3 MST (motor stop).........................................................................................................................................24
5.7.4 MVP (move to position).............................................................................................................................25
5.7.5 SAP (set axis parameter) ...........................................................................................................................27
5.7.6 GAP (get axis parameter)...........................................................................................................................33
5.7.7 STAP (store axis parameter) .....................................................................................................................39
5.7.8 RSAP (restore axis parameter) .................................................................................................................42
5.7.9 SGP (set global parameter).......................................................................................................................44
5.7.10 GGP (get global parameter)......................................................................................................................48
5.7.11 STGP (store global parameter).................................................................................................................52
5.7.12 RSGP (restore global parameter).............................................................................................................54
5.7.13 RFS (reference search)................................................................................................................................56
5.7.14 SIO (set output) ...........................................................................................................................................57
5.7.15 GIO (get input/output) ...............................................................................................................................59
5.7.16 CALC (calculate) ............................................................................................................................................62
5.7.17 COMP (compare)...........................................................................................................................................63
5.7.18 JC (jump conditional)..................................................................................................................................64
5.7.19 JA (jump always)..........................................................................................................................................65
5.7.20 CSUB (call subroutine)................................................................................................................................66
5.7.21 RSUB (return from subroutine)................................................................................................................67
5.7.22 WAIT (wait for an event to occur) .........................................................................................................68
5.7.23 STOP (stop TMCL™ program execution) ...............................................................................................69
5.7.24 SCO (set coordinate) ...................................................................................................................................70
5.7.25 GCO (get coordinate) ..................................................................................................................................71
5.7.26 CCO (capture coordinate)...........................................................................................................................72
5.7.27 ACO ..................................................................................................................................................................73
5.7.28 CALCX (calculate using the X register) ..................................................................................................74
5.7.29 AAP (accumulator to axis parameter) ....................................................................................................75
5.7.30 AGP (accumulator to global parameter) ...............................................................................................80

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 3
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
5.7.31 CLE (clear error flags) .................................................................................................................................84
5.7.32 VECT (set interrupt vector) ........................................................................................................................85
5.7.33 EI (enable interrupt) ...................................................................................................................................86
5.7.34 DI (disable interrupt)..................................................................................................................................87
5.7.35 RETI (return from interrupt) .....................................................................................................................88
5.7.36 Customer specific TMCL™ command extension (UF0… UF7/user function) ................................89
5.7.37 Request target position reached event.................................................................................................90
5.7.38 BIN (return to binary mode) ....................................................................................................................91
5.7.39 TMCL™ Control Functions.........................................................................................................................92
6Axis parameters ..........................................................................................................................................................94
7Global parameters....................................................................................................................................................100
7.1 Bank 0 .................................................................................................................................................................100
7.2 Bank 1 .................................................................................................................................................................102
7.3 Bank 2 .................................................................................................................................................................102
7.4 Bank 3 .................................................................................................................................................................103
8Hints and tips ............................................................................................................................................................104
8.1 Reference search ..............................................................................................................................................104
8.2 Changing the prescaler value of an encoder ..........................................................................................107
8.3 stallGuard2.........................................................................................................................................................108
8.4 coolStep™ related axis parameters............................................................................................................108
8.5 Velocity calculation .........................................................................................................................................110
8.6 Using the RS485 interface .............................................................................................................................111
9Revision history ........................................................................................................................................................112
9.1 Firmware revision............................................................................................................................................112
9.2 Document revision ..........................................................................................................................................112
10 References...................................................................................................................................................................113

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 4
Copyright © 2011, 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 2011
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.

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 5
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
2Features
The PD57/60-1060 is a full mechatronic device consisting of a NEMA 23 (flange size 57mm) or NEMA 24
(flange size 60mm) stepper motor, controller/driver electronics and integrated encoder. The electronics itself
is also available without the motor as TMCM-1060 module.
Applications
Compact single-axis stepper motor solutions
Encoder feedback for high reliability operation
Electrical data
Supply voltage: common supply voltages +12VDC / +24VDC / +48VDC supported (+9V… +51V DC)
(Please note: pre-series boards are limited to +40V max. supply voltage!)
Motor current: up to 2.8A RMS (programmable)
Integrated motor (for PD57/60-1060 only)
Two phase bipolar stepper motor with 2.8A RMS nom. coil current
Holding torque with 57mm motor: 0.55Nm, 1.01Nm, 1.26Nm or 1.89Nm
Holding torque with 60mm motor: 1.1Nm, 1.65Nm, 2.1Nm or 3.1Nm
Integrated encoder
Integrated sensOstep™ magnetic encoder (max. 256 increments per rotation) for step-loss detection
under all operating conditions
Integrated motion controller
High performance ARM7 microcontroller for overall system control and communication protocol handling
Integrated bipolar stepper motor driver (based on TMC262)
Up to 256 microsteps per full step
High-efficient operation, low power dissipation (MOSFETs with low RDS(ON))
Dynamic current control
Integrated protection
High precision sensorless motor load measurement stallGuard2™
Automatic load dependent motor current adaptation for reduced power consumption and heat
dissipation (coolStep™)
Interfaces
2 inputs for stop switches / 1 input for home switch (+24V compatible) with programmable pull-up
2 general purpose inputs (+24V compatible) and 2 general purpose outputs (open collector)
USB (mini-USB), RS485 and CAN (2.0B up-to 1Mbit/s) serial communication interfaces
Step/direction interface (optically isolated)
Safety features
Shutdown input –driver will be disabled in hardware as long as this pin is left open or shorted to
ground
Separate supply voltage inputs for driver and digital logic. The driver supply voltage may be switched
off externally while the supply for the digital logic and therefore the digital logic itself remains active
On board 3A fuse
Software
Available with TMCL™
Stand-alone operation or remote controlled operation
Program memory (non volatile) for up to 2048 TMCL™ commands
PC-based application development software TMCL-IDE available for free
Please refer to separate Hardware Manual for further information.

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 6
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
3Overview
As with most TRINAMIC modules the software running on the microprocessor of the TMCM-1060 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 TMCL™firmware shipped with most of
TRINAMIC modules with regard to protocol and commands. On the TMCM-1060 module the Atmel
AT91SAM7X256 is used to run the TMCL™ operating system. The CPU has 256KB flash memory and a 64KB
RAM. The microcontroller runs the TMCL™ (Trinamic Motion Control Language) operating system which
makes it possible to execute TMCL™ commands that are sent to the module from the host via the RS485,
CAN, or USB. It is possible to use the step/dir interface, too.
The TMC262 on the module is an energy efficient high current high precision microstepping driver IC for
bipolar stepper motors. Its unique high resolution sensorless load detection stallGuard2™ is used for a
special integrated load dependent current control feature called coolStep™. The ability to read out the load
and detect an overload makes the TMC262 an optimum choice for drives where a high reliability is desired.
Please mind this technical innovation.
All commands and parameters available with this unit are explained on the following pages.

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 7
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
4Putting the PD57/60-1060 into operation
Here you can find basic information for putting your PANdrive™ into operation. The further text contains a
simple example for a TMCL™ program and a short description of operating the module in direct mode.
If you ordered the module without motor, please connect it with a fitting one. You will find more
information about the motor connector in the PD57/60-1060 Hardware Manual.
The things you need:
PD57/60-1060
Interface (RS485, USB, CAN, step/dir) suitable to your PANdrive™ with cables
Nominal supply voltage +24V DC (12, 24 or 48V DC) for your module
TMCL-IDE program and PC
Precautions:
Do not connect or disconnect the PANdrive™ while powered!
Do not connect or disconnect the motor while powered!
Do not exceed the maximum power supply of 51V DC.
Start with power supply OFF!
4.1 Starting up
Motor
USB
Power
Serial
communication
GPIO
S/D
4
1
41
1
8
1
4
1
5
Figure 4.1: Overview connectors

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 8
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
1. Connect the interface
a) Connect the RS485 or the CAN interface
A 2mm pitch 5 pin JST B5B-PH-K connector is used for serial communication.
Please connect as follows:
1
5
Pin
Label
Description
1
CAN_H
CAN bus signal (dominant high)
2
CAN_L
CAN bus signal (dominant low)
3
GND
Module ground (system and signal ground)
4
RS485+
RS485 bus signal (non inverted)
5
RS485-
RS485 bus signal (inverted)
Table 4.1: Connector for serial communication
b) Connect the USB interface
A 5-pin standard mini-USB connector is available on board.
Please connect as follows:
Pin
Label
Description
1
VBUS
+5V power
2
D-
Data –
3
D+
Data +
4
ID
Not connected
5
GND
ground
Table 4.2: Mini USB connector
2. Connect the power supply
A 4-pin JST EH series B4B-EH connector is used as power connector on-board.
Please connect as follows:
4
1
Pin
Label
Description
1
+UDriver
Module + driver stage power supply input
2
+ULogic
(Optional) separate digital logic power supply input
3
/SHUTDOWN
Shutdown input. Connect this input to +UDriver or +ULogic in
order to activate driver stage. Leaving this input open or
connecting it to ground will disable the driver stage
4
GND
Module ground (power supply and signal ground)
Table 4.3: Connector for power supply
Attention:
In order to enable the motor driver stage connect /SHUTDOWN (pin 3) to power supply!
In case separate power supplies for driver and logic are not used pin 2 (logic supply) and
pin 3 (/SHUTDOWN input) of the power connector may be connected together in order to
enable the driver stage.
Please note, that there is no protection against reverse polarity or voltages above the upper
maximum limit. The power supply typically should be within a range of +9 to +51V. Pre-
series boards are limited to +40V max. power supply.

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 9
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
3. Switch ON the power supply
The LED for power should flash 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.
4. Start the TMCL-IDE software development environment
The TMCL-IDE is available 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.
For RS485 choose COM port and type with the parameters shown below (baud rate 9600).
Click OK.
Attention:
Please refer to the TMCL-IDE User Manual for more information about connecting the
other interfaces (see www.TRINAMIC.com).
If you prefer to work with step/dir interface please proceed by using axis parameter
254 for switching to step/direction or back to TMCL™ (paragraph 5.7.5):
Command
Description
SAP 254, o, 0
Normal mode (move motor using TMCL™ commands)
SAP 254, o, 1
Step/direction mode (move motor via step/direction inputs)

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 10
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
4.2 Testing with a simple TMCLTM program
Open the file test2.tmc. Change the motor number 2 in the second paragraph in motor number 0 (because
there is only one motor involved). Now your test program looks as follows:
Assemble
Download Run
Stop
1. Click on icon Assemble to convert the TMCL™ into machine code.
2. Then download the program to the TMCM-1060 module via the icon Download.
3. Press icon Run. The desired program will be executed.
4. Click Stop button to stop the program.
//A simple example for using TMCL™and TMCL-IDE
SAP 4, 0, 50000 //Set max. Velocity
SAP 5, 0, 5000 //Set max. Acceleration
Loop: MVP ABS, 0, 100000 //Move to Position 10000
WAIT POS, 0, 0 //Wait until position reached
MVP ABS, 0, -100000 //Move to Position -10000
WAIT POS, 0, 0 //Wait until position reached
JA Loop //Infinite Loop

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 11
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
4.3 Operating the module in direct mode
1. Start TMCL™ Direct Mode.
Direct Mode
2. If the communication is established the PD57/60-1060 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 50000 -> 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.
Attention:
Please mind the chapter 3 (programming techniques) of the TMCL-IDE User
Manual on www.trinamic.com. Here you will find information about creating
general structures of TMCL-programs. In particular initialization, main loop,
symbolic constants, variables, and subroutines are described there. Further you
can learn how to mix direct mode and stand alone mode.
Chapter Fehler! Verweisquelle konnte nicht gefunden werden. (axis
parameters) includes a diagram which points the coolStep™ related axis
parameters and their functions. This can help you configuring your module to
meet your needs.

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 12
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
5TMCL™ and TMCL-IDE
The TMCM-1060 supports TMCL™direct mode (binary commands or ASCII interface) and stand-alone TMCL™
program execution. You can store up to 2048 TMCL™instructions on it.
In direct mode and most cases the TMCL™communication over RS485, 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 TMCL-1060. The TMCL™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/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 [TMCL™] 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
TMCM-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 TMCL™applications using the TMCL-IDE (IDE means 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 TMCL™
commands and their usage.
5.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 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 RS485 and 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).

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 13
Copyright © 2011, 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
5.2 Reply format
Every time a command has been sent to a module, the module sends a reply.
The reply format for RS485 or 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!

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 14
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
5.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 TMCL™
program EEPROM
1
Wrong checksum
2
Invalid command
3
Wrong type
4
Invalid value
5
Configuration EEPROM locked
6
Command not available
5.3 Stand-alone applications
The module is equipped with an EEPROM for storing TMCL™applications. You can use TMCL-IDE for
developing stand-alone TMCL™applications. You can load them down into the EEPROM and then it will run
on the module. The TMCL-IDE contains an editor and the TMCL™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.
5.4 TMCL™command overview
In this section a short overview of the TMCL™commands is given.
5.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

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 15
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
5.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
5.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
5.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 TMCL™program
5.4.5 Calculation commands
These commands are intended to be used for calculations within TMCL™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

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 16
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
For calculating purposes there is an accumulator (or accu or A register) and an X register. When executed in
a TMCL™program (in stand-alone mode), all TMCL™ 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 TMCL™ 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 TMCL™ program running on the module.
5.4.6 Interrupt commands
Due to some customer requests, interrupt processing has been introduced in the TMCL™ firmware for ARM
based modules from revision 4.23 on. The TMCL-IDE supports the following commands from version 1.78 on.
Mnemonic
Command
number
Meaning
EI
25
Enable interrupt
DI
26
Disable interrupt
VECT
37
Set interrupt vector
RETI
38
Return from interrupt
5.4.6.1 Interrupt types
There are many different interrupts in TMCL™, like timer interrupts, stop switch interrupts, position reached
interrupts, and input pin change interrupts. Each of these interrupts has its own interrupt vector. Each
interrupt vector is identified by its interrupt number. Please use the TMCL™ include file Interrupts.inc for
symbolic constants of the interrupt numbers.
5.4.6.2 Interrupt processing
When an interrupt occurs and this interrupt is enabled and a valid interrupt vector has been defined for that
interrupt, the normal TMCL™ program flow will be interrupted and the interrupt handling routine will be
called. Before an interrupt handling routine gets called, the context of the normal program will be saved
automatically (i.e. accumulator register, X register, TMCL™ flags).
There is no interrupt nesting, i.e. all other interrupts are disabled while an interrupt handling routine is
being executed.
On return from an interrupt handling routine, the context of the normal program will automatically be
restored and execution of the normal program will be continued.
5.4.6.3 Interrupt vectors
The following table shows all interrupt vectors that can be used.
Interrupt number
Interrupt type
0
Timer 0
1
Timer 1
2
Timer 2
3
Target position reached
15
stallGuard™
21
Deviation
27
Left stop switch
28
Right stop switch
39
Input change 0
40
Input change 1
255
Global interrupts

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 17
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
5.4.6.4 Further configuration of interrupts
Some interrupts need further configuration (e.g. the timer interval of a timer interrupt). This can be done
using SGP commands with parameter bank 3 (SGP <type>, 3, <value>). Please refer to the SGP command
(paragraph 5.7.9) for further information about that.
5.4.6.5 Using interrupts in TMCL™
To use an interrupt the following things have to be done:
Define an interrupt handling routine using the VECT command.
If necessary, configure the interrupt using an SGP <type>, 3, <value> command.
Enable the interrupt using an EI <interrupt> command.
Globally enable interrupts using an EI 255 command.
An interrupt handling routine must always end with a RETI command
The following example shows the use of a timer interrupt:
VECT 0, Timer0Irq //define the interrupt vector
SGP 0, 3, 1000 //configure the interrupt: set its period to 1000ms
EI 0 //enable this interrupt
EI 255 //globally switch on interrupt processing
//Main program: toggles output 3, using a WAIT command for the delay
Loop:
SIO 3, 2, 1
WAIT TICKS, 0, 50
SIO 3, 2, 0
WAIT TICKS, 0, 50
JA Loop
//Here is the interrupt handling routine
Timer0Irq:
GIO 0, 2 //check if OUT0 is high
JC NZ, Out0Off //jump if not
SIO 0, 2, 1 //switch OUT0 high
RETI //end of interrupt
Out0Off:
SIO 0, 2, 0 //switch OUT0 low
RETI //end of interrupt
In the above example, the interrupt numbers are used directly. To make the program better readable please
use the provided include file Interrupts.inc. This file defines symbolic constants for all interrupt numbers
which can be used in all interrupt commands. The beginning of the above program then looks like the
following:
#include Interrupts.inc
VECT TI_TIMER0, Timer0Irq
SGP TI_TIMER0, 3, 1000
EI TI_TIMER0
EI TI_GLOBAL
Please also take a look at the other example programs.

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 18
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
5.5 TMCL™ list of commands
The following TMCL™ 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 number>
Restore global parameter (TMCL™ user
variable 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
EI
25
<interrupt number>
Enable interrupt
DI
26
<interrupt number>
Disable interrupt
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
GCO
31
<coordinate number>, <motor number>
Get coordinate
CCO
32
<coordinate number>, <motor number>
Capture coordinate
CALCX
33
<operation>
Process accumulator & X-register
AAP
34
<parameter>, <motor number>
Accumulator to axis parameter
AGP
35
<parameter>, <bank number>
Accumulator to global parameter
VECT
37
<interrupt number>, <label>
Set interrupt vector
RETI
38
Return from interrupt
ACO
39
<coordinate number>, <motor number>
Accu to coordinate

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 19
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
TMCL™ control commands:
Instruction
Description
Type
Mot/Bank
Value
128 –stop application
a running TMCL™ standalone
application is stopped
don’t care
don’t care
don’t care
129 –run application
TMCL™ execution is started (or
continued)
0 - run from
current address
1 - run from
specified address
don’t care
don’t care
starting address
130 –step application
only the next command of a
TMCL™ application is executed
don’t care
don’t care
don’t care
131 –reset application
the program counter is set to
zero, and the standalone
application is stopped (when
running or stepped)
don’t care
don’t care
don’t care
132 –start download
mode
target command execution is
stopped and all following
commands are transferred to
the TMCL™ memory
don’t care
don’t care
starting address
of the application
133 –quit download
mode
target command execution is
resumed
don’t care
don’t care
don’t care
134 –read TMCL™
memory
the specified program memory
location is read
don’t care
don’t care
<memory
address>
135 –get application
status
one of these values is
returned:
0 –stop
1 –run
2 –step
3 –reset
don’t care
don’t care
don’t care
136 –get firmware
version
return the module type and
firmware revision either as a
string or in binary format
0 –string
1 –binary
don’t care
don’t care
137 –restore factory
settings
reset all settings stored in the
EEPROM to their factory
defaults
This command does not send
back a reply.
don’t care
don’t care
must be 1234
138 –reserved
139 –enter ASCII
mode
Enter ASCII command line (see
chapter 5.6)
don’t care
don’t care
don’t care

PD57/60-1060 / TMCM-1060 TMCL™ Firmware Manual (V1.04 / 2011-AUG-29) 20
Copyright © 2011, TRINAMIC Motion Control GmbH & Co. KG
5.6 The ASCII interface
The ASCII interface can be used to communicate with the module and to send some commands as text
strings.
The ASCII command line interface is entered by sending the binary command 139 (enter ASCII
mode).
Afterwards the commands are entered as in the TMCL-IDE. Please note that only those commands,
which can be used in direct mode, also can be entered in ASCII mode.
For leaving the ASCII mode and re-enter the binary mode enter the command BIN.
5.6.1 Format of the command line
As the first character, the address character has to be sent. The address character is Awhen the module
address is 1, Bfor modules with address 2 and so on. After the address character there may be spaces (but
this is not necessary). Then, send the command with its parameters. At the end of a command line a <CR>
character has to be sent.
Here are some examples for valid command lines:
AMVP ABS, 1, 50000
A MVP ABS, 1, 50000
AROL 2, 500
A MST 1
ABIN
These command lines would address the module with address 1. To address e.g. module 3, use address
character Cinstead of A. The last command line shown above will make the module return to binary mode.
5.6.2 Format of a reply
After executing the command the module sends back a reply in ASCII format. This reply consists of:
the address character of the host (host address that can be set in the module)
the address character of the module
the status code as a decimal number
the return value of the command as a decimal number
a <CR> character
So, after sending AGAP 0, 1 the reply would be BA 100 –5000 if the actual position of axis 1 is –5000,
the host address is set to 2 and the module address is 1. The value 100 is the status code 100 that means
command successfully executed.
5.6.3 Commands that can be used in ASCII mode
The following commands can be used in ASCII mode: ROL, ROR, MST, MVP, SAP, GAP, STAP, RSAP, SGP, GGP,
STGP, RSGP, RFS, SIO, GIO, SCO, GCO, CCO, UF0, UF1, UF2, UF3, UF4, UF5, UF6, and UF7.
There are also special commands that are only available in ASCII mode:
BIN: This command quits ASCII mode and returns to binary TMCL™ mode.
RUN: This command can be used to start a TMCL™ program in memory.
STOP: Stops a running TMCL™ application.
This manual suits for next models
2
Table of contents
Other Trinamic Engine manuals
Popular Engine manuals by other brands

Sumitomo Drive Technologies
Sumitomo Drive Technologies HYPONIC DRIVE instruction manual

Aiqidi
Aiqidi AiF15 manual

Mitsubishi Heavy Industries
Mitsubishi Heavy Industries Meiki TL Series instruction manual

Regal-Beloit
Regal-Beloit Genteq Evergreen VS installation guide

ABB
ABB MU 80 product manual

Vetus
Vetus M2.C5 Operation manual

CTR Electronics
CTR Electronics TALON FX VEX.PRO FALCON 500 manual

Graco
Graco Viscount I Plus Instructions-parts list

Continental Refrigerator
Continental Refrigerator CD-170 Operation & maintenance manual

Kohler
Kohler CS10 Service manual

Porsche
Porsche M 44/01 Workshop manual

Chris-Craft
Chris-Craft 283 V-8 Operator's manual