4.6.29 CALCX (calculate using the X register) ....................54 4.6.30 AAP (accumulator to axis parameter) ....................55 4.6.31 AGP (accumulator to global parameter) ....................56 4.6.32 CLE (clear error flags) ..........................57 4.6.33 VECT (set interrupt vector) ........................58 www.trinamic.com...
Page 3
Changing the Prescaler Value of an Encoder .................... 77 Stall Detection ..............................78 Fixing Microstep Errors............................. 78 Using the RS485 Interface ..........................78 Life Support Policy ..............................79 Revision History ................................80 Firmware Revision ............................. 80 Document Revision ............................80 10 References..................................80 www.trinamic.com...
Closed-loop operation with TMCL possible (when using the optional incremental encoder interface) Software TMCL™ remote (direct mode) or stand-alone operation (memory for 2048 TMCL commands) Fully supported by TMCL-IDE (PC based integrated development environment) Optional CANopen firmware SPI™ is a trademark of Motorola www.trinamic.com...
Motor 1, coil B Motor_1_B+ Motor 1, coil B Motor_1_A- Motor 1, coil A Motor_1_A+ Motor 1, coil A Motor_2_B- Motor 2, coil B Motor_2_B+ Motor 2, coil B Motor_2_A- Motor 2, coil A Motor_2_A+ Motor 2, coil A www.trinamic.com...
Page 6
Please connect the USB interface with the enclosed cable as follows: Label Description Board is self-powered – just use to detect availability of attached host system (e.g. PC) USB- Differential USB bus USB+ Differential USB bus System / module ground www.trinamic.com...
Page 7
If this does not occur, switch power OFF and check your connections as well as the power supply. 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.
Click on Icon Assemble to convert the TMCL into machine code. Then download the program to the TMCM-351 module via the icon Download. Press icon Run. The desired program will be executed. Click Stop button to stop the program. www.trinamic.com...
JA Loop //Start again WaitUntilRunning: //Subroutine that waits until the motor is running GAP 3, 0 COMP 0 JC EQ, WaitUntilRunning RSUB WaitUntilStanding: //Subroutine that waits until the motor has stooped GAP 3, 0 COMP 0 JC NE, WaitUntilStanding RSUB www.trinamic.com...
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 TMCL commands in the following chapters. www.trinamic.com...
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 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! www.trinamic.com...
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. www.trinamic.com...
These commands control the external I/O ports and can be used in direct mode and in standalone mode. Command Mnemonic Meaning number Set output Get input Access to external SPI device 4.4.2.4 SPI Bus Access Command Mnemonic Command Meaning number SPI bus access www.trinamic.com...
Page 16
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 included file Interrupts.inc for symbolic constants of the interrupt numbers. www.trinamic.com...
Page 17
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 for further information about that. www.trinamic.com...
Page 18
EI TI_GLOBAL Please also take a look at the other example programs. 4.4.2.8 ASCII Commands Mnemonic Command number Meaning Enter ASCII mode Quit ASCII mode and return to binary mode. This command can only be used in ASCII mode. www.trinamic.com...
Page 19
(don’t care) (don’t care) must be 1234 settings EEPROM their factory defaults This command does not send back a reply. 139 – enter ASCII Enter ASCII command line (don’t care) (don’t care) (don’t care) mode www.trinamic.com...
PECIAL COMMANDS WHICH ARE ONLY AVAILABLE IN 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. www.trinamic.com...
<CR> character has been sent. When bit 5 is set and bit 4 is clear there will be no echo, only the reply will be sent. This may be useful in RS485 systems. www.trinamic.com...
VALUE 100 – OK don't care Example: Rotate right motor 2, velocity = 350 Mnemonic: ROR 2, 350 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
VALUE 100 – OK don't care Example: Rotate left motor 0, velocity = 1200 Mnemonic: ROL 0, 1200 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Reply in direct mode: STATUS VALUE 100 – OK don’t care Example: Stop motor 0 Mnemonic: MST 0 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Example: Move motor 0 from current position 1000 steps backward (move relative –1000) Mnemonic: MVP REL, 0, -1000 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Page 26
TMCM-351 TMCL Firmware V4.45 Manual (Rev. 1.06 / 2014-MAY-16) Example: Move motor 0 to previously stored coordinate #8 Mnemonic: MVP COORD, 0, 8 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
0… 255). The value for current setting has to be calculated before using this special SAP command. Mnemonic: SAP 6, 0, 128 Binary: Byte Index Instruction Function Target- Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) Reply: Byte Index Instruction Function Host- Target- Status Operand Operand Operand Operand address address Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
5 will be returned in this case. Example: Store the maximum speed of motor 0 Mnemonic: STAP 4, 0 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
For a table with parameters and values which can be used together with this command please refer to chapter 5. Example: Restore the maximum current of motor 3 Mnemonic: RSAP 6, 0 Binary: Byte Index Function Target- Motor/ Operand Operand Operand Operand Instruction Type address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Example: Set the serial address of the target device to 3 Mnemonic: SGP 66, 0, 3 Binary: Byte Index Function Target- Motor/ Operand Operand Operand Operand Instruction Type address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) Reply: Byte Index Function Host- Target- Status Instruction Operand Operand Operand Operand address address Byte3 Byte2 Byte1 Byte0 Value (hex) Status = no error, value = 1 www.trinamic.com...
Reply in direct mode: STATUS VALUE 100 – OK don’t care Example: Store the user variable #42 Mnemonic: STGP 42, 2 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Reply structure in direct mode: STATUS VALUE 100 – OK don’t care Example: Restore the user variable #42 Mnemonic: RSGP 42, 2 Binary: Byte Index Instruction Function Target- Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Mnemonic: RFS START, 0 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) With this module it is possible to use stall detection instead of a reference search. www.trinamic.com...
Set OUT_7 to high (bank 2, output 7) Mnemonic: SIO 7, 2, 1 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) ONNECTORS Connector 1 Connector 2 Connector 3 Figure 4.1 Connectors of TMCM-351 www.trinamic.com...
Page 37
SIO can be used to switch the pull-up resistors for all digital inputs on and off. Bank 0 is used for this purpose. Every pull-up resistor can be switched individually by setting the related bit using the bitmask. Pin (connector 3) Input Command Range IN_0 IN_1 IN_2 IN_3 SIO 0, 0,<bitmask> 0… 255 IN_4 IN_5 ADIN_0 ADIN_1 www.trinamic.com...
Instruction Type Motor/ Operand Operand Operand Operand address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) Reply: Byte Index Function Host- Target- Status Instructi Operand Operand Operand Operand address address Byte3 Byte2 Byte1 Byte0 Value (hex) value: 506 www.trinamic.com...
Page 39
In this case the status of all digital input lines will be read to the lower eight bits of the accumulator. SE FOLLOWING PROGRAM TO REPRESENT THE STATES OF THE INPUT LINES ON THE OUTPUT LINES Loop: GIO 255, 0 SIO 255, 2,-1 JA Loop www.trinamic.com...
Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) Reply: Byte Index Function Host- Target- Status Instruction Operand Operand Operand Operand address address Byte3 Byte2 Byte1 Byte0 Value (hex) Status = no error, value = -5000 www.trinamic.com...
//jump, type: 5 greater/equal, the label must be defined somewhere else in the program Binary format of the COMP 1000 command: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
//jump, type: 5 greater/equal Label: ROL 0, 1000 Binary format of JC GE, Label when Label is at address 10: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
//Jump to the label Loop Binary format of JA Loop assuming that the label Loop is at address 20: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
//Continue with the command following the CSUB command Binary format of the CSUB SubW command assuming that the label SubW is at address 100: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
//Continue with the command following the CSUB command Binary format of the CSUB SubW command assuming that the label SubW is at address 100: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
10 milliseconds Example: Wait for motor 0 to reach its target position, without timeout Mnemonic: WAIT POS, 0, 0 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Mnemonic: STOP Binary representation: INSTRUCTION NO. TYPE MOT/BANK VALUE don’t care don’t care don’t care Example: Mnemonic: STOP Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
<received data> HE BUS NUMBERS ARE AS FOLLOWS Bus number Chip select output SPI_SEL0, output direct value SPI_SEL1, output direct value SPI_SEL2, output direct value SPI_SEL0, output contents of accumulator SPI_SLE1, output contents of accumulator SPI_SEL2, output contents of accumulator www.trinamic.com...
SCO 0, 255, 0 copies all coordinates (except coordinate number 0) from RAM to the EEPROM. SCO <coordinate number>, 255, 0 copies the coordinate selected by <coordinate number> to the EEPROM. The coordinate number must be a value between 1 and 20. www.trinamic.com...
(except coordinate number 0) from the EEPROM to the RAM. GCO <coordinate number>, 255, 0 copies the coordinate selected by <coordinate number> from the EEPROM to the RAM. The coordinate number must be a value between 1 and 20. www.trinamic.com...
100 – OK don’t care Example: Store current position of the axis 0 to coordinate 3 Mnemonic: CCO 3, 0 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Example: Copy the actual value of the accumulator to coordinate 1 of motor 0 Mnemonic: ACO 1, 0 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
X-register 10 SWAP swap accu with X-register Example: Multiply accu by X-register Mnemonic: CALCX MUL Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
// transfer result to target position of motor 0 JA Start // jump back to start Binary format of the AAP 0,0 command: Byte Index Instruction Function Target- Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
VALUE 100 – OK don’t care Example: Copy accumulator to TMCL user variable #3 Mnemonic: AGP 3, 2 Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
4 – (EPO) position flag 5 – (ESD) shutdown flag Example: Reset the timeout flag Mnemonic: CLE ETO Binary: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Input change 7 Global interrupts Example: Define interrupt vector at target position 500 VECT 3, 500 Binary format of VECT: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Left stop switch 1 Right stop switch 1 Left stop switch 2 Right stop switch 2 Input change 0 Input change 1 Input change 2 Input change 3 Input change 4 Input change 5 Input change 6 Input change 7 Global interrupts www.trinamic.com...
Page 60
Bank Byte3 Byte2 Byte1 Byte0 Value (hex) Enable interrupt when target position reached EI, 3 Binary format of EI: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Left stop switch 1 Right stop switch 1 Left stop switch 2 Right stop switch 2 Input change 0 Input change 1 Input change 2 Input change 3 Input change 4 Input change 5 Input change 6 Input change 7 Global interrupts www.trinamic.com...
Page 62
Bank Byte3 Byte2 Byte1 Byte0 Value (hex) Disable interrupt when target position reached DI, 3 Binary format of DI: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand address Number Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
Example: Terminate interrupt handling and continue with normal program execution RETI Binary format of RETI: Byte Index Function Target- Instruction Type Motor/ Operand Operand Operand Operand Number address Bank Byte3 Byte2 Byte1 Byte0 Value (hex) www.trinamic.com...
4.6.37 Customer Specific TMCL Command Extension (user function) The user definable functions UF0… UF7 are predefined functions without topic for user specific purposes. A user function (UF) command uses three parameters. Please contact TRINAMIC for a customer specific programming. Internal function: Call user specific functions implemented in C by TRINAMIC.
This command can only be used in ASCII mode. It quits the ASCII mode and returns to binary mode. Related Commands: none Mnemonic: BIN Binary representation: This command does not have a binary representation as it can only be used in ASCII mode. www.trinamic.com...
Type set to 1 - version number in binary format: The version number is output in the value field of the reply in the following way: Contents Byte index in value field Type number, low byte Type number, high byte www.trinamic.com...
200… 207 48… 55 128… 135 208… 215 56… 63 136… 143 216… 223 64… 71 144… 151 224… 231 72… 79 152… 159 232… 239 The most important motor setting, since too high values might cause motor damage! www.trinamic.com...
Page 68
(maximum) acceleration, if the parameter target speed is changed. For special purposes, the soft mode (value 1) with exponential decrease of speed can be selected. www.trinamic.com...
Page 69
0… 2048 threshold mixed decay will be used. or -1 Set this parameter to -1 to turn on mixed decay permanently – also in the rising part of the microstep wave. This can be used to fix microstep errors. www.trinamic.com...
Page 70
ROL, ROR, MST, MVP or RFS is issued for one of these motors. Power down Standstill period before the current is changed 1… 65535 delay down to standby current. The standard value [10msec] is 200msec. Unit of acceleration: www.trinamic.com...
TMCL-IDE and serve for loading micro step and driver tables. Normally these parameters remain untouched. If you want to use them for loading your specific values with your PC software please contact TRINAMIC and ask how to do this. Otherwise you might cause damage on the motor driver!
Page 72
For CAN interface this parameter has no effect! Serial host address Host address used in the reply telegrams sent back 0… 255 via RS232 or RS485. Auto start mode 0: Do not start TMCL application after power up (default). 1: Start TMCL application automatically after power www.trinamic.com...
Page 73
To overcome this problem, set the telegram pause time (global parameter #75) of the module to 15 (or more if needed) by issuing an SGP 75, 0, 15 command in direct mode. The parameter will automatically be stored in the configuration EEPROM. www.trinamic.com...
Parameter stored permanently in EEPROM Number Global parameter Description Range Access 0… 55 general purpose variable #0… #55 for use in TMCL applications … +2 56… 255 general purpose variables #56… #255 for use in TMCL applications … +2 www.trinamic.com...
Figure 7.1 Left and right limit switches STOP_L STOP_R motor negative positive left stop right stop direction direction switch switch traveler Figure 7.2 Limit switches and reference switch motor STOP_L HOME / reference eccentric switch Figure 7.3 One reference switch www.trinamic.com...
Trigger null channel at every N signal (default: only at next N signal) Add when rotating CCW, subtract when rotating CW (default: add on CW, subtract on CCW) Example: For a prescaler value of 4 with an active high null channel use a p-value of 2048 + 16 = 2064 www.trinamic.com...
“telegram pause time” (global parameter #75) of the module to 15 (or more if needed) by issuing an “SGP 75, 0, 15” command in direct mode. The parameter will automatically be stored in the configuration EEPROM. For RS232 set the telegram pause time to zero for maximum data throughput www.trinamic.com...
TMCM-351 TMCL Firmware V4.45 Manual (Rev. 1.06 / 2014-MAY-16) 8 Life 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 &...
Need help?
Do you have a question about the TMCL TMCM-351 and is the answer not in the manual?
Questions and answers