Pandrive PD42-1270 TMCL User manual

PANdrive™for Stepper Motors PANDRIVE™
PD42-1270 TMCL™Firmware Manual
Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02
The PD42-1270 is an easy to use, single axis controller/driver PANdrive™for 2-phase bipolar step-
per motors with separate differential encoder and separate home and stop switch inputs. Dy-
namic current control, and quiet, smooth and efficient operation are combined with stealthChop™,
dcStep™, stallGuard™and coolStep™features. Three digital inputs can be configured as home and
endstop switches or incremental encoder inputs. A fourth digital input is available to enable or
disable the motor.
Features
•Single Axis Stepper motor control
•Supply voltage 24V DC
•TMCL™
•Motion Contoller
•CAN
•dcStep™
•
Integrated
sixPoint™
ramp motion
controller
•stealthChop™silent PWM mode
•spreadCycle™smart mixed decay
•stallGuard2™load detection
•coolStep™autom. current scaling
Applications
•Lab-Automation
•Semiconductor Handling
•Manufacturing
•Robotics
•Factory Automation
•CNC
•Laboratory Automation
Simplified Block Diagram
+6V..+28V DC
ARM
Cortex-M0+TM
microcontroller
TMCL™
Memory
Step
Motor
CAN
Energy Efficient
Driver
TMC262
Stepper
motor
controller +
driver
TMCM-1270
I2C
SPI
Input
REFL/REFR
PD42-x-1270
ENC_A/ENC_B
/ENABLE
4
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at: www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 2 / 91
Contents
1 Features 6
1.1 stallGuard2 ................................................. 7
1.2 coolStep .................................................. 7
2 First Steps with TMCL 8
2.1 Basic Setup ................................................. 8
2.2 Using the TMCL Direct Mode ...................................... 8
2.3 Changing Axis Parameters ........................................ 8
2.4 Testing with a simple TMCL Program .................................. 9
3 TMCL and the TMCL-IDE —An Introduction 11
3.1 Binary Command Format ........................................ 11
3.1.1 Checksum Calculation ...................................... 12
3.2 Reply Format ............................................... 13
3.2.1 Status Codes ........................................... 13
3.3 Standalone Applications ......................................... 14
3.4 TMCL Command Overview ....................................... 15
3.4.1 TMCL Commands ......................................... 15
3.5 TMCL Commands by Subject ...................................... 16
3.5.1 Parameter Commands ...................................... 16
3.5.2 Branch Commands ........................................ 16
3.5.3 I/O Port Commands ....................................... 17
3.5.4 Calculation Commands ..................................... 17
3.6 Detailed TMCL Command Descriptions ................................ 19
3.6.1 SAP (Set Axis Parameter) .................................... 19
3.6.2 GAP (Get Axis Parameter) .................................... 20
3.6.3 STAP (Store Axis Parameter) ................................... 21
3.6.4 RSAP (Restore Axis Parameter) ................................. 22
3.6.5 SGP (Set Global Parameter) ................................... 23
3.6.6 GGP (Get Global Parameter) .................................. 24
3.6.7 STGP (Store Global Parameter) ................................. 25
3.6.8 RSGP (Restore Global Parameter) ............................... 26
3.6.9 RFS (Reference Search) ...................................... 27
3.6.10 GIO (Get Input) .......................................... 29
3.6.11 CALC (Calculate) .......................................... 31
3.6.12 COMP (Compare) ......................................... 33
3.6.13 JC (Jump conditional) ....................................... 34
3.6.14 JA (Jump always) ......................................... 36
3.6.15 CSUB (Call Subroutine) ...................................... 37
3.6.16 RSUB (Return from Subroutine) ................................ 38
3.6.17 WAIT (Wait for an Event to occur) ................................ 39
3.6.18 STOP (Stop TMCL Program Execution –End of TMCL Program) .............. 41
3.6.19 SCO (Set Coordinate) ....................................... 42
3.6.20 GCO (Get Coordinate) ...................................... 43
3.6.21 CCO (Capture Coordinate) .................................... 45
3.6.22 ACO (Accu to Coordinate) .................................... 46
3.6.23 CALCX (Calculate using the X Register) ............................. 47
3.6.24 AAP (Accu to Axis Parameter) .................................. 49
3.6.25 AGP (Accu to Global Parameter) ................................ 50
3.6.26 CLE (Clear Error Flags) ...................................... 51
3.6.27 Customer specific Command Extensions (UF0. . . UF7 –User Functions) ......... 53
3.6.28 Request Target Position reached Event ............................ 54
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 3 / 91
3.6.29 TMCL Control Commands .................................... 56
4 Axis Parameters 58
5 Global Parameters 68
5.1 Bank 0 ................................................... 68
5.2 Bank 2 ................................................... 69
6 Module Specific Modes 71
7 Hints and Tips 72
7.1 Reference Search ............................................. 72
7.1.1 Mode 1 ............................................... 73
7.1.2 Mode 2 ............................................... 73
7.1.3 Mode 3 ............................................... 73
7.1.4 Mode 4 ............................................... 74
7.1.5 Mode 5 ............................................... 74
7.1.6 Mode 6 ............................................... 75
7.1.7 Mode 7 ............................................... 75
7.1.8 Mode 8 ............................................... 76
7.2 stallGuard2 ................................................. 77
7.3 coolStep .................................................. 78
7.4 Velocity and Acceleration Calculation ................................. 80
8 TMCL Programming Techniques and Structure 81
8.1 Initialization ................................................ 81
8.2 Main Loop ................................................. 81
8.3 Using Symbolic Constants ........................................ 81
8.4 Using Variables .............................................. 82
8.5 Using Subroutines ............................................ 83
8.6 Combining Direct Mode and Standalone Mode ........................... 83
9 Figures Index 85
10 Tables Index 86
11 Supplemental Directives 89
11.1 Producer Information .......................................... 89
11.2 Copyright .................................................. 89
11.3 Trademark Designations and Symbols ................................. 89
11.4 Target User ................................................. 89
11.5 Disclaimer: Life Support Systems .................................... 89
11.6 Disclaimer: Intended Use ........................................ 89
11.7 Collateral Documents & Tools ...................................... 90
12 Revision History 91
12.1 Document Revision ............................................ 91
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 4 / 91
1 Features
The PD42-1270 is a single axis controller/driver PANdrive
™
for 2-phase bipolar stepper motors with state
of the art feature set. It is highly integrated, offers a convenient handling and can be used in many
decentralized applications. The PANdrive
™
has been designed for coil currents up to 1A RMS and 24V
DC supply voltage. Three digital inputs can be configured as home and endstop switches or incremental
encoder inputs. With its high energy efficiency from TRINAMIC’s coolStep
™
technology cost for power
consumption is kept down. The TMCL firmware allows for both standalone and direct mode operation.
Main characteristics
•Motion controller & stepper motor driver:
–Hardware motion profile calculation in real-time
–On the fly alteration of motion parameters (e.g. position, velocity, acceleration)
–
High performance microcontroller for overall system control and communication protocol
handling
–Up to 256 microsteps per full step
–High-efficient operation, low power dissipation
–Dynamic current control
–Integrated protection
–stallGuard2™feature for stall detection
–coolStep™feature for reduced power consumption and heat dissipation
–stealthChop™feature for quiet operation and smooth motion
–dcStep™feature for load dependent speed control
•Interfaces
–CAN
–Low-active enable pin
–Three I/O modes:
*Incremental Encoder and Home Switch
*Home and Endstop Switches
*One analog and two digital inputs
Software
TMCL: remote controlled operation alone or during step/direction mode. PC-based application develop-
ment software TMCL-IDE available for free.
Electrical data
•Supply voltage: +6V and +24V nominal.
•Motor current: up to 1A RMS / 1.41A peak (programmable).
Please see also the separate Hardware Manual.
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 5 / 91
1.1 stallGuard2
stallGuard2 is a high-precision sensorless load measurement using the back EMF of the coils. It can be
used for stall detection as well as other uses at loads below those which stall the motor. The stallGuard2
measurement value changes linearly over a wide range of load, velocity, and current settings. At maximum
motor load, the value reaches zero or is near zero. This is the most energy-efficient point of operation for
the motor.
Load [Nm] stallGuard2
Initial stallGuard2 (SG) value: 100%
Max. load
stallGuard2 (SG) value: 0
Maximum load reached.
Motor close to stall.
Motor stalls
Figure 1: stallGuard2 Load Measurement as a Function of Load
1.2 coolStep
coolStep is a load-adaptive automatic current scaling based on the load measurement via stallGuard2
adapting the required current to the load. Energy consumption can be reduced by as much as 75%.
coolStep allows substantial energy savings, especially for motors which see varying loads or operate at a
high duty cycle. Because a stepper motor application needs to work with a torque reserve of 30% to 50%,
even a constant-load application allows significant energy savings because coolStep automatically enables
torque reserve when required. Reducing power consumption keeps the ystem cooler, increases motor life,
and allows cost reduction.
0
0,1
0,2
0,3
0,4
0,5
0,6
0,7
0,8
0,9
0 50 100 150 200 250 300 350
Efficiency
Velocity [RPM]
Efficiency with coolStep
Efficiency with 50% torque reserve
Figure 2: Energy Efficiency Example with coolStep
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 6 / 91
2 First Steps with TMCL
In this chapter you can find some hints for your first steps with the PD42-1270 and TMCL. You may skip
this chapter if you are already familiar with TMCL and the TMCL-IDE.
Things that you will need
•Your PD42-1270 PANdrive™.
•A CAN adapter.
•A power supply (24V DC) for your PD42-1270 module.
•The TMCL-IDE 3.x already installed on your PC
2.1 Basic Setup
First of all, you will need a PC with Windows (at least Windows 7) and the TMCL-IDE 3.x installed on it. If
you do not have the TMCL-IDE installed on your PC then please download it from the TMCL-IDE product
page of Trinamic’s website (http://www.trinamic.com) and install it on your PC.
Please also ensure that your PD42-1270 is properly connected to your power supply and that the stepper
motor is properly connected to the module. Please see the PD42-1270 hardware manual for instructions
on how to do this.
Do not connect or disconnect a stepper motor to or from the module while the
module is powered!
Then, please start up the TMCL-IDE. After that you can connect your PD42-1270 via CAN and switch on the
power supply for the module (while the TMCL-IDE is running on your PC). The module will be recognized
by the TMCL-IDE, and necessary driver registrations in Windows will automatically done by the TMCL-IDE.
2.2 Using the TMCL Direct Mode
At first try to use some TMCL commands in direct mode. In the TMCL-IDE a tree view showing the PD42-
1270 and all tools available for it is displayed. Click on the Direct Mode entry of the tool tree. Now, the
Direct Mode tool will pop up.
In the Direct Mode tool you can choose a TMCL command, enter the necessary parameters and execute
the command.
2.3 Changing Axis Parameters
Next you can try changing some settings (also called axis parameters) using the SAP command in direct
mode. Choose the SAP command. Then choose the parameter type and the motor number. Last, enter
the desired value and click execute to execute the command which then changes the desired parameter.
The following table points out the most important axis parameters. Please see chapter 4for a complete
list of all axis parameters.
Most important axis parameters
Number Axis Parameter Description Range [Units] Default Access
4 Maximum
speed
The maximum speed used for posi-
tioning ramps.
0...7999774
[pps]
150000 RWE
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 7 / 91
Number Axis Parameter Description Range [Units] Default Access
5 Maximum
acceleration
Maximum acceleration in positioning
ramps. Acceleration and deceleration
value in velocity mode.
0...7629278
[pps/s]
1000 RWE
6 Maximum
current
Motor current used when motor is
running. The maximum value is 31
which means 100% of the maximum
current of the module.
0...31 24 RWE
7 Standby
current
The current used when the motor is
not running. The maximum value is
31 which means 100% of the maxi-
mum current of the module. This
value should be as low as possible so
that the motor can cool down when it
is not moving.
0...31 3 RWE
140 Microstep
Resolution
Microstep resolutions per full step:
0 - fullstep
1 - halfstep
2 - 4 microsteps
3 - 8 microsteps
4 - 16 microsteps
5 - 32 microsteps
6 - 64 microsteps
7 - 128 microsteps
8 - 256 microsteps
0...8 4 RWE
141 Microstep
Interpolation
Interpolation of the current microstep
resolution to 256 microsteps:
0 - No interpolation
1 - Interpolation to 256 microsteps
0...1 1 RWE
179 VSense Sense resistor voltage:
0 - High sense resistor voltage
1 - Low sense resistor voltage
0...1 0 RWE
Table 1: Most important Axis Parameters
2.4 Testing with a simple TMCL Program
Now, test the TMCL stand alone mode with a simple TMCL program. To type in, assemble and download
the program, you will need the TMCL creator. This is also a tool that can be found in the tool tree of
the TMCL-IDE. Click the TMCL creator entry to open the TMCL creator. In the TMCL creator, type in the
following little TMCL program:
1
ROL 0, 51200 // Rotate motor 0 with speed 10000
WAIT TICKS , 0, 500
3
MST 0
ROR 0, 51200 // Rotate motor 0 with 50000
5
WAIT TICKS , 0, 500
MST 0
7
SAP 4, 0, 51200 //Set max. Velocity
9
SAP 5, 0, 51200 //Set max. Acceleration
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 8 / 91
Loop:
11
MVP ABS , 0, 512000 // Move to Position 512000
WAIT POS , 0, 0 // Wait until position reached
13
MVP ABS , 0, -512000 // Move to Position -512000
WAIT POS , 0, 0 // Wait until position reached
15
JA Loop // Infinite Loop
After you have done that, take the following steps:
1.
Click the Assemble icon (or choose Assemble from the TMCL menu) in the TMCL creator to assemble
the program.
2.
Click the Download icon (or choose Download from the TMCL menu) in the TMCL creator to donwload
the program to the module.
3.
Click the Run icon (or choose Run from the TMCL menu) in the TMCL creator to run the program on
the module.
Also try out the debugging functions in the TMCL creator:
1. Click on the Bug icon to start the debugger.
2. Click the Animate button to see the single steps of the program.
3. You can at any time pause the program, set or reset breakpoints and resume program execution.
4. To end the debug mode click the Bug icon again.
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 9 / 91
3 TMCL and the TMCL-IDE —An Introduction
As with most TRINAMIC modules the software running on the microprocessor of the PD42-1270 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 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 PD42-1270 supports TMCL direct mode (binary commands). It also implements standalone TMCL
program execution. This makes it possible to write TMCL programs using the TMCL-IDE and store them in
the memory of the module.
In direct mode the TMCL communication over RS-232, RS-485, CAN and USB 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 PD42-1270. 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 the
interface 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 standalone 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 com-
mands from the host to a module in direct mode, whereas the mnemonic format is used for easy usage of
the commands when developing standalone 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.
3.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 RS-232, RS-485, RS-422 or USB
interface, it has to be enclosed by an address byte at the beginning and a checksum byte at the end. In
these cases it consists of nine bytes.
The binary command format with RS-232, RS-485, RS-422 and USB is as follows:
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 10 / 91
TMCL Command Format
Bytes Meaning
1 Module address
1 Command number
1 Type number
1 Motor or Bank number
4 Value (MSB first!)
1 Checksum
Table 2: TMCL Command Format
Info
The checksum is calculated by accumulating all the other bytes using an 8-bit
addition.
Note
When using the CAN interface, leave out the address byte and the checksum byte.
With CAN, the CAN-ID is used as the module address and the checksum is not
needed because CAN bus uses hardware CRC checking.
3.1.1 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 which show how to do this:
Checksum calculation in C:
1
unsigned char i, Checksum ;
unsigned char Command [9];
3
//Set the Command array to the desired command
5
Checksum = Command [0];
for(i=1; i<8; i++)
7
Checksum += Command [i];
9
Command [8]= Checksum; // insert checksum as last byte of the command
//Now , send it to the module
Checksum calculation in Delphi:
var
2
i, Checksum: byte;
Command: array [0..8] of byte;
4
//Set the Command array to the desired command
6
// Calculate the Checksum :
8
Checksum := Command [0];
for i:=1 to 7do Checksum := Checksum+ Command [i];
10
Command [8]:= Checksum;
//Now , send the Command array (9 bytes) to the module
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 11 / 91
3.2 Reply Format
Every time a command has been sent to a module, the module sends a reply.
The reply format with RS-232, RS-485, RS-422 and USB is as follows:
TMCL Reply Format
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
Table 3: TMCL Reply Format
Info
The checksum is also calculated by adding up all the other bytes using an 8-bit
addition. Do not send the next command before having received the reply!
Note
When using CAN interface, the reply does not contain an address byte and a
checksum byte. With CAN, the CAN-ID is used as the reply address and the
checksum is not needed because the CAN bus uses hardware CRC checking.
3.2.1 Status Codes
The reply contains a status code. The status code can have one of the following values:
TMCL Status Codes
Code Meaning
100 Successfully executed, no error
101 Command loaded into TMCL program EEPROM
1 Wrong checksum
2Invalid command
3 Wrong type
4Invalid value
5 Configuration EEPROM locked
6 Command not available
Table 4: TMCL Status Codes
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 12 / 91
3.3 Standalone Applications
The module is equipped with a TMCL memory for storing TMCL applications. You can use the TMCL-IDE for
developing standalone TMCL applications. You can download a program into the EEPROM and afterwards
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.
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 13 / 91
3.4 TMCL Command Overview
This sections gives a short overview of all TMCL commands.
3.4.1 TMCL Commands
Overview of all TMCL Commands
Command Number Parameter Description
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>,
<value>
Store axis parameter (store motion
control specific settings)
RSAP 8 <parameter>, <motor number>
Restore axis parameter (restore mo-
tion control specific settings)
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 mod-
ule specific settings e.g. communica-
tion 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
variables only)
RFS 13
<START|STOP|STATUS>, <motor num-
ber>
Reference search
GIO 15 <port number>, <bank number> Get value of analog/digital input
CALC 19 <operation>, <value> Process accumulator and value
COMP 20 <value> Compare accumulator with 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 num-
ber>, <position>
Set coordinate
GCO 31
<coordinate number>, <motor num-
ber>
Get coordinate
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 14 / 91
Command Number Parameter Description
CCO 32
<coordinate number>, <motor num-
ber>
Capture coordinate
CALCX 33 <operation> Process accumulator and X-register
AAP 34 <parameter>, <motor number> Accumulator to axis parameter
AGP 35 <parameter>, <bank number> Accumulator to global parameter
CLE 36 <flag> Clear an error flag
ACO 39
<coordinate number>, <motor num-
ber>
Accu to coordinate
Table 5: Overview of all TMCL Commands
3.5 TMCL Commands by Subject
3.5.1 Parameter Commands
These commands are used to set, read and store axis parameters or global parameters. Axis parameters
can be set independently for each axis, whereas global parameters control the behavior of the module
itself. These commands can also be used in direct mode and in standalone mode.
Parameter Commands
Mnemonic Command number Meaning
SAP 5 Set axis parameter
GAP 6 Get axis parameter
STAP 7 Store axis parameter
RSAP 8 Restore axis parameter
SGP 9 Set global parameter
GGP 10 Get global parameter
STGP 11 Store global parameter
RSGP 12 Restore global parameter
Table 6: Parameter Commands
3.5.2 Branch Commands
These commands are used to control the program flow (loops, conditions, jumps etc.). Using them in direct
mode does not make sense. They are intended for standalone mode only.
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 15 / 91
Branch Commands
Mnemonic Command number Meaning
JA 22 Jump always
JC 21 Jump conditional
COMP 20 Compare accumulator with constant value
CSUB 23 Call subroutine
RSUB 24 Return from subroutine
WAIT 27 Wait for a specified event
STOP 28 End of a TMCL program
Table 7: Branch Commands
3.5.3 I/O Port Commands
These commands control the external I/O ports and can be used in direct mode as well as in standalone
mode.
I/O Port Commands
Mnemonic Command number Meaning
GIO 15 Get input
Table 8: I/O Port Commands
3.5.4 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.
Calculation Commands
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
Table 9: Calculation Commands
For calculating purposes there is an accumulator (also called accu or A register) and an X register. When
executed in a TMCL program (in standalone 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.
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 16 / 91
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 (standalone mode), a host can still
send commands like GAP and GGP 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.
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 17 / 91
3.6 Detailed TMCL Command Descriptions
The module specific commands are explained in more detail on the following pages. They are listed
according to their command number.
3.6.1 SAP (Set Axis Parameter)
With this command most of the motion control parameters of the module can be specified. The settings
will be stored in SRAM and therefore are volatile. That is, information will be lost after power off.
Info
For a table with parameters and values which can be used together with this
command please refer to section 4.
Internal function:
The specified value is written to the axis parameter specified by the parameter number.
Related commands: GAP, AAP.
Mnemonic: SAP <parameter number>, <axis>, <value>
Binary representation
Binary Representation
Instruction Type Motor/Bank Value
5 see chapter 40 <value>
Reply in Direct Mode
Status Value
100 - OK don’t care
Example Set the maximum positioning speed for motor 0 to 51200 pps.
Mnemonic: SAP 4, 0, 51200.
Binary Form of SAP 4, 0, 51200
Field Value
Target address 01h
Instruction number 05h
Type 04h
Motor/Bank 00h
Value (Byte 3) 00h
Value (Byte 2) 00h
Value (Byte 1) C8h
Value (Byte 0) 00h
Checksum D2h
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 18 / 91
3.6.2 GAP (Get Axis Parameter)
Most motion / driver related parameters of the PD42-1270 can be adjusted using e.g. the SAP command.
With the GAP parameter they can be read out. In standalone mode the requested value is also transferred
to the accumulator register for further processing purposes (such as conditional jumps). In direct mode
the value read is only output in the value field of the reply, without affecting the accumulator.
Info
For a table with parameters and values that can be used together with this
command please refer to section 4.
Internal function: The specified value gets copied to the accumulator.
Related commands: SAP, AAP.
Mnemonic: GAP <parameter number>, <axis>
Binary Representation
Instruction Type Motor/Bank Value
6 see chapter 40 <value>
Reply in Direct Mode
Status Value
100 - OK value read by this command
Example
Get the actual position of motor 0.
Mnemonic: GAP 1, 0.
Binary Form of GAP 1, 0
Field Value
Target address 01h
Instruction number 06h
Type 01h
Motor/Bank 00h
Value (Byte 3) 00h
Value (Byte 2) 00h
Value (Byte 1) 00h
Value (Byte 0) 00h
Checksum 08h
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 19 / 91
3.6.3 STAP (Store Axis Parameter)
This command is used to store TMCL axis parameters permanently in the EEPROM of the module. This
command is mainly needed to store the default configuration of the module. The contents of the user
variables can either be automatically or manually restored at power on.
Info
For a table with parameters and values which can be used together with this
command please refer to dection 4.
Internal function:
The axis parameter specified by the type and bank number will be stored in the
EEPROM.
Related commands: SAP, AAP, GAP, RSAP.
Mnemonic: STAP <parameter number>, <bank>
Binary Representation
Instruction Type Motor/Bank Value
7 see chapter 40 0 (don’t care)
Reply in Direct Mode
Status Value
100 - OK 0 (don’t care)
Example
Store axis parameter #6.
Mnemonic: STAP 7, 6.
Binary Form of STAP 6, 12
Field Value
Target address 01h
Instruction number 07h
Type 06h
Motor/Bank 00h
Value (Byte 3) 00h
Value (Byte 2) 00h
Value (Byte 1) 00h
Value (Byte 0) 00h
Checksum 0Eh
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.

PD42-1270 TMCL™Firmware Manual •Firmware Version V1.00 | Document Revision V1.0 •2017-Mar-02 20 / 91
3.6.4 RSAP (Restore Axis Parameter)
With this command the contents of an axis parameter can be restored from the EEPROM. By default, all
axis parameters are automatically restored after power up. An axis parameter that has been changed
before can be reset to the stored value by this instruction.
Info
For a table with parameters and values which can be used together with this
command please refer to section 4.
Internal function:
The axis parameter specified by the type and bank number will be restored from the
EEPROM.
Related commands: SAP, AAP, GAP, RSAP.
Mnemonic: RSAP <parameter number>, <bank>
Binary Representation
Instruction Type Motor/Bank Value
8 see chapter 40 0 (don’t care)
Reply in Direct Mode
Status Value
100 - OK 0 (don’t care)
Example
Restore axis parameter #6.
Mnemonic: RSAP 8, 6.
Binary Form of RSAP 8, 6
Field Value
Target address 01h
Instruction number 08h
Type 06h
Motor/Bank 00h
Value (Byte 3) 00h
Value (Byte 2) 00h
Value (Byte 1) 00h
Value (Byte 0) 00h
Checksum 0Ah
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com
Read entire documentation.
Table of contents
Popular Controllers manuals by other brands

Clarke
Clarke CAT190 Operating & maintenance instructions

Lumel
Lumel RE70 User Manual & Quick Start

Bernard
Bernard SQ Series Installation, start-up and maintenance instructions

OEG
OEG DKS-classic operating manual

Technische Alternative
Technische Alternative UVR610K installation instructions

Azoteq
Azoteq IQ Switch - ProxSense Series quick start guide

Kelly
Kelly KLS2412ND user manual

Grundfos
Grundfos VGA-113 Installation and operating instructions

Afriso EURO-INDEX
Afriso EURO-INDEX RG 210 instruction manual

Signature
Signature EZ Connect 8250 Series Wiring diagram

ICP DAS USA
ICP DAS USA TPD-703 quick start

Advantech
Advantech ADAM-5550KW Series user manual