Home
TMCM-1140-TMCL Manual
Contents
1. INSTRUCTION NO TYPE MOT BANK VALUE 31 coordinate number 0 don t care 0 20 Reply in direct mode STATUS VALUE 100 OK don t care Example Get motor value of coordinate 1 Mnemonic GCO 1 0 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel ByteO Value hex 01 1f 01 00 00 00 00 00 Reply Byte Index 0 1 2 3 4 5 6 7 Function Target Target Status Instructio Operand Operand Operand Operand address address n Byte3 Byte2 Bytel ByteO Value hex 02 01 64 0a 00 00 00 00 gt Value 0 Note Two special functions of this command have been introduced that make it possible to copy all coordinates or one selected coordinate from the EEPROM to the RAM THESE FUNCTIONS CAN BE ACCESSED USING THE FOLLOWING SPECIAL FORMS OF THE GCO COMMAND GCO 0 255 0 GCO coordinate number 255 0 www trinamic com copies all coordinates except coordinate number 0 from the EEPROM to the RAM copies the coordinate selected by lt coordinate number gt from the EEPROM to the RAM The coordinate number must be a value between 1 and 20 TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 50 3 6 26 CCO capture coordinate The actual position of the axis is copied to the selected coordinate variable Depending on the global parameter 84 the coordinates are
2. www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 58 3 6 34 DI disable interrupt The DI command disables an interrupt It needs the interrupt number as parameter Interrupt number 255 globally disables interrupts Related command EI VECT RETI Mnemonic DI interrupt number Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 26 interrupt number don t care don t care 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 Stall stallGuard2 21 Deviation 21 Stop left 28 Stop right 39 IN 0 change 40 IN 1 change 41 IN 2 change 42 IN 3 change Examples Disable interrupts globally DI 255 Binary format of DI Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel Byte0 Value hex 01 1A SFF 00 00 00 00 00 Disable interrupt when target position reached DI 3 Binary format of DI Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Bytel Byte0 Value hex 01 1A 03 00 00 00 00 00 www trinamic com
3. TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 59 3 6 35 RETI return from interrupt This command terminates the interrupt handling routine and the normal program execution continues At the end of an interrupt handling routine the RETI command must be executed Internal function the saved registers A register X register flags are copied back Normal program execution continues Related commands El DI VECT Mnemonic RETI Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 38 don t care don t care don t care Example Terminate interrupt handling and continue with normal program execution RETI Binary format of RETI Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Bytel Byte0 Value hex 01 26 00 00 00 00 01 00 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 60 3 6 36 Customer Specific TMCL Command Extension UFO UF7 User Function The user definable functions UFO UF7 are predefined functions without topic for user specific purposes Contact TRINAMIC for the customer specific programming of these functions Internal function Call user specific functions implemented in C by TRINAMIC Related commands none Mnemonic UFO UF7 Binary representation
4. Example Reset the timeout flag Mnemonic CLE ETO Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Byte1 Byte0 Value hex 01 24 01 00 00 00 00 00 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 32 VECT set interrupt vector The VECT command defines an interrupt vector It needs an interrupt number and a label as parameter like in JA JC and CSUB commands This label must be the entry point of the interrupt handling routine Related commands El DI RETI Mnemonic VECT interrupt number label Binary representation 56 INSTRUCTION NO TYPE MOT BANK VALUE 37 interrupt number don t care label 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 Stall stallGuard2 21 Deviation 21 Stop left 28 Stop right 39 IN 0 change 40 IN 1 change 41 IN 2 change 42 IN 3 change Example Define interrupt vector at target position 500 VECT 3 500 Binary format of VECT Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Bytel Byte0 Value hex
5. INSTRUCTION NO TYPE MOT BANK VALUE 33 0 ADD add X register to accu 1 SUB subtract X register from accu 1 MUL multiply accu by X register 1 DIV divide accu by X register 1 MOD modulo divide accu by x register 1 AND logical and accu with X register 6 OR logical or accu with X register 7 XOR logical exor accu with X register 8 NOT logical invert X register 9 LOAD load accu to X register 10 SWAP swap accu with X register don t care don t care Example Multiply accu by X register Mnemonic CALCX MUL Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Bytel Byte0 Value hex 01 21 02 00 00 00 00 00 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 29 AAP accumulator to axis parameter The content of the accumulator register is transferred to the specified axis parameter For practical usage the accumulator has to be loaded e g by a preceding GAP instruction The accumulator may have been modified by the CALC or CALCX calculate instruction 53 For a table with parameters and values which can be used together with this command please refer to chapter 4 Related commands AGP SAP GAP SGP GGP CALC CALCX Mnemonic AAP parameter number 0 Binary rep
6. TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 10 2 2 1 Important Motor Settings There are some axis parameters which have to be adjusted right in the beginning after installing your module Please set the upper limiting values for the speed axis parameter 4 the acceleration axis parameter 5 and the current axis parameter 6 Further set the standby current axis parameter 7 and choose your microstep resolution with axis parameter 140 Please use the SAP Set Axis Parameter command for adjusting these values The SAP command is described in paragraph 3 6 5 You can use the TMCL IDE direct mode for easily configuring your module Attention The most important motor setting is the absolute maximum motor current setting since too high values might cause motor damage IMPORTANT AXIS PARAMETERS FOR MOTOR SETTING Number Axis Parameter Description Range Unit 4 Maximum Should not exceed the physically highest possible 0 2047 positioning value Adjust the pulse divisor axis parameter 154 if speed the speed value is very low 50 or above the upper euge gPulse divisor ERES limit 65536 sec 5 Maximum The limit for acceleration and deceleration Changing 0 2047 acceleration this parameter requires re calculation of the acceleration factor no 146 and the acceleration divisor no 137 which is done automatically See TMC 429 datasheet for
7. 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 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 RA85 USB is as follows Bytes Meaning 1 Module address 1 Command number 1 Type number 1 Motor or Bank number 4 1 Value MSB first 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 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 13 3 11 Checksum Calcula
8. Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel Byte0 Value hex 01 06 01 00 00 00 00 00 Reply Byte Index 0 1 2 3 4 5 6 7 Function Host Target Status Instructio Operand Operand Operand Operand address address n Byte3 Byte2 Bytel Byte0 Value hex 02 01 64 06 00 00 02 c7 gt status no error position 711 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 29 3 6 STAP store axis parameter An axis parameter previously set with a Set Axis Parameter command SAP will be stored permanent Most parameters are automatically restored after power up refer to axis parameter list in chapter 4 For a table with parameters and values which can be used together with this command please refer to chapter 4 Internal function An axis parameter value stored in SRAM will be transferred to EEPROM and loaded from EEPORM after next power up Related commands SAP RSAP GAP AAP Mnemonic STAP parameter number 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 7 parameter number o don t care lmotor number is always O as only one motor is involved the value operand of this function has no effect Instead the currently used value e g selected by SAP is saved Reply in direct mo
9. Figure 5 6 Search home switch SAP 193 0 6 in negative direction reverse direction in case left stop switch is hit reference search speed axis parameter 194 reference switch speed axis parameter 195 Search home switch in positive direction reverse direction in case right stop switch is hit L ore stop rightilimit end stop switch home switch reference search speed axis parameter 194 reference switch speed axis parameter 195 Figure 5 7 Search home switch in positive direction reverse direction in case right stop switch is hit SAP 193 0 7 Search home switch in negative direction ignore end switches L home switch ee stop start reference search speed axis parameter 194 reference switch speed axis parameter 195 Figure 5 8 Search home switch in negative direction ignore end switches SAP 193 0 8 Search home switch in positive direction ignore end switches L start stop home switch ue reference search speed axis parameter 194 reference switch speed axis parameter 195 Figure 5 9 Search home switch in positive direction ignore end switches WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 76 4 4 Changing the Prescaler Value of an Encoder The TMCM 1140 module offers an integrated sensOstep encoder
10. Last reference position Reference search the last position before setting the counter to zero can be read out 2 291 usteps 200 Boost current Current used for acceleration and deceleration phases If set to 0 the same current as set by axis parameter 6 will be used 0 255 2 8A Ipeax lt value gt X 255 2A Igus lt value gt x RWE 204 Freewheeling Time after which the power to the motor will be cut when its velocity has reached zero 255 O 65535 0 never msec RWE 206 Actual load value Readout of the actual load value with used for stall detection stallGuard2 O 1023 207 Extended error flags 1 Motor stopped because of stallGuard2 detection 2 Motor stopped because of encoder deviation 3 Motor stopped because of 1 and 2 Will be reset automatically by the next motion command www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 69 Number Axis Parameter Description Range Unit Acc 208 TMC262 driver Bit 0 stallGuard2 status 0 1 R 1 threshold reached enor flags Bit 1 Overtemperature 1 driver is shut down due to overtemperature Bit 2 Pre warning overtemperature 1 Threshold is exceeded Bit 3 Short to ground A 1 Short condition detected driver currently shut down Bit 4 Short to ground B 1 Short condition detected
11. 2015 JAN 05 21 3 5 3 Configuring the ASCII Interface The module can be configured so that it starts up either in binary mode or in ASCIT mode Global parameter 67 is used for this purpose please see also chapter 5 1 Bit O determines the startup mode if this bit is set the module starts up in ASCII mode else it will start up in binary mode default Bit 4 and Bit 5 determine how the characters that are entered are echoed back Normally both bits are set to zero In this case every character that is entered is echoed back when the module is addressed Character can also be erased using the backspace character press the backspace key in a terminal program When bit 4 is set and bit 5 is clear the characters that are entered are not echoed back immediately but the entire line will be echoed back after the 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 TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 22 3 6 Commands The module specific commands are explained in more detail on the following pages They are listed according to their command number 3 6 1 ROR rotate right With this command the motor will be instructed to rotate with a specified velocity in right direction increasing the position counter Internal function First velocity mode is selected Then the velocity valu
12. 01 25 03 00 00 00 01 F4 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 33 EI enable interrupt The EI command enables an interrupt It needs the interrupt number as parameter Interrupt number 255 globally enables interrupts Related command DI VECT RETI Mnemonic EI interrupt number Binary representation 57 INSTRUCTION NO TYPE MOT BANK VALUE 25 interrupt number don t care don t care 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 Stall stallGuard2 21 Deviation 21 Stop left 28 Stop right 39 IN 0 change 40 IN 1 change 41 IN 2 change 42 IN 3 change Examples Enable interrupts globally EI 255 Binary format of EI Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel ByteO Value hex 01 19 SFF 00 00 00 00 00 Enable interrupt when target position reached El 3 Binary format of EI Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel ByteO Value hex 01 19 03 00 00 00 00 00
13. 1 04 2015 JAN 05 66 Number Axis Parameter Description Range Unit Acc 167 Chopper off time The off time setting controls the minimum O 2 15 RW chopper frequency An off time within the range of 5us to 20ys will fit Off time setting for constant to chopper Nae 12 32 torr Minimum is 64 clocks Setting this parameter to zero completely disables all driver transistors and the motor can free wheel 168 smartEnergy Sets the lower motor current limit for 0 1 RW current minimum coolStep operation by scaling the CS SEIMIN Current Scale see axis parameter 6 value Minimum motor current 0 Ye of CS 1 Ya of CS 169 smartEnergy Sets the number of stallGuard2 readings 0 3 RW current down above the upper threshold necessary for each step current decrement of the motor current Number of stallGuard2 measurements per decrement Scaling 0 3 32 8 2 1 0 slow decrement 3 fast decrement 170 smartEnergy Sets the distance between the lower and the 0 15 RW hysteresis upper threshold for stallGuard2 reading Above the upper threshold the motor current becomes decreased Hysteresis smartEnergy hysteresis value 1 32 Upper stallGuard threshold smartEnergy hysteresis start smartEnergy hysteresis 1 32 171 smartEnergy Sets the current increment step The current 1 3 RW current up step becomes incremented for each measured stallGuard2 value below the lower th
14. 1 1 3 LIMSW limit switch 0 no of ticks for timeout 0 for no timeout 4 RFS reference search Ov no of ticks for timeout gt completed 0 for no timeout one tick is 10 milliseconds in standard firmware motor number is always O as only one motor is involved Example Wait for motor to reach its target position without timeout Mnemonic WAIT POS 0 0 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Bytel Byte0 Value hex 01 1b 01 00 00 00 00 00 WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 47 3 6 23 STOP stop TMCL program execution This function stops executing a TMCL program The host address and the reply are only used to transfer the instruction to the TMCL program memory This command should be placed at the end of every standalone TMCL program It is not to be used in direct mode Internal function TMCL instruction fetching is stopped Related commands none Mnemonic STOP Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 28 don t care don t care don t care Example Mnemonic STOP Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byt
15. 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 4 1 Features The TMCM 1140 is a single axis controller driver module 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 module can be mounted on the back of NEMA 17 42mm flange size stepper motors and has been designed for coil currents up to 2 A RMS and 24 V DC supply voltage With its high energy efficiency from TRINAMIC s coolStep technology cost for power consumption is kept down The TMCL firmware allows for both standalone operation and direct mode MAIN CHARACTERISTICS Motion controller Motion profile calculation in real time On the fly alteration of motor parameters e g position velocity acceleration High performance microcontroller for overall system control and serial communication protocol handling Bipolar stepper motor driver 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 Encoder sensOstep magnetic encoder 1024 increments per rotation e g for step loss detection under all operating conditions and positioning supervision Interfaces RS485 2 wire communication interface CAN 2 0B communication interface USB full speed 12M
16. 176 Slope control low side Determines the slope of the motor driver outputs Set identical to slope control high side RW 177 short protection disable 0 Short to GND protection is on 1 Short to GND protection is disabled Use default value 0 1 RW 178 Short detection timer 0 3 2us 1 1 6us 2 1 2us 3 0 8us Use default value 0 3 RW 179 Vsense sense resistor voltage based current scaling 0 Full scale sense resistor voltage is 1 18 VDD 1 Full scale sense resistor voltage is 1 36 VDD refers to a current setting of 31 and DAC value 255 Use default value Do not change 0 1 RW 180 smartEnergy actual current This status value provides the actual motor current setting as controlled by coolStep The value goes up to the CS value and down to the portion of CS as specified by SEIMIN Actual motor current scaling factor O 31 1 32 2 32 32 32 RW 181 Stop on stall Below this speed motor will not be stopped Above this speed motor will stop in case stallGuard2 load value reaches zero 0 2047 RW 182 smartEnergy threshold speed Above this speed coolStep becomes enabled 0 2047 16MHz 2pulse divisor usteps 65536 sec RW 183 smartEnergy slow run current Sets the motor current which is used below the threshold speed 0 255 2 8A Ipeak lt value gt X 255 I lt value gt
17. 56 255 general purpose variables 56 for use in TMCL applications 27 234 RW 255 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 82 5 4 Bank 3 Bank 3 contains interrupt parameters Some interrupts need configuration e g the timer interval of a timer interrupt This can be done using the SGP commands with parameter bank 3 SGP type 3 lt value gt The parameter number defines the priority of an interrupt Interrupts with a lower number have a higher priority MEANING OF THE LETTERS IN COLUMN ACCESS Access Related Description type command s R GGP Parameter readable W SGP AGP Parameter writable INTERRUPT PARAMETERS BANK 3 Number Global parameter Description Range Access 0 Timer 0 period ms Time between two interrupts ms O RW 4 294 967 295 ms 1 Timer 1 period ms Time between two interrupts ms O RW 4 294 967 295 ms 2 Timer 2 period ms Time between two interrupts ms O RW 4 294 967 295 ms 27 Stop left 0 trigger transition O off 1 low high 2 high low 0 3 RW 3 both 28 Stop right O trigger transition O off 1 low high 2 high low 0 3 RW 3 both 39 Input O trigger transition O off 1 low high 2 high low 0 3 RW 3 both 40 Input 1 trigger transition O off 1 low high 2 high low 0 3 RW 3 both 41 Input 2 trigger transition O off 1 low high 2 high low 0 3
18. RW 3 both 42 Input 3 trigger transition O off 1 low high 2 high low 0 3 RW 3 both www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 83 6 TMCL Programming Techniques and Structure 6 1 Initialization The first task in a TMCL program like in other programs also is to initialize all parameters where different values than the default values are necessary For this purpose SAP and SGP commands are used 6 2 Main Loop Embedded systems normally use a main loop that runs infinitely This is also the case in a TMCL application that is running stand alone Normally the auto start mode of the module should be turned on After power up the module then starts the TMCL program which first does all necessary initializations and then enters the main loop which does all necessary tasks end never ends only when the module is powered off or reset There are exceptions to this e g when TMCL routines are called from a host in direct mode So most but not all stand alone TMCL programs look like this Initialization SAP 4 0 500 define max positioning speed SAP 5 0 100 define max acceleration MainLoop do something in this example just running between two positions MVP ABS 0 5000 WAIT POS 0 O0 MVP ABS 0 O0 WAIT POS 0 O0 JA MainLoop end of the main loop gt run infinitely 6 3 Using Symbolic Constants To make your program better readable and und
19. TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 19 In the example above the interrupt numbers are used directly To make the program better readable 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 program above then looks like the following Hinclude Interrupts inc VECT TI TIMERo Timerolrq SGP TI TIMERo 3 1000 EI TI TIMERo EI TI GLOBAL Please also take a look at the other example programs www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 20 3 5 The ASCII Interface There is also an ASCII interface that can be used to communicate with the module and to send some commands as text strings THE FOLLOWING COMMANDS CAN BE USED IN ASCIT MODE ROL ROR MST MVP SAP GAP STAP RSAP SGP GGP STGP RSGP RFS SIO GIO SCO GCO CCO UFO UF1 UF2 UF3 UF4 UF5 UF6 and UF7 Note Only direct mode commands can be entered in ASCII mode SPECIAL COMMANDS WHICH ARE ONLY AVAILABLE IN ASCII MODE BIN This command quits ASCII mode and returns to binary TMCLTM mode RUN This command can be used to start a TMCL program in memory STOP Stops a running TMCL application ENTERING AND LEAVING ASCIT MODE 1 The ASCII command line interface is entered by sending the binary command 139 enter ASCII mode 2 Afterwards the commands are entere
20. and the reply are only used to take the instruction to the TMCL program memory while the program loads down This command cannot be used in direct mode Internal function The TMCL program counter is set to the last value of the stack The command will be ignored if the stack is empty Related command CSUB Mnemonic RSUB Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 24 don t care don t care don t care Example please see the CSUB example section 3 6 20 Binary format of RSUB Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Bytel Byte0 Value hex 01 18 00 00 00 00 00 00 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 22 WAIT wait for an event to occur This instruction interrupts the execution of the TMCL program until the specified condition is met This command is intended for standalone operation only 46 The host address and the reply are only used to take the instruction to the TMCL program memory while the program loads down This command cannot be used in direct mode THERE ARE FIVE DIFFERENT WAIT CONDITIONS THAT CAN BE USED TICKS Wait until the number of timer ticks specified by the ticks parameter has been reached POS Wait until the targ
21. 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 target command execution is don t care don t care don t care mode resumed 134 read TMCL the specified program memory don t care don t care memory memory location is read address 135 get application one of these values is don t care don t care don t care status returned 0 stop 1 run 1 step 3 reset 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 WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 SPECIAL REPLY FORMAT OF COMM
22. driver currently shut down Bit 5 Open load A 1 no chopper event has happened during the last period with constant coil polarity Bit 6 Open load B 1 no chopper event has happened during the last period with constant coil polarity Bit 7 Stand still 1 No step impulse occurred on the step input during the last 2 20 clock cycles 209 Encoder position The value of an encoder register can be read encoder steps RW sensOstep out or written 210 Encoder Prescaler for the sensOstep encoder See paragraph Error RWE prescaler Reference source sensOstep not found 212 Maximum When the actual position parameter 1 and 0 65535 RWE encoder the encoder position parameter 209 differ deviation more than set here the motor will be encoder steps sensOstep stopped This function is switched off when the maximum deviation is set to zero 214 Power down Standstill period before the current is changed 1 65535 RWE delay down to standby current The standard value 10msec is 200 value equates 2000msec 215 Absolute Absolute position of the internal sensOstep 0 1023 R resolver value encoder The absolute position is within one sensOstep motor rotation 216 Encoder position The value of the external encoder register can encoder steps RW external encoder be read out or written This parameter is only used if an external encoder is connected 217 Encoder Prescaler for external encoder See paragraph Error prescale
23. gt for the external one Automatic motor stop on deviation error is also available e g for immediate step loss detection during motor movement This can be set using axis parameter 212 maximum deviation resp 218 for the external encoder This function is turned off when the maximum deviation is set to 0 Using the prescaler the encoder counter increments decrements can be aligned to the position microstep counter This is essential when using the deviation error supervision parameter 212 resp 218 and simplifies encoder counter vs position microstep counter comparisons 1 1 number of microsteps per motor rotation prescaler x encoder ticks per rotation number of microsteps per motor rotation with default setting of 256 micrsteps per fullstep and a stepper motor with 200 fullsteps per rotation this is 256 x 200 51200 microsteps per motor rotation encoder ticks per rotation 1024 with the integrated sensOstep encoder With incremental a b n encoders this is 4 x number of encoder lines The default settings result in a prescaler value of 51200 1024 50 default see table below The integer value p used with axis parameter 210 internal encoder resp 217 external encoder can be calculated from the prescaler value using the following formula p prescaler x 512 Example prescaler 50 50 x 512 25600 p The table below shows a subset of those prescalers that can be selec
24. 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 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 3 4 2 3 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 standalone mode only 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 3 4 2 4 I O Port Commands These commands control the external I O ports and can be used in direct mode and in standalone mode Mnemonic Command number Meaning SIO 14 Set output GIO 15 Get input www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 17 3 42 5 Calculation Commands These commands are intended to be used for calculations within TMCL applications Although
25. 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 WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 87 8 Revision History 8 1 Firmware Revision Version Date Description 1 18 2012 MAY 06 Release 1 19 2012 JUL 25 Global parameter 79 added 1 20 2012 OKT 04 Global parameter 87 secondary address for RS232 RS485 added Reference search the last position before setting the counter to zero can be read out with axis parameter 197 1 21 2012 NOV 16 Parameter VSENSE set to 1 1 22 2013 JAN 21 Maximum read number of encoder increased Additional functions of axis parameter 193 reference search mode Add 128 to a value for inverting the home switch interesting for mode 5 8 Add 64 to a value for driving the right instead of the left reference switch interesting for mode 1 4 1 23 2013 FEB 05 Reference search modes corrected Mode 7 and mode 8 end switches are always deactivated 1 24 2013 FEB 20 No changes related to the TMCM 1140 1 25 2013 AUG 30 No changes related to the TMCM 1140 1 26 2013 AUG 30 No changes related to the TMCM 1140 1 27 2013 AUG 30 Problem with magnetic encoder fixed 8 2 Document Revision V
26. one selected coordinate to the EEPROM THESE FUNCTIONS CAN BE ACCESSED USING THE FOLLOWING SPECIAL FORMS OF THE SCO COMMAND SCO 0 255 0 SCO coordinate number 255 0 copies all coordinates except coordinate number 0 from RAM to the EEPROM copies the coordinate selected by coordinate number to the EEPROM The coordinate number must be a value between 1 and 20 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 49 3 6 25 GCO get coordinate This command makes possible to read out a previously stored coordinate In standalone mode the requested value is copied to the accumulator register for further processing purposes such as conditioned jumps In direct mode the value is only output in the value field of the reply without affecting the accumulator Depending on the global parameter 84 the coordinates are only stored in RAM or also stored in the EEPROM and copied back on startup with the default setting the coordinates are stored in RAM only Please note that the coordinate number 0 is always stored in RAM only Internal function the desired value is read out of the internal coordinate array copied to the accumulator register and in direct mode returned in the value field of the reply Related commands SCO CCO MVP Mnemonic GCO coordinate number 0 Binary representation
27. only stored in RAM or also stored in the EEPROM and copied back on startup with the default setting the coordinates are stored in RAM only Please see the SCO and GCO commands on how to copy coordinates between RAM and EEPROM Note that the coordinate number 0 is always stored in RAM only Internal function the selected 24 bit position values are written to the 20 by 3 bytes wide coordinate array Related commands SCO GCO MVP Mnemonic CCO coordinate number 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 32 coordinate number 0 don t care 0 20 Reply in direct mode STATUS VALUE 100 OK don t care Example Store current position of the axis 0 to coordinate 3 Mnemonic CCO 3 0 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Byte1 Byte0 Value hex 01 20 03 00 00 00 00 00 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 51 3 6 27 ACO accu to coordinate With the ACO command the actual value of the accumulator is copied to a selected coordinate of the motor Depending on the global parameter 84 the coordinates are only stored in RAM or also stored in the EEPROM and copied back on startup with the default setting the coordinates are stored in RAM only Plea
28. set 130 Minimum speed Should always be set 1 to ensure exact 0 2047 RWE reaching of the target position Default 1 16MHz gpulse aivisor usteps 65536 sec 135 Actual The current acceleration read only O 2047 R acceleration 138 Ramp mode Automatically set when using ROR ROL MST 0 1 2 RWE and MVP 0 position mode Steps are generated when the parameters actual position and target position differ Trapezoidal speed ramps are provided 2 velocity mode The motor will run continuously and the speed will be changed with constant 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 TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 65 Number Axis Parameter Description Range Unit Acc 140 Microstep O full step 0 8 RWE resolution 1 half step 2 4 microsteps 3 8 microsteps 4 16 microsteps b 32 microsteps 6 64 microsteps 7 128 microsteps 8 256 microsteps 149 Soft stop flag If cleared the motor will stop immediately 0 1 RWE disregarding motor limits when the reference or limit switch is hit 153 Ramp divisor The exponent of the scaling factor for the 0 13 RWE ramp generator should be de incremented carefully in steps of one 154 Pulse divisor The exponent of the scaling factor for the 0 13 RWE pulse st
29. they could also be used in direct mode it does not make much sense to do so Mnemonic Command number Meaning CALC 19 Calculate using the accumulator and a constant value CALCX 33 Calculate using the accumulator and the X register AAP 34 Copy accumulator to an axis parameter AGP 35 Copy accumulator to a global parameter ACO 39 Copy accu to coordinate For calculating purposes there is an accumulator or accu or A register and an X register When executed in a 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 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 3 4 2 6 Interrupt Commands Due to some customer requests interrupt processing has been introduced in the TMCL firmware for ARM based modules Mnemonic Command number Meaning EI 25 Enable interrupt DI 26 Disable interrupt VECT 37 Set interrupt vector RETI 38 Return from interrupt 3 4 2 6 1 Interrupt Types There are many different int
30. x 2A rms lt value 255 RW www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 68 Number 193 Axis Parameter Ref search mode Description 1 search left stop switch only 2 search right stop switch then search left stop switch 3 search right stop switch then search left stop switch from both sides search left stop switch from both sides 5 search home switch in negative direction reverse the direction when left stop switch reached 6 search home switch in positive direction reverse the direction when right stop switch reached 7 search home switch in direction ignore end switches negative 8 search home switch in direction ignore end switches positive Additional functions Add 128 to a mode value for inverting the home switch can be used with mode 5 8 Add 64 to a mode for driving the right instead of the left reference switch can be used with mode 1 4 Range Unit 1 8 Acc RWE 194 Referencing search speed For the reference search this value directly specifies the search speed 0 2047 RWE 195 Referencing switch speed Similar to parameter no 194 the speed for the switching point calibration can be selected O 2047 RWE 196 Distance end switches This parameter provides the distance between the end switches after executing the RFS command mode 2 or 3 O 2 147 483 647 197
31. 0 WAIT POS 0 O JA Loop www trinamic com Rotate motor O with speed 10000 Rotate motor O with 50000 Set max Velocity Set max Acceleration Move to Position 10000 Wait until position reached Move to Position 10000 Wait until position reached Infinite Loop Assemble gt By Eb e Ek stop Download Run Click the Assemble icon to convert the TMCL program into binary code Then download the program to the TMCM 1140 module by clicking the Download icon Click the Run icon The desired program will be executed Click the Stop button to stop the program TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 12 3 TMCL and the TMCL IDE Introduction As with most TRINAMIC modules the software running on the microprocessor of the TMCM 1140 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 TMCM 1140 supports TMCL direct mode binary commands and standalone TMCL program execution You can store up to 2048 TMCL instructions on it In direct mode and most cases the TMCL communication over RS485 CAN or USB follows a strict master slave relationship That is a host computer e g PC PLC acting as the interface b
32. 6 20 ESUB Xcall s bro tine asia adidas 44 3 6 21 RSUB return from subroutine essere tette te tnter tnnt tnt tette tentes tettnsans 45 3 6 22 WAIT wait for an event to OCCUT ccessssssssssssssssssssesssssssssssesesessssnssessssnesessesnesessesneseeasensseesteneseseseneseees 46 3 6 23 STOP stop TMCL program execution sss tette tette tentent tete sar tete tettntens 47 36 24 SCO set CON NA A a AS 48 36 25 GCO get CO add 49 3 6 26 CCO capture coordinate eecsessssessesessessesssessessssessesscsessesnssesatsnesuenssussusnesessuesesessesaesesatenesessteneseeateneseees 50 3 6 27 ACO accu to coordinate eeeceesecsessessssessessssessesucsessesussessesncsessesnesusnesesesnesessesnesesstenesusatenesesaeeneseeateneseees 51 3 6 28 CALCX calculate using the X register cnc 52 3 6 29 AAP accumulator to axis parameter tette tenete ttn tn entente 53 3 6 30 AGP accumulator to global parameter tette ercer 54 3 6 31 CLE clear error flags tee eee Ee ette eet Doe ila EA eke Liao 55 3 6 32 VECT set interrupt VECtON cscsessessesssssssessssessessssessesssesssssssesstsnssessesessessesessessesessusneseestenesesaeenesesaneneseees 56 3 6 33 EL enable anterr pt ue c irre tenen eer a TE UG 57 3 6 34 DI disable interrupt ssori a A A OR OE L OE aAA ORRERA 58 3 6 35 RETI return from interrupt ceccsscsscsesscssssessssessesssssssessssessesessesncsessssneseeseenesesssencsesaseneseeseeneseesee
33. AMIC com WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 2 2 Using TMCL Direct Mode 1 Start TMCL Direct Mode E Direct Mode 2 Ifthe communication is established the TMCM 1140 is automatically detected If the module is not detected please check all points above cables interface power supply COM port baud rate G A TMCL Direct Mode TMCM 1140 TMCL Instruction Selector Instruction Motor Bank Value 1 ROR rotate right v 0 don t care 0 Motor 0 x 0 Manual Instruction Input Address Instruction Type Motor Bank Value Datagram Execute Answer Host Target Status Inst Value Datagram Ca Execute Copy Copy to editor 1 UU amp amp Sf 0 amp 0100000000 00 00 00 01 3 Issue a command by choosing Instruction Type if necessary Motor and Value and click Execute to send it to the module Examples ROR rotate right motor 0 value 500 gt Click Execute The motor is rotating now MST motor stop motor 0 gt Click Execute The motor stops now Top right of the TMCL Direct Mode window is the button Copy to editor Click here to copy the chosen command and create your own TMCL program The command will be shown immediately on the editor Note Chapter 4 of this manual axis parameters includes a diagram which points out the coolStep related axis parameters and their functions WWW trinamic com
34. AND 136 Type set to 0 reply as a string Byte index Contents 1 Host Address 2m Version string 8 characters e g 1140V1 17 There is no checksum in this reply format To get also the last byte when using the CAN bus interface just send this command in an eight byte frame instead of a seven byte frame Then eight bytes will be sent back so you will get all characters of the version string Type set to 1 version number in binary format Please use the normal reply format The version number is output in the value field of the reply in the following way Byte index in value field Contents 1 Version number low byte 2 Version number high byte 3 Type number low byte 4 Type number high byte www trinamic com 62 TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 63 4 Axis Parameters The following sections describe all axis parameters that can be used with the SAP GAP AAP STAP and RSAP commands MEANING OF THE LETTERS IN COLUMN ACCESS Access Related Description type command s R GAP Parameter readable W SAP AAP Parameter writable E STAP RSAP Parameter automatically restored from EEPROM after reset or power on These parameters can be stored permanently in EEPROM using STAP command and also explicitly restored copied back from EEPROM into RAM using RSAP Basic parameters
35. GGP SAP GAP Mnemonic AGP parameter number bank number Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 35 parameter number bank number don t care Reply in direct mode STATUS VALUE 100 OK don t care For a table with parameters and bank numbers which can be used together with this command please refer to chapter 5 Example Copy accumulator to TMCL user variable 3 Mnemonic AGP 3 2 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel Byte0 Value hex 01 23 03 02 00 00 00 00 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 31 CLE clear error flags 55 This command clears the internal error flags It is intended for use in standalone mode only and must not be used in direct mode The following error flags can be cleared by this command determined by the flag parameter A ALL clear all error flags ETO clear the timeout flag EDV clear the deviation flag Related commands JC Mnemonic CLE flags where lt flags gt ALL ETO EDV EPO Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 36 0 ALL all flags don t care don t care 1 ETO timeout flag 3 EDV deviation flag
36. INSTRUCTION NO TYPE MOT BANK VALUE 64 71 user defined user defined user defined Reply in direct mode Byte Index 0 1 2 3 4 5 6 7 Function Target Target Status Instructio Operand Operand Operand Operand address address n Byte3 Byte2 Bytel ByteO Value hex 02 01 user 64 71 user user user user defined defined defined defined defined 3 6 37 Request Target Position Reached Event This command is the only exception to the TMCL protocol as it sends two replies One immediately after the command has been executed like all other commands also and one additional reply that will be sent when the motor has reached its target position This instruction can only be used in direct mode in standalone mode it is covered by the WAIT command and hence does not have a mnemonic Internal function Send an additional reply when the motor has reached its target position Mnemonic Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 138 0 1 don t care 1 Reply in direct mode right after execution of this command Byte Index 0 1 2 3 4 5 6 7 Function Target Target Status Instructio Operand Operand Operand Operand address address n Byte3 Byte2 Bytel ByteO Value hex 02 01 100 138 00 00 00 Motor bit mask Additional reply in direct mode after motors h
37. MODULE FOR STEPPER MOTORS MODULE Firmware Version V1 27 TMCL FIRMWARE MANUAL TMCM 1140 1 Axis Stepper Controller Driver 2A 24V sensOstep Encoder USB RS485 and CAN UNIQUE FEATURES d e NI coolStep stallGuard2 A TRINAMIC Motion Control GmbH amp Co KG Hamburg Germany www trinamic com MOTION CONTROL TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 Table of Contents 1 e 3 Feat leS 5 uu RIED ee ibn HE ud tete bl 4 Putting the Module Into Operation eee adapt 6 2 1 Basic UA idas 6 2 11 Start the TMCL IDE Software Development Environment essent 8 2 2 Using IMCE Direct Mode nere ote ERE aii 9 2 2 1 Important Motor Settings rn 10 2 3 Testing with a Simple TMCL Program sse tentent tete tnnt tte tete teret eterna 11 TMCL and the TMCL TDE Introduction aie is cie nieteed ene tte Rott doce na tnr ta ena deter 12 3 1 Binary Command AAA 12 3 11 Checksum GalculatiOn seite a 13 3 2 Reply OMA ia 13 321 StatussCodes siena odia eei sica 14 3 3 Standalone Applications niece A cav ee Cres eoe obe eat 14 3 4 TMC Command Overview oed ee Rebate ea annie bane bte enh teas 15 3441 TMG Commands iic A e ER RU de dete eed tients 15 3 4 2 Commands Listed According to Subject Area sese tnt 16 3 5 THe ASCU Interface eia Rea niae naci ieu an aci n 20 3 5 1 Format of the Command Line iei diia 20 3 5 2 Format o
38. TEP RELATED AXIS PARAMETERS smartEnergy is an earlier name for coolStep Number Axis parameter Description The maximum value is 255 This value means 100 of the maximum current of the module The current adjustment is pg Absolute max current CS7 3g divided by eight eg step O O 7 step 15 8 25 and so Current Scale o The most important motor setting since too high values might cause motor damage 17 Standby current The current limit two seconds after the motor has stopped Sets the lower motor current limit for coolStep operation by T scaling the CS Current Scale see axis parameter 6 value I168 SEIMIN gy Minimum motor current 0 Ya of CS 1 Ya of CS Sets the number of stallGuard2 readings above the upper threshold necessary for each current decrement of the motor I169 smartEnergy current down current Number of stallGuard2 measurements per decrement step Scaling 0 3 32 8 2 1 0 slow decrement 3 fast decrement Sets the current increment step The current becomes incremented for each measured stallGuard2 value below the lower threshold see smartEnergy hysteresis start 1171 smartEnergy current up step Current increment step size Scaling 0 3 1 2 4 8 0 slow increment 3 fast increment fast reaction to rising load Sets the motor current which is used below the threshold 1183 smartEnergy slow run current speed Please adjust the threshold speed
39. The built in encoder has 1024 steps rotation In addition an external incremental a b n encoder might be connected to the Multipurpose I O connector This encoder can be used as an alternative to the internal one or in addition e g to supervise motion at a different location than the motor axis e g at the other side of a belt gearbox etc Note The following examples about selecting a prescaler value will be valid for the internal sensOstep encoder and for external encoders if their resolution is 1024 steps rotation and a stepper motor with 200 fullsteps per rotation is used only For different encoder resolutions different number of fullsteps per rotation new values have to be calculated FOR THE OPERATION WITH ENCODER PLEASE CONSIDER THE FOLLOWING HINTS The encoder counter can be read out in software and can be used to control the exact position of the motor This also makes basic closed loop operation possible To read out or to change the position value of the internal encoder axis parameter 209 is used axis parameter 216 for the external encoder So to read out the position of your encoder O use GAP 209 O resp GAP 216 0 The position values can also be changed using command SAP 209 0 new position To change the encoder settings axis parameter 210 is used axis parameter 217 for external encoder For changing the prescaler of the internal encoder use SAP 210 0 lt p gt resp SAP 217 0 lt p
40. UTPUT LINES WITH ONE SIO COMMAND Set the type parameter to 255 and the bank parameter to 2 The value parameter must then be set to a value between 0 255 where every bit represents one output line Furthermore the value can also be set to 1 In this special case the contents of the lower 8 bits of the accumulator are copied to the output pins Example Set all output pins high Mnemonic SIO 255 2 3 THE FOLLOWING PROGRAM WILL SHOW THE STATES OF THE INPUT LINES ON THE OUTPUT LINES Loop GIO 255 O SIO 255 2 T JA Loop SPECIAL COMMAND FOR SWITCHING THE PULL UP RESISTORS ON OR OFF FOR ALL THREE DIGITAL INPUTS AT ONCE Pin I O port Command Range 6 IN 1 SIO 0 0 lt n gt 1 0 7 IN 2 0 OFF 8 IN 3 1 ON www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 38 3 6 15 GIO get input output With this command the status of all general purpose inputs of the module can be read out The function reads a digital or analog input port Digital lines will read 0 and 1 while the ADC channels deliver their 12 bit result in the range of 0 4095 GIO IN STANDALONE MODE In standalone mode the requested value is copied to the accumulator accu for further processing purposes such as conditioned jumps GIO IN DIRECT MODE In direct mode the value is only output in the value field of the reply without affecting the accumulator The actual status of a digital output lin
41. ary representation INSTRUCTION NO TYPE MOT BANK VALUE 8 parameter number 0 don t care motor number is always O as only one motor is involved Reply structure in direct mode STATUS VALUE 100 OK don t care Example Restore the maximum current of motor Mnemonic RSAP 6 0 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel Byte0 Value hex 01 08 06 00 00 00 00 00 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 9 SGP set global parameter With this command most of the module specific parameters not directly related to motion control can be specified and the TMCL user variables can be changed Global parameters are related to the host interface peripherals or application specific variables The different groups of these parameters are organized in banks to allow a larger total number for future products Currently only bank O and 1 are used for global parameters and bank 2 is used for user variables Bank 3 is used for interrupt configuration All module settings will automatically be stored non volatile internal EEPROM of the processor The TMCL user variables will not be stored in the EEPROM automatically but this can be done by using STGP commands For a tab
42. ave reached their target positions Byte Index 0 1 2 3 4 5 6 7 Function Target Target Status Instructio Operand Operand Operand Operand address address n Byte3 Byte2 Bytel ByteO Value hex 02 01 128 138 00 00 00 Motor bit mask WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 38 TMCL Control Functions 61 The following functions are for host control purposes only and are not allowed for standalone mode In most cases there is no need for the customer to use one of those functions except command 139 TMCL control commands have no mnemonics as they cannot be used in TMCL programs These Functions are to be used only by the TMCL IDE e g to download a TMCL application into the module CONTROL COMMANDS THAT COULD BE USEFUL FOR A USER HOST APPLICATION ARE get firmware revision command 136 please note the special reply format of this command described at the end of this section run application command 129 All other functions can be achieved by using the appropriate functions of the TMCL IDE 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
43. bit s device interface 4 multipurpose inputs 3x general purpose digital inputs Alternate functions STOP L STOP R HOME switch inputs or A B N encoder input 1x dedicated analog input 2 general purpose outputs 1x open drain 1A max 1x 5V supply output can be switched on off in software Software TMCL standalone operation or remote controlled operation program memory non volatile for up to 2048 TMCL commands and PC based application development software TMCL IDE available for free Electrical and mechanical data Supply voltage 24 V DC nominal 9 28 V DO Motor current up to 2 A RMS 2 8 A peak programmable Refer to separate Hardware Manual too www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 5 TRINAMICSs UNIQUE FEATURES EASY TO USE WITH TMCL stallGuard2 stallGuard2 is a high precision sensorless load measurement using the back EMF on 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 goes to zero or near to zero This is the most energy efficient point of operation for the motor Load stallGuard2 Nm Initial stallGuard2 SG value 100 Max load stallGuard2 SG value O Maximum load reached Motor close to stall Motor stalls Figure 1 1 stallG
44. calculation of physical units 6 Absolute max The maximum value is 255 This value means 100 of 0 255 current the maximum current of the module The current Ipeak lt value re CS Current adjustment is within the range 0 255 and can be Scale adjusted in 32 steps A re O 7 79 87 160 167 240 247 8 15 88 95 168 175 248 255 16 23 96 103 176 183 24 31 104 111 184 191 32 39 112 119 192 199 40 47 120 127 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 7 Standby current The current limit two seconds after the motor has 0 255 stopped Ipeax lt value gt x one 2A Irms lt value gt X 255 140 Microstep O full step 0 8 resolution 1 half step 2 4 microsteps 3 8 microsteps 4 16 microsteps 5 32 microsteps 6 64 microsteps 7 128 microsteps 8 256 microsteps Unit of acceleration WWW trinamic com 536870912 2Puls_divisor ramp_divisor 16MHz microsteps sec TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 11 2 3 Testing with a Simple TMCL Program Type in the following program Loop PwnN Pp ROL 0 500 WAIT TICKS 0 500 MST o ROR 0 500 WAIT TICKS 0 500 MST o SAP 4 0 500 SAP 5 0 50 MVP ABS 0 10000 WAIT POS 0 O MVP ABS 0 1000
45. corresponding to the end limit switches axis parameters 12 and 13 has no influence on the reference search Initial search speed until the reference switch is found for the first time the reference search speed specified by axis parameter 194 is used see figures below for more details Search speed after reference switch has been triggered As soon as the reference switch has been detected the motor will switch to the reference switch speed axis parameter 195 see figures below for more details Search one of the end stop limit switches from one side when hitting the reference switch during movement the motor stops and slowly moves backwards until the switch is released again Motor stops again reverses direction and slowly moves forward until the reference switch is triggered again The reference point will be set to the center between release and trigger point of the reference switch on one side With this mode the reference switch is not overrun instead the middle between the two transitions of the switch on one side open close and close gt open is used as reference Search one of the end stop limit switches or the home switch from both sides when hitting the reference switch during movement the motor will continue moving until the switch is released again Motor stops then reverses direction and slowly moves forward until the switch is triggered again The motor continues movement at low speed until the switch is
46. d also explicitly restored copied back from EEPROM into RAM using RSGP GLOBAL PARAMETERS BANK O Number Parameter Description Range Access 64 EEPROM magic Setting this parameter to a different value as 0 255 RWE SE4 will cause re initialization of the axis and global parameters to factory defaults after the next power up This is useful in case of miss configuration 65 RS485 baud rate 9600 baud Default 0 11 RWE 14400 baud 19200 baud 28800 baud 38400 baud 57600 baud 76800 baud Not supported by Windows 115200 baud 230400 baud 250000 baud Not supported by Windows 500000 baud Not supported by Windows 1000000 baud Not supported by Windows R R2 10 0 JoupunIm bo Rio for hardware version V1 3 only Not supported with hardware version V1 2 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 79 Number 66 Parameter Serial address Description The module target address default 1 Please note address 0 has a special meaning This address is accepted by all modules regardless of their particular address setting Sending a command with this address might be useful in case a module has been set to an unknown address Range 0 255 Access RWE 67 ASCII mode Configure the TMCL ASCIT interface Bit 0 0 start up in binary normal mode 1 start up in ASCII mode Bits 4 and 5 00 ech
47. d as in the TMCL IDE 3 For leaving the ASCII mode and re enter the binary mode enter the command BIN 3 5 1 Format of the Command Line As the first character the address character has to be sent The address character is A when the module address is 1 B for 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 EXAMPLES FOR VALID COMMAND LINES AMVP ABS 1 50000 A MVP ABS 1 50000 AROL 2 500 A MST 1 ABIN The command lines above address the module with address 1 To address e g module 3 use address character C instead of A The last command line shown above will make the module return to binary mode 3 5 2 Format of a Reply After executing the command the module sends back a reply in ASCII format The 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 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04
48. de STATUS VALUE 100 OK don t care Parameter ranges Parameter number Motor number Value s chapter 4 0 s chapter 4 Example Store the maximum speed of motor Mnemonic STAP 4 0 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel Byte0 Value hex 01 07 04 00 00 00 00 00 Note The STAP command will not have any effect when the configuration EEPROM is locked refer to 5 1 In direct mode the error code 5 configuration EEPROM locked see also section 3 2 1 will be returned in this case WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 30 3 6 8 RSAP restore axis parameter For all configuration related axis parameters non volatile memory locations are provided By default most parameters are automatically restored after power up refer to axis parameter list in chapter 4 A single parameter that has been changed before can be reset by this instruction also For a table with parameters and values which can be used together with this command please refer to chapter 4 Internal function The specified parameter is copied from the configuration EEPROM memory to its RAM location Relate commands SAP STAP GAP and AAP Mnemonic RSAP parameter number 0 Bin
49. direction back to receive too late 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 5 2 Bank 1 The global parameter bank 1 is normally not available It may be used for customer specific extensions of the firmware Together with user definable commands these variables form the interface between extensions of the firmware written in C and TMCL applications 5 3 Bank 2 Bank 2 contains general purpose 32 bit variables for the use in TMCL applications They are located in RAM and the first 56 variables can be stored permanently in EEPROM also After booting their values are automatically restored to the RAM Up to 256 user variables are available MEANING OF THE LETTERS IN COLUMN ACCESS Access Related Description Type Command s R GGP Parameter readable W SGP AGP Parameter writable E STGP RSGP Parameter automatically restored from EEPROM after reset or power on These parameters can be stored permanently in EEPROM using STGP command and also explicitly restored copied back from EEPROM into RAM using RSGP GENERAL PURPOSE VARIABLES FOR TMCL APPLICATIONS BANK 2 Number Global parameter Description Range Access O 55 general purpose variables t0 for use in TMCL applications PETI RWE 55
50. e 40 IN 1 change 41 IN 2 change 42 IN 3 change 255 Global interrupts 3 4 2 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 3 6 9 for further information about that 3 4 2 6 5 Using Interrupts in TMCL For using an interrupt proceed as follows 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 El lt interrupt gt command Globally enable interrupts using an El 255 command An interrupt handling routine must always end with a RETI command EXAMPLE FOR THE USE OF A TIMER INTERRUPT VECT o TimeroIrq define the interrupt vector SGP o 3 1000 configure the interrupt set its period to 1000ms EI o 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 o 50 SIO 3 2 O WAIT TICKS o 50 JA Loop Here is the interrupt handling routine TimeroIrq GIO o 2 check if OUTo is high JC NZ OutoOff jump if not SIO o 2 1 switch OUTo high RETI end of interrupt OutoOff SIO o 2 O switch OUTo low RETI end of interrupt www trinamic com TMCM 1140
51. e Bytel Byte0 Value hex 01 1c 00 00 00 00 00 00 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 24 SCO set coordinate Up to 20 position values coordinates can be stored for every axis for use with the MVP COORD command This command sets a coordinate to a specified value Depending on the global parameter 84 the coordinates are only stored in RAM or also stored in the EEPROM and copied back on startup with the default setting the coordinates are stored in RAM only 48 Please note that the coordinate number 0 is always stored in RAM only Internal function the passed value is stored in the internal position array Related commands GCO CCO MVP Mnemonic SCO coordinate number 0 position Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 30 coordinate number 0 position 0 20 23t 27 Reply in direct mode STATUS VALUE 100 OK don t care Example Set coordinate 1 of motor to 1000 Mnemonic SCO 1 0 1000 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Bytel Byte0 Value hex 01 le 01 00 00 00 03 e8 Note Two special functions of this command have been introduced that make it possible to copy all coordinates or
52. e V1 27 Manual Rev 1 04 2015 JAN 05 64 Number Axis Parameter Description Range Unit Acc 6 Absolute max The maximum value is 255 This value means 0 255 RWE current 100 of the maximum current of the module Ipeak lt value E CS Current The current adjustment is within the range O Scale 255 and can be adjusted in 32 steps Irus lt value a O 7 79 87 160 167 240 247 8 15 88 95 168 175 248 255 16 23 96 103 176 183 24 31 104 111 184 191 32 s 112 119 192 199 40 47 120 127 200 207 48 55 128 135 208 215 56 63 136 143 216 223 64 71 144 151 224 231 72 19 15288159 232 239 The most important motor setting since too high values might cause motor damage 7 Standby current The current limit two seconds after the motor 0 255 RWE has stopped Ipear lt value gt x ES Igus lt value exo 8 Target pos Indicates that the actual position equals the 0 1 R reached target position 9 Ref switch The logical state of the reference home 0 1 R status switch 10 Right limit The logical state of the right limit switch 0 1 R switch status 11 Left limit switch The logical state of the left limit switch in 0 1 R status three switch mode 12 Right limit If set deactivates the stop function of the 0 1 RWE switch disable right switch 13 Left limit switch Deactivates the stop function of the left 0 1 RWE disable switch resp reference switch if
53. e can also be read Internal function the specified line is read Related commands SIO WAIT Mnemonic GIO port number bank number Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 15 port number bank number don t care Reply in direct mode STATUS VALUE 100 OK status of the port Example Get the analog value of IN 0 Mnemonic GIO 0 1 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Byte1 Byte0 Value hex 01 Sof 00 01 00 00 00 00 Reply Byte Index 0 1 2 3 4 5 6 7 Function Host Target Status Instructio Operand Operand Operand Operand address address n Byte3 Byte2 Bytel ByteO Value hex 02 01 64 Sof 00 00 01 2e Status no error value 320 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 39 Multi purpose 1 0 Figure 3 2 1 0 connector 3 6 15 1 1 0 Bank 0 Digital Inputs The analog input IN 0 can be read as digital or analog input at the same time The analog value of IN 0 can be accessed in bank 1 Pin I O port Command Range 5 IN 0 GIO 0 0 0 1 6 IN 1 GIO 1 0 0 1 7 IN 2 GIO 2 0 0 1 8 IN 3 GIO 3 0 0 1 ENC N CHANNEL READ OUT COMMAND I O port Command ENC N channel inpu
54. e is transferred to axis parameter 0 target velocity The module is based on the TMCA29 stepper motor controller and the TMC262 power driver This makes possible choosing a velocity between 0 and 2047 Related commands ROL MST SAP GAP Mnemonic ROR O velocity Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 1 don t care 0 velocity 0 2047 motor number is always O as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care Example Rotate right velocity 350 Mnemonic ROR 0 350 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel ByteO Value hex 01 01 00 00 00 00 01 5e www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 23 3 6 2 ROL rotate left With this command the motor will be instructed to rotate with a specified velocity opposite direction compared to ROR decreasing the position counter Internal function First velocity mode is selected Then the velocity value is transferred to axis parameter 0 target velocity The module is based on the TMCA29 stepper motor controller and the TMC262 power driver This makes possible choosing a velocity between 0 and 2047 Related commands ROR MST SAP GAP Mnemonic ROL O0 v
55. eeseess 59 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 36 Customer Specific TMCL Command Extension UFO UF7 User Function ss 60 3 6 37 Request Target Position Reached Event sse tentent tnter nenne 60 3 6 38 TMCL Control FUNCION Ss 61 4 Axis PATRON 63 4 1 stallGuarde unitaria An AEA 70 4 2 coolStep Related Axis Paramete siii a cdta 70 4 3 Reference Search A AA A ea edad cs ce eine ia 72 4 3 1 Reference Search Modes Axis Parameter 193 sse eterne ten tnntnnis 73 44 Changing the Prescaler Value of an Encoder sese tentent 76 5 Global Parametersz oiest o Rata ER HEHR EO RH Rude caesi laua latte n gen 78 5 1 BnD as 78 5 2 Di A A A A eee a sea 81 5 3 Bankene eN NN c a DAD ERN ll a aa 81 5 4 PEIN E O OOO does 82 6 TMCL Programming Techniques and Structure moccicicncnnnnnc enema 83 6 1 Inr 83 6 2 MATO LOO p a PIS 83 6 3 Using Symbolic Constants uri Rs 83 6 4 TA A ua Borse et bais 84 6 5 Using SUBROUTINES strc mec rt tau eid M ese REI ete th PUN et LA LIE pac 84 6 6 Mixing Direct Mode and Standalone Mode essent tenente tne 85 TE Support Policy e ette ee ete e eere e OR e Rec eee a oe E i 86 C Revision MR IE rela e c AA A A 87 8 1 Firmware REVISION ud tete te bte seb elo Glide bie o LAS e 87 8 2 Document ReVISIO D xot EE e rper A De o eae deed nee ae ede 87 di jRefer nces oec UH LM LAND EL ALL OS TN EIN ALL M ELLE 88 www trinamic com TMCM
56. elocity Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 2 don t care 0 velocity 0 2047 motor number is always O as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care Example Rotate left velocity 1200 Mnemonic ROL 0 1200 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel ByteO Value hex 01 02 00 00 00 00 04 b0 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 24 3 6 3 MST motor stop With this command the motor will be instructed to stop with a soft stop Internal function The axis parameter target velocity is set to zero Related commands ROL ROR SAP GAP Mnemonic MST 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 3 don t care 0 don t care motor number is always O as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care Example Stop motor Mnemonic MST 0 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel ByteO Value hex 01 03 00 00 00 00 00 00 www trinamic com TMCM 1140 TMCL Fi
57. elow gives an overview of the coolStep related parameters Please have in mind that the figure shows only one example for a drive There are parameters which concern the configuration of the current Other parameters are for velocity regulation and for time adjustment THE FOLLOWING ADJUSTMENTS HAVE TO BE MADE Thresholds for current Ic I and I4g3 and velocity V455 have to be identified and set The stallGuard2 feature has to be adjusted and enabled with parameters SG479 and SG4g The reduction or increasing of the current in the coolStep area depending on the load has to be configured with parameters I469 and 1 7 In this chapter only basic axis parameters are mentioned which concern coolStep and stallGuard2 The complete list of axis parameters in chapter 4 contains further parameters which offer more configuration possibilities coolStep Adjustment Points and Thresholds Velocity Current A eee ee ere eee eee The current depends on the load of the motor I WE Time T214 coolStep area ES area without coolStep 123 Current and parameter Vi23 Velocity and parameter T123 Time parameter SG123 stallGuard2 M parameter The lower threshold of the coolStep current can be adjusted up to I6 4 Refer to parameter 168 Figure 4 1 coolStep adjustment points and thresholds www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 71 COOLS
58. encoder with next null channel event Add up both lt p gt values from these tables to get the required value for the SAP 210 command www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 78 5 Global Parameters GLOBAL PARAMETERS ARE GROUPED INTO 4 BANKS bank 0 global configuration of the module bank 1 user C variables bank user TMCL variables bank 3 interrupt configuration Please use SGP and GGP commands to write and read global parameters 5 1 Bank 0 Parameters with numbers from 64 on configure stuff like the serial address of the module RS485 baud rate or the CAN bit rate Change these parameters to meet your needs The best and easiest way to do this is to use the appropriate functions of the TMCL IDE The parameters with numbers between 64 and 128 are stored in EEPROM only Attention An SGP command on such a parameter will always store it permanently and no extra STGP command is needed Take care when changing these parameters and use the appropriate functions of the TMCL IDE to do it in an interactive way MEANING OF THE LETTERS IN COLUMN ACCESS Access Related Description Type Command s R GGP Parameter readable W SGP AGP Parameter writable E STGP RSGP Parameter automatically restored from EEPROM after reset or power on These parameters can be stored permanently in EEPROM using STGP command an
59. ep generator should be de incremented carefully in steps of one 160 Step Step interpolation is supported with a 16 0 1 RW interpolation microstep setting only In this setting each enable step impulse at the input causes the execution of 16 times 1 256 microsteps This way a smooth motor movement like in 256 microstep resolution is achieved 0 step interpolation off 1 step interpolation on 162 Chopper blank Selects the comparator blank time This time 0 3 RW time needs to safely cover the switching event and the duration of the ringing on the sense resistor For low current drivers a setting of 1 or 2 is good 163 Chopper mode Selection of the chopper mode 0 1 RW 0 spread cycle 1 classic const off time 164 Chopper Hysteresis decrement setting This setting 0 3 RW hysteresis determines the slope of the hysteresis during decrement on time and during fast decay time 0 fast decrement 3 very slow decrement 165 Chopper Hysteresis end setting Sets the hysteresis end 3 12 RW hysteresis end value after a number of decrements Decrement interval time is controlled by axis parameter 164 3 1 negative hysteresis end setting O zero hysteresis end setting 1 12 positive hysteresis end setting 166 Chopper Hysteresis start setting Please remark that 0 8 RW hysteresis start this value is an offset to the hysteresis end value WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev
60. erence search speed axis parameter 194 reference switch speed axis parameter 195 TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 74 Figure 5 2 Search left stop switch only SAP 193 0 2 Search right stop switch then search left stop switch Li i R reference search speed axis parameter 194 reference switch speed axis parameter 195 stop left limit end stop switch right limit end stop switch m Figure 5 3 Search right stop switch then search left stop switch SAP 193 0 3 Search right stop switch then search left stop switch from both sides Ie R reference search speed axis parameter 194 reference switch speed axis parameter 195 left limit end stop switch right limit end stop switch Figure 5 4 Search right stop switch then search left stop switch from both sides SAP 193 0 4 Search left stop switch from both sides R oo reference search speed axis parameter 194 reference switch speed axis parameter 195 Figure 5 5 Search left stop switch from both sides www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 SAP 193 0 5 75 Search home switch in negative direction reverse direction in case left stop switch is hit L c leftilimit end stop switch Home ee home switch
61. ernal function the specified parameter is copied from the configuration EEPROM memory to its RAM location Relate commands SGP STGP GGP and AGP Mnemonic RSAP parameter number bank number Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 12 parameter number bank number don t care Reply structure in direct mode STATUS VALUE 100 OK don t care For a table with parameters and bank numbers which can be used together with this command please refer to chapter 5 Example Restore user variable 42 Mnemonic RSGP 42 2 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Byte1 Byte0 Value hex 01 0c 2a 02 00 00 00 00 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 35 3 6 13RFS reference search The TMCM 1140 has a builtin reference search algorithm which can be used The reference search algorithm provides switching point calibration and supports up to three switches The status of the reference search can also be queried to see if it has already finished In a TMCL program it is better to use the WAIT command to wait for the end of a reference search Please see the appropriate parameters in the axis parameter table to config
62. errupts 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 3 4 8 6 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 the execution of the normal program will be continued WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 18 3 4 2 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 Stall stallGuard2 21 Deviation 27 Stop left 28 Stop right 39 IN 0 chang
63. ersion Date Author Description 1 00 2012 JUN 20 SD First version 1 01 2012 JUL 27 SIO command description completed SD Axis parameter 141 deleted Global parameter 79 added 1 02 2013 MAR 26 Interrupt description completed Axis parameter 218 corrected Global parameters 84 and 85 added GIO command description and SIO command description updated Names of inputs changed AIN 0 INO SD IN 0 IN 1 IN 1 IN2 IN 2 IN 3 Global parameter 67 ASCIT added Global parameter 87 secondary address for RS485 added Reference search the last position before setting the counter to zero can be read out with axis parameter 197 Axis parameter 193 new functions added 1 03 2013 JP Revision History updated 1 04 2015 JAN 05 Hardware version V1 3 pictures updated Reference search mode description 4 3 corrected GE updated clarified Encoder prescaler description 4 4 clarified extended Minor changes clarifications www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 9 References TMCM 1140 TMCM 1140 Hardware Manual TMC262 TMC262 Datasheet TMC429 TMC429 Datasheet TMCL IDE TMCL IDE User Manual Please refer to www trinamic com www trinamic com 88
64. erstandable symbolic constants should be taken for all important numerical values that are used in the program The TMCL IDE provides an include file with symbolic names for all important axis parameters and global parameters Example Define some constants include TMCLParam tmc MaxSpeed 500 MaxAcc 100 Position0 O Positionl 5000 Initialization SAP APMaxPositioningSpeed Motor0 MaxSpeed SAP APMaxAcceleration Motor0 MaxAcc MainLoop MVP ABS Motor0 Positionl WAIT POS Motor0 O0 MVP ABS Motor0 PositionO WAIT POS MotorO O0 JA MainLoop www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 84 Just have a look at the file TMCLParam tmc provided with the TMCL IDE It contains symbolic constants that define all important parameter numbers Using constants for other values makes it easier to change them when they are used more than once in a program You can change the definition of the constant and do not have to change all occurrences of it in your program 6 4 Using Variables The User Variables can be used if variables are needed in your program They can store temporary values The commands SGP GGP and AGP are used to work with user variables SGP is used to set a variable to a constant value e g during initialization phase GGP is used to read the contents of a user variable and to copy it to the accumulator register for further usage AGP can be used to copy the co
65. et position of the motor specified by the motor parameter has been reached An optional timeout value 0 for no timeout must be specified by the ticks parameter REFSW Wait until the reference switch of the motor specified by the motor parameter has been triggered An optional timeout value 0 for no timeout must be specified by the ticks parameter LIMSW Wait until a limit switch of the motor specified by the motor parameter has been triggered An optional timeout value 0 for no timeout must be specified by the ticks parameter RFS Wait until the reference search of the motor specified by the motor field has been reached An optional timeout value 0 for no timeout must be specified by the ticks parameter The timeout flag ETO will be set after a timeout limit has been reached You can then use a JC ETO command to check for such errors or clear the error using the CLE command Internal function The TMCL program counter is held until the specified condition is met Related commands JC CLE Mnemonic WAIT condition 0 ticks where condition is TICKS POS REFSW LIMSW RFS Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 0 TICKS timer ticks don t care no of ticks i gt 2 1 1 i 1 POS target position reached 9 no i ticks for timeout 0 for no timeout x2 1 1 1 2 REFSW reference switch 9 sooi ticks for timeout 27 0 for no timeout x2 1
66. f a Reply se e eed t deed te bed dehet etos 20 3 5 3 Configuring the ASCH Interface eed b ee oe ble lebe tatit inte 21 3 6 Commands icti ere UE Fe tto dae etc a ALT S eoi T 22 361 ROR rotate right inse un adit une opina teli iin a aur aid ient 22 36 27 ROL rotate lett i dicite da AAA vec aL eddie 23 3 6 3 MET motor Stop ined AA a A 24 364 MVP move to position tendientes dedi bueno ta bae uiae deed deb ena de dae 25 3 6 5 SAP set axis parameter ourien aseni araa ENEA EE A SEAE EAE AAEE AAA ACREA 27 3 6 6 GAP get axis parameter puc 28 3 6 STAP store axis parameter cccssssssssscsessssessessssessssscsessessesecsessesessssnesssssncsesaesnesesssenesessssneseeateneseeseeneseees 29 3 6 8 gt RSAP restore axis parameter ini A ds 30 3 6 9 SGP set global parametro Les de LEN cU Lee 31 3 6 10 GGP get global paramete ciciicioniicnicninnini as 32 3 6 11 STGP store global parameter mnicicininiininnm ans 33 3 6 12 RSGP restore global parameter cesssssesssssessessessessesseeseeseeseessesseeseeaeeseeaeeseeaeesteseeseeseeseesssieseeaeeaeeaeees 34 3613 RES refereng e search iced A eee ecce 35 36 14 SIO Set putita id id iaa 36 316 15 GIO get input output nacida dadas 38 36 16 CALC Calc A A A E MH 40 36 17 COMP compare inde ite n ipee ER Do eh MEER CH O Fable RA Dod eia Ae vk Does acia 41 3 6 18 JC Gump conditional eiii crie hrec prier retur c eene A il 42 2619 JA Gump alWays ar AAA aaa 43 3
67. from both sides search left stop switch STOP L from both sides 5 search home switch HOME in negative direction reverse the direction when left stop switch STOP L reached 6 search home switch HOME in positive direction reverse the direction when right stop switch STOP R reached 7 search home switch HOME in negative direction ignore end switches STOP L and STOP R 8 search home switch HOME in positive direction ignore end switches STOP L and STOP R Additional functions Add 128 to a mode value for inverting the home switch HOME polarity can be used with mode 5 8 Add 64 to a mode for exchanging left STOP L and right STOP R stop switches can be used with mode 1 4 194 Reference search For the reference search this value directly specifies the search speed speed 195 Reference switch Similar to parameter no 194 the speed for the switching point calibration can speed be selected 196 Reference switch This parameter provides the distance between the end switches after executing distance the RFS command mode or 3 4 3 1 Reference Search Modes Axis Parameter 193 The following figures explain the actual motor movement during the different reference search modes in more detail A linear stage with two end points and a moving slider is taken as example SAP 193 0 1 Search left stop switch only L o start stop left limit end stop switch WWW trinamic com R ref
68. he instruction to the TMCL program memory while the program loads down This command cannot be used in direct mode Internal function The actual TMCL program counter value is saved to an internal stack afterwards overwritten with the passed value The number of entries in the internal stack is limited to 8 This also limits nesting of subroutine calls to 8 The command will be ignored if there is no more stack space left Related commands RSUB JA Mnemonic CSUB Label Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 23 don t care don t care subroutine address Example Call a subroutine Loop MVP ABS 0 10000 CSUB SubW Save program counter and jump to label SubW MVP ABS 0 0 JA Loop SubW WAIT POS 0 0 WAIT TICKS O 50 RSUB IContinue 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 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Bytel Byte0 Value hex 01 17 00 00 00 00 00 64 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 21 RSUB return from subroutine Return from a subroutine to the command after the CSUB command This command is intended for use in standalone mode only 45 The host address
69. he result is written back to the accumulator for further processing like comparisons or data transfer Related commands CALCX COMP JC AAP AGP GAP GGP Mnemonic CALC operation value where op is ADD SUB MUL DIV MOD AND OR XOR NOT or LOAD Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 19 0 ADD add to accu don t care lt operand gt 1 SUB subtract from accu 1 MUL multiply accu by 1 DIV divide accu by 1 MOD modulo divide by 1 AND logical and accu with 6 OR logical or accu with 7 XOR logical exor accu with 8 NOT logical invert accu 9 LOAD load operand to accu Example Multiply accu by 5000 Mnemonic CALC MUL 5000 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel Byte0 Value hex 01 13 02 00 SFF SFF SEC 78 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 41 3 6 17 COMP compare The specified number is compared to the value in the accumulator register The result of the comparison can for example be used by the conditional jump JQ instruction This command is intended for use in standalone operation only The host address and the reply are only used to take the instruction to the TMCL program memory while the program loads down It does not
70. il A www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 4 Switch ON the power supply Turn power ON The green LED for power lights up and the motor is powered but in standstill now If this does not occur switch power OFF and check your connections as well as the power supply 2 11 Start the TMCL IDE Software Development Environment The TMCL IDE is available on www trinamic com Installing the TMCL IDE Make sure the COM port you intend to use is not blocked by another program Open TMCL IDE by clicking TMCL exe Choose Setup and Options and thereafter the Connection tab Choose COM port and type with the parameters shown in Figure 2 2 baud rate 9600 Click OK USB interface If the file TMCM 1140 inf is installed correctly the module will be identified automatically E A Options Assembler Connection Debugger Type R5232 R9485 USB COM port v R5232 RS485 Port COM14 TMCM 1140 v Baud 9500 v Al TMCL Integrated Development Environment CAUsersiSonja Dwel e pte 2 i m File Edit TMCL Debug Setup Help BB S S 13 Options Test4 tme Configure Module Sar AAA ne pi ox cercei Noch ein Test ri Search Module include m artali ME Figure 2 2 Setup dialogue and connection tab of the TMCL IDE Please refer to the TMCL IDE User Manual for more information see www TRIN
71. ison Please refer to COMP instruction for examples This function is for standalone operation only The host address and the reply are only used to take the instruction to the TMCL program memory while the program loads down It does not make sense to use this command in direct mode See the host only control functions for details Internal function the TMCL program counter is set to the passed value if the arithmetic status flags are in the appropriate state s Related commands JA COMP WAIT CLE Mnemonic JC condition label where lt condition gt ZE NZ EQ NE GT GE LT LEJETO EAL EDV EPO Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 21 0 ZE zero don t care sump address gt NZ not zero EQ equal NE not equal GT greater GE greater equal 6 LT lower 7 LE lower equal 8 ETO time out error haa Example Jump to address given by the label when the position of motor is greater than or equal to 1000 GAP 1 0 0 llget axis parameter type no 1 actual position motor 0 value 0 don t care COMP 1000 IIcompare actual value to 1000 JC GE Label Iljump type 5 greater equal Label ROL 0 1000 Binary format of JC GE Label when Label is at address 10 Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Bytel Byte0 Va
72. le with parameters and bank numbers which can be used together with this command please refer to chapter 5 Internal function the parameter format is converted ignoring leading zeros or ones for negative values The parameter is transferred to the correct position in the appropriate on board device Related commands GGP STGP RSGP AGP Mnemonic SGP parameter number bank number value Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 9 parameter number bank number value Reply in direct mode STATUS VALUE 100 OK don t care Example Set the serial address of the target device to 3 Mnemonic SGP 66 0 3 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel Byte0 Value hex 01 09 42 00 00 00 00 03 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 32 3 6 10 GGP get global parameter All global parameters can be read with this function Global parameters are related to the host interface peripherals or application specific variables The different groups of these parameters are organized in banks to allow a larger total number for future products Currently only bank O and 1 are used for global parameters and bank 2 is used for user variables Bank 3 is used fo
73. lue hex 01 15 05 00 00 00 00 0a www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 43 3 6 19 JA jump always Jump to a fixed address in the TMCL program memory This command is intended for standalone operation only The host address and the reply are only used to take the instruction to the TMCL program memory while the program loads down This command cannot be used in direct mode Internal function the TMCL program counter is set to the passed value Related commands JC WAIT CSUB Mnemonic JA lt Label gt Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 22 don t care don t care lt jump address gt Example An infinite loop in TMCLTM Loop MVP ABS 0 10000 WAIT POS 0 0 MVP ABS 0 0 WAIT POS 0 0 JA Loop IlJump to the label Loop Binary format of JA Loop assuming that the label Loop is at address 20 Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Bytel Byte0 Value hex 01 16 00 00 00 00 00 14 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 44 3 6 20 CSUB call subroutine This function calls a subroutine in the TMCL program memory It is intended for standalone operation only The host address and the reply are only used to take t
74. make sense to use this command in direct mode Internal function The specified value is compared to the internal accumulator which holds the value of a preceding get or calculate instruction see GAP GGP CALC CALCX The internal arithmetic status flags are set according to the comparison result Related commands JC jump conditional GAP GGP CALC CALCX Mnemonic COMP value Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 20 don t care don t care comparison value Example Jump to the address given by the label when the position of motor is greater than or equal to 1000 GAP 1 2 0 llget axis parameter type no 1 actual position motor 0 value O don t care COMP 1000 IIcompare actual value to 1000 JC GE Label Ihump type 5 greater equal the label must be defined somewhere else in the program Binary format of the COMP 1000 command Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel Byte0 Value hex 01 14 00 00 00 00 03 e8 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 42 3 6 18 JC jump conditional The JC instruction enables a conditional jump to a fixed address in the TMCL program memory if the specified condition is met The conditions refer to the result of a preceding compar
75. motor number Move to position absolute or relative lt positionloffset gt 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 TMCLTM user variables GGP 10 parameter bank number Get global parameter read out module specific settings e g communication settings or TMCLTM user variables STGP 11 parameter bank number Store global parameter TMCLTM user variables only RSGP 12 parameter bank number Restore global parameter TMCLTM 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 amp value COMP 20 value Compare accumulator value JC 21 condition jump address Jump conditional JA 22 sump address gt Jump absolute CSUB 23 lt subroutine address Call subroutine RSUB 24 Return from subroutine EI 25 lt interrupt number gt E
76. mple Jump commands to the TMCL routines Funcl JA FunclStart Func2 JA Func2Start Func3 JA Func3Start FunclStart MVP ABS 0 1000 WAIT POS 0 O MVP ABS 0 O WAIT POS 0 O STOP Func2Start ROL 0 500 WAIT TICKS 0 100 MST 0 STOP Func3Start ROR 0 1000 WAIT TICKS O 700 MST 0 STOP This example provides three very simple TMCL routines They can be called from a host by issuing a run command with address O to call the first function or a run command with address 1 to call the second function or a run command with address 2 to call the third function You can see the addresses of the TMCL labels that are needed for the run commands by using the Generate symbol file function of the TMCL IDE Please refer to the TMCL IDE User Manual for further information about the TMCL IDE www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 1 Life Support Policy TRINAMIC Motion Control GmbH amp 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 amp 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 amp Co KG 2013 Information given in this data sheet
77. nable 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 Set coordinate position GCO 31 coordinate number motor number Get coordinate CCO 32 coordinate number motor number Capture coordinate CALCX 33 operation Process accumulator amp 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 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 16 3 4 2 Commands Listed According to Subject Area 3 4 2 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 standalone 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 3 4 2 2 Parameter Commands These commands are used to set read and store axis parameters or global parameters Axis parameters can be set
78. nce please see SIO command for more details and different configuration options This way a normally open N O switch may be connected between supply voltage e g 24V and the STOP L STOP R or HOME input The input will be low as long as the switch is not activated and turning high as soon as the switch is activated For other configurations it is also possible to invert the polarity of the input see global parameter 79 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 73 AXIS PARAMETERS RELATED TO REFERENCE SEARCH Number Axis Parameter Description 9 Reference switch The logical state of the HOME switch status 10 Right limit The logical state of the STOP R switch switch status 11 Left limit switch The logical state of the STOP L switch status 12 Right limit If set deactivates the stop function of the STOP R switch switch disable not applicable for the reference search algorithm 13 Left limit switch If set deactivates the stop function of the STOP L switch disable not applicable for the reference search algorithm 149 Soft stop flag If cleared the motor will stop immediately disregarding motor limits when the end stop limit switch is hit 193 Reference search 1 search left stop switch STOP L only mode 2 search right stop switch STOP R then search left stop switch STOP L 3 search right stop switch STOP R then search left stop switch STOP L
79. ntents of the accumulator register to a user variable e g to store the result of a calculation Example MyVariable 42 Use a symbolic name for the user variable This makes the program better readable and understandable SGP MyVariable 2 1234 Initialize the variable with the value 1234 GGP MyVariable 2 Copy the contents of the variable to the accumulator register CALC MUL 2 Multiply accumulator register with two AAP MyVariable 2 Store contents of the accumulator register to the variable Furthermore these variables can provide a powerful way of communication between a TMCL program running on a module and a host The host can change a variable by issuing a direct mode SGP command remember that while a TMCL program is running direct mode commands can still be executed without interfering with the running program If the TMCL program polls this variable regularly it can react on such changes of its contents The host can also poll a variable using GGP in direct mode and see if it has been changed by the TMCL program 6 5 Using Subroutines The CSUB and RSUB commands provide a mechanism for using subroutines The CSUB command branches to the given label When an RSUB command is executed the control goes back to the command that follows the CSUB command that called the subroutine This mechanism can also be nested From a subroutine called by a CSUB command other subroutines can be called In the cur
80. o back each character 01 echo back complete command 10 do not send echo only send command reply RWE 68 Serial heartbeat Serial heartbeat for the RS485 interface Tf this time limit is up and no further command is noticed the motor will be stopped 0 parameter is disabled ms RWE 69 CAN bit rate 20kBit s 50kBit s 100kBit s 125kBit s 250kBit s 500kBit s 8 1000kBit s SNOW RB WwW PP Default RWE 70 CAN reply ID The CAN ID for default 2 replies from the board O 7ff RWE 71 CAN ID The module target address for CAN default 1 O 7ff RWE 13 Configuration EEPROM lock flag Write 1234 to unlock it Read 1 EEPROM locked O EEPROM unlocked lock the EEPROM 4321 to 0 1 RWE 15 Telegram pause time Pause time before the reply via RS485 is sent For RS485 it is often necessary to set it to 15 for RS485 adapters controlled by the RTS pin For CAN interface this parameter has no effect O 255 RWE 76 Serial host address Host address used in the reply telegrams sent back via RS485 O 255 RWE 71 Auto start mode 0 Do not start TMCL application after power up default 1 Start TMCL application automatically after power up 0 1 RWE 19 End switch polarity 0 normal polarity 1 reverse polarity 0 1 RWE www trinamic com TMCM 1140 TMCL Firmwa
81. o not connect or disconnect the TMCM 1140 while powered Do not connect or disconnect the motor while powered Do not exceed the maximum power supply voltage of 28 V DC Note that the module is not protected against reverse polarity START WITH POWER SUPPLY OFF 2 1 Basic Set Up The following paragraph will guide you through the steps of connecting the unit and making first movements with the motor CONNECTING THE MODULE Converter e g USB 2 485 Converter e g USB 2 X Serial USB interface CAN Pin 6 CAN_L Pin 5 CAN_H Pin 1 GND Pin 4 RS485 Pin 3 RS485 ap e Pin 1 GND Power supply Pin 2 9 28V DC Pin 1 GND Note that the GND pin has to be used for power supply and for the interfaces also Figure 2 1 Starting up WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 7 1 Connect power supply and choose your interface a Connect CAN or RS485 and power supply CAN interface will be de activated in case USB is connected due to internal sharing of hardware resources Pin Label Description 1 GND System and signal ground 2 VDD VDD 9V 28V 3 RS485 RS485 interface diff signal non inverting 4 RS485 RS485 interface diff signal inverting 5 CAN H CAN interface diff signal non inverting 6 CAN L CAN interface diff signal inverting b Connect USB interface as alternative to CAN and RS485
82. ommands SAP GAP SCO CCO GCO MST Mnemonic MVP lt ABS REL COORD gt 0 position offset coordinate number Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 4 0 ABS absolute 0 position 1 REL relative 0 offset 2 COORD coordinate 0 coordinate number 0 20 motor number is always O as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care Example Move motor to absolute position 90000 Mnemonic MVP ABS 0 9000 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Byte1 Byte0 Value hex 01 04 00 00 00 01 5f 90 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 26 Example Move motor from current position 1000 steps backward move relative 1000 Mnemonic MVP REL 0 1000 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instructio Type Motor Operand Operand Operand Operand address n Bank Byte3 Byte2 Bytel ByteO Number Value hex 01 04 01 00 Sff Sff Sfc 18 Example Move motor to previously stored coordinate 8 Mnemonic MVP COORD 0 8 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand addres
83. ond module target address This is the group or broadcast address of the module Using this address a single command e g ROR or MVP sent by the master is sufficient in order to initiate a movement of several group or even all broadcast modules connected to one bus The first serial address 66 might then still be used to set parameters of the modules individually In order to avoid bus collisions the module will not sent a reply for commands with this address O 255 RWE 128 TMCL application status 0 stop 1 run 1 step 3 reset 129 Download mode 0 normal mode 1 download mode 0 1 130 TMCL program counter The index of the currently executed TMCL instruction www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 81 Number Parameter Description Range Access 132 Tick timer A 32 bit counter that gets incremented by one 0 2 RW every millisecond It can also be reset to any start value 133 Random number Choose a random number 0 2147483647 RW With most RS485 converters that can be attached to the COM port of a PC the data direction is controlled by the RTS pin of the COM port Please note that this will only work with Windows 2000 Windows XP or Windows NT4 not with Windows 95 Windows 98 or Windows ME due to a bug in these operating systems Another problem is that Windows 2000 XP NT4 switches the
84. r Reference source external encoder not found 218 Maximum When the actual position parameter 1 and 0 65535 encoder the encoder position parameter 216 differ deviation more than set here the motor will be encoder steps external encoder stopped This function is switched off when the maximum deviation is set to zero This parameter is only used if an external encoder is connected Unit of acceleration www trinamic com 16MHz microsteps 536870912 2Puls_divisor ramp_divisor sec TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 70 4 1 stallGuard2 The module is equipped with TMC262 motor driver chip The TMC262 features load measurement that can be used for stall detection stallGuard2 delivers a sensorless load measurement of the motor as well as a stall detection signal The measured value changes linear with the load on the motor in a wide range of load velocity and current settings At maximum motor load the stallGuard2 value goes to zero This corresponds to a load angle of 90 between the magnetic field of the stator and magnets in the rotor This also is the most energy efficient point of operation for the motor Stall detection means that the motor will be stopped when the load gets too high It is configured by axis parameter 174 Stall detection can also be used for finding the reference point Do not use RFS in this case 4 2 coolStep Related Axis Parameters The figure b
85. r interrupt configuration For a table with parameters and bank numbers which can be used together with this command please refer to chapter 5 Internal function The parameter is read out of the correct position in the appropriate device The parameter format is converted adding leading zeros or ones for negative values Related commands SGP STGP RSGP AGP Mnemonic GGP parameter number bank number Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 10 see chapter 6 bank number don t care Reply in direct mode STATUS VALUE 100 OK don t care Example Get the serial address of the target device Mnemonic GGP 66 0 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel Byte0 Value hex 01 0a 42 00 00 00 00 00 Reply Byte Index 0 1 2 3 4 5 6 7 Function Host Target Status Instructio Operand Operand Operand Operand address address n Byte3 Byte2 Bytel Byte0 Value hex 02 01 64 0a 00 00 00 01 gt Status no error Value 1 WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 11 STGP store global parameter This command is used to store TMCL user variables permanently in the EEPROM of the module Some global paramete
86. r this purpose SIO is used to switch the pull up resistors for all digital inputs ON 1 and OFF 0 Bank O is used for this purpose Internal function the passed value is transferred to the specified output line Related commands GIO WAIT Mnemonic SIO port number bank number value Binary representation 36 INSTRUCTION NO TYPE MOT BANK VALUE 14 port number bank number value 0 1 Bank 2 is used for setting the status of the general digital output either to zero 0 or to one 1 Reply structure STATUS VALUE 100 OK don t care Example Activate OUT 1 supply 5V to external circuits bank 2 output 1 Mnemonic SIO 1 2 1 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel Byte0 Value hex 01 0e 07 02 00 00 00 01 Multi purpose 1 0 Figure 3 1 1 0 connector I O PORTS USED FOR SIO AND COMMAND Pin 1 0 port Command Range 3 OUT 0 SIO 0 2 n 0 OUT O0 off high impedance floating 1 OUT 0 pulled low max 1A 4 OUT 1 SIO 1 2 n 0 OUT 1 off weak low via 10k pull down resistor 1 OUT 1 supplies 5V to external circuits 100mA load max www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 37 ADDRESSING BOTH O
87. re V1 27 Manual Rev 1 04 2015 JAN 05 80 Number Parameter 81 TMCL code protection Description Protect a TMCL program against disassembling or overwriting 0 no protection 1 protection against disassembling 1 protection against overwriting 1 protection against disassembling and overwriting If you switch off the protection against disassembling the program will be erased first Changing this value from 1 or 3 to 0 or 2 the TMCL program will be wiped off Range 0 1 2 3 Access RWE 83 CAN secondary address Second CAN ID for the module Switched off when set to zero This is the group or broadcast address of the module Using this address a single command e g ROR or MVP sent by the master is sufficient in order to initiate a movement of several group or even all broadcast modules connected to one bus The first CAN address 71 might then still be used to set parameters of the modules individually In order to avoid bus collisions the module will not sent a reply for commands with this address O 7ff RWE 84 Coordinate storage 0 coordinates are stored in the RAM only but can be copied explicitly between RAM and EEPROM 1 coordinates are always stored in the EEPROM only 0 1 RWE 85 Do not restore user variables 0 user variables are restored default 1 user variables are not restored default 0 1 RWE 87 Serial secondary address Sec
88. released again stops reverses direction moves towards the reference switch at low speed again until it is triggered again Tt will then move to the middle of the switch between the two positions where the switch has been activated triggered at low speed from both sides With this mode the reference switch is overrun and the motor stops in the middle between activation of the switch from the left and the right side This mode is usually used with the home switch Using axis parameter 193 the reference search mode can be selected see next chapter for more details on different reference search modes before the actual reference search is started using the RFS command command no 13 End limit stop Home switches With default configuration it is expected that both end limit stop switches and the home switch are normally closed N C switches These switches should be connected between the STOP L IN 1 Pin 6 of the multipurpose I O connector STOP R IN 2 Pin 7 of the multipurpose I O connector resp HOME IN 3 Pin 8 of the multipurpose I O connector input of and ground GND With default configuration the inputs offer pull up resistors to 5V As soon as one of the switches is activated open the input level will go high due to the internal pull ups For other types of switches and or other external connections this can be changed in software Internal pull ups can be deactivated using the command SIO 0 0 O for all pull ups at o
89. rent version of TMCL eight levels of nested subroutine calls are allowed www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 85 6 6 Mixing Direct Mode and Standalone Mode Direct mode and standalone mode can also be mixed When a TMCL program is being executed in standalone mode direct mode commands are also processed and they do not disturb the flow of the program running in standalone mode So it is also possible to query e g the actual position of the motor in direct mode while a TMCL program is running Communication between a program running in standalone mode and a host can be done using the TMCL user variables The host can then change the value of a user variable using a direct mode SGP command which is regularly polled by the TMCL program e g in its main loop and so the TMCL program can react on such changes Vice versa a TMCL program can change a user variable that is polled by the host using a direct mode GGP command A TMCL program can be started by the host using the run command in direct mode This way also a set of TMCL routines can be defined that are called by a host In this case it is recommended to place JA commands at the beginning of the TMCL program that jump to the specific routines This assures that the entry addresses of the routines will not change even when the TMCL routines are changed so when changing the TMCL routines the host program does not have to be changed Exa
90. resentation INSTRUCTION NO TYPE MOT BANK VALUE 34 lt parameter number gt 0 don t care Motor number is always 0 as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care Example Positioning motor by a potentiometer connected to the analogue input 0 Start GIO 0 1 CALC MUL 4 AAP 0 0 JA Start Il get value of analogue input line 0 Il multiply by 4 I transfer result to target position of motor 0 Il jump back to start Binary format of the AAP 0 0 command Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte Bytel Byte0 Value hex 01 22 00 00 00 00 00 00 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 54 3 6 30 AGP accumulator to global parameter The content of the accumulator register is transferred to the specified global parameter For practical usage the accumulator has to be loaded e g by a preceding GAP instruction The accumulator may have been modified by the CALC or CALCX calculate instruction Note The global parameters in bank O are EEPROM only and thus should not be modified automatically by a standalone application See chapter 5 for a complete list of global parameters Related commands AAP SGP
91. reshold see smartEnergy hysteresis start Current increment step size Scaling 0 3 1 2 4 8 0 slow increment 3 fast increment fast reaction to rising load 172 smartEnergy The lower threshold for the stallGuard2 0 15 RW hysteresis start value see smart Energy current up step 173 stallGuard2 filter Enables the stallGuard2 filter for more O 1 RW enable precision of the measurement If set reduces the measurement frequency to one measurement per four fullsteps In most cases it is expedient to set the filtered mode before using coolStep Use the standard mode for step detection 0 standard mode 1 filtered mode loss www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 67 Number 174 Axis Parameter stallGuard2 threshold Description This signed value controls stallGuard2 threshold level for stall output and sets the optimum measurement range for readout A lower value gives a higher sensitivity Zero is the starting value A higher value makes stallGuard2 less sensitive and requires more torque to indicate a stall 0 Indifferent value 1 63 less sensitivity 1 64 higher sensitivity Range Unit 64 63 Acc RW 175 Slope control high side Determines the slope of the motor driver outputs Set to 2 or 3 for this module or rather use the default value 0 lowest slope 3 fastest slope RW
92. rget Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel ByteO Value hex 01 05 06 00 00 00 00 c8 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 28 3 6 6 GAP get axis parameter Most parameters of the TMCM 1140 can be adjusted individually for the axis With this 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 conditioned jumps In direct mode the value read is only output in the value field of the reply without affecting the accumulator For a table with parameters and values which can be used together with this command please refer to chapter 4 Internal function The parameter is read out of the correct position in the appropriate device The parameter format is converted adding leading zeros or ones for negative values Related commands SAP STAP AAP RSAP Mnemonic GAP parameter number 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 6 lt parameter number gt 0 don t care motor number is always O as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care Example Get the actual position of motor Mnemonic GAP 0 1 Binary
93. rmware V1 27 Manual Rev 1 04 2015 JAN 05 25 3 6 54 MVP move to position With this command the motor will be instructed to move to a specified relative or absolute position It will use the acceleration deceleration ramp and the positioning speed programmed into the unit This command is non blocking that is a reply will be sent immediately after command interpretation and initialization of the motion controller Further commands may follow without waiting for the motor reaching its end position The maximum velocity and acceleration are defined by axis parameters 4 and 5 The range of the MVP command is 32 bit signed 2 147 483 648 2 147 483 647 Positioning can be interrupted using MST ROL or ROR commands THREE OPERATION TYPES ARE AVAILABLE Moving to an absolute position in the range from 2 147 483 648 2 147 483 647 2 2 1 Starting a relative movement by means of an offset to the actual position In this case the new resulting position value must not exceed the above mentioned limits too Moving the motor to a previously stored coordinate refer to SCO for details Please note that the distance between the actual position and the new one should not be more than 2 147 483 647 271 1 microsteps Otherwise the motor will run in the opposite direction in order to take the shorter distance Internal function A new position value is transferred to the axis parameter 2 target position Related c
94. rs are located in RAM memory so without storing modifications are lost at power down This instruction enables enduring storing Most parameters are automatically restored after power up For a table with parameters and bank numbers which can be used together with this command please refer to chapter 5 Internal function The specified parameter is copied from its RAM location to the configuration EEPROM Related commands SGP GGP RSGP AGP Mnemonic STGP parameter number bank number Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 11 see chapter 8 bank number see chapter 5 don t care Reply in direct mode STATUS VALUE 100 OK don t care Example Store the user variable 42 Mnemonic STGP 42 2 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel Byte0 Value hex 01 0b 2a 02 00 00 00 00 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 12 RSGP restore global parameter With this command the contents of a TMCL user variable can be restored from the EEPROM By default most parameters are automatically restored after power up A single parameter that has been changed before can be reset by this instruction 34 Int
95. s 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 Wrong checksum Invalid command Wrong type Invalid value Configuration EEPROM locked Ov ui BI inm mP Command not available 3 3 Standalone Applications The module is equipped with a TMCL memory for storing TMCL applications You can use 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 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 4 TMCL Command Overview In this section a short overview of the TMCL commands is given 3 4 1 TMCL Commands 15 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 ABSIREL COORD
96. s Number Bank Byte3 Byte Byte1 Byte0 Value hex 01 04 02 00 00 00 00 08 When moving to a coordinate the coordinate has to be set properly in advance with the help of the SCO CCO or ACO command www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 5 SAP set axis parameter 2 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 Please use command STAP store axis parameter in order to store any setting permanently For a table with parameters and values which can be used together with this command please refer to chapter 4 Internal function The parameter format is converted ignoring leading zeros or ones for negative values The parameter is transferred to the correct position in the appropriate device Related commands GAP STAP RSAP AAP Mnemonic SAP parameter number 0 value Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 5 lt parameter number gt 0 value motor number is always O as only one motor is involved Reply in direct mode STATUS VALUE 100 OK don t care Example Set the absolute maximum current of motor to 200mA Mnemonic SAP 6 0 200 Binary Byte Index 0 1 2 3 4 5 6 7 Function Ta
97. se note also that the coordinate number 0 is always stored in RAM only For Information about storing coordinates refer to the SCO command Internal function the actual value of the accumulator is stored in the internal position array Related commands GCO CCO MVP COORD SCO Mnemonic ACO coordinate number 0 Binary representation INSTRUCTION NO TYPE MOT BANK VALUE 39 lt coordinate number gt 0 don t care 0 20 Reply in direct mode STATUS VALUE 100 OK don t care Example Copy the actual value of the accumulator to coordinate 1 of motor 0 Mnemonic ACO 1 0 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel ByteO Value hex 01 27 01 00 00 00 00 00 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 28 CALCX calculate using the X register This instruction is very similar to CALC but the second operand comes from the X register The X register can be loaded with the LOAD or the SWAP type of this instruction The result is written back to the accumulator for further processing like comparisons or data transfer Related commands CALC COMP JC AAP AGP Mnemonic CALCX operation with lt operation gt ADD SUB MUL DIV MOD AND OR XOR NOT LOAD SWAP Binary representation
98. should be adjusted to motor application for proper module operation Parameters for the more experienced user please do not change unless you are absolutely sure Number Axis Parameter Description Range Unit Acc 0 Target next The desired position in position mode see 27 1 RW position ramp mode no 138 usteps 1 Actual position The current position of the motor Should 2 1 RW only be overwritten for reference point usteps setting 2 Target next The desired speed in velocity mode see ramp 2047 RW speed mode no 138 In position mode this 16MBz puseaivisor HStEPS parameter is set by hardware to the WS me maximum speed during acceleration and to zero during deceleration and rest 3 Actual speed The current rotation speed 2047 RW 16MHz steps i c cand al 4 Maximum Should not exceed the physically highest 0 2047 RWE positioning possible value Adjust the pulse divisor axis speed parameter 154 if the speed value is very low mue A Bop 65536 sec lt 50 or above the upper limit 5 Maximum The limit for acceleration and deceleration 0 2047 RWE acceleration Changing this parameter requires re calculation of the acceleration factor no 146 and the acceleration divisor no 137 which is done automatically See TMC 429 datasheet for calculation of physical units www trinamic com TMCM 1140 TMCL Firmwar
99. t 0 off GIO 11 0 1 active READING ALL DIGITAL INPUTS WITH ONE GIO COMMAND Set the type parameter to 255 and the bank parameter to O In this case the status of all digital input lines will be read to the lower eight bits of the accumulator USE FOLLOWING PROGRAM TO REPRESENT THE STATES OF THE INPUT LINES ON THE OUTPUT LINES Loop GIO 255 0 SIO 255 2 1 JA Loop Note IN 0 can be used as analog or digital input 3 6 15 2 I O Bank 1 Analog Input The analog input IN 0 can be read as digital or analog input at the same time The analog value of IN 0 can be accessed in bank 1 Pin I O port Command Range 5 INO GIO 0 1 O 4095 READING OUT OPERATING VOLTAGE AND TEMPERATURE 1 0 port Command Operating voltage 1 10 V GIO 8 1 Temperature C GIO 9 1 www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 40 3 6 15 3 I O Bank 2 States of Digital Outputs The states of the OUT lines that have been set by SIO commands can be read back using bank 2 Pin I O port Command Range 3 OUT 0 GIO 0 2 n 1 0 4 OUT 1 GIO 1 2 n 1 0 3 6 16 CALC calculate A value in the accumulator variable previously read by a function such as GAP get axis parameter can be modified with this instruction Nine different arithmetic functions can be chosen and one constant operand value must be specified T
100. ted Also other values between those given in the table can be used e g a value for p of 512 results in no scaling at all prescaler 1 which is sometimes helpful in case the encoder resolution is unknown not known for sure Only the values 1 2 4 and 16 must not be used for p because they are needed to select the special encoder function below or rather are reserved for intern usage WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 77 TO SELECT A PRESCALER FOR DIFFERENT MICROSTEP RESOLUTIONS THE FOLLOWING VALUES CAN BE USED FOR lt P gt Microstep resolution Resulting Value for lt p gt SAP 210 0 lt p gt axis parameter 140 prescaler use SAP 217 0 lt p gt for the external encoder 8 256 micro steps 50 default 25600 SAP 210 0 25600 7 128 micro steps 25 12800 SAP 210 0 12800 6 64 micro steps 12 5 6400 SAP 210 0 6400 5 32 micro steps 6 25 3200 SAP 210 0 3200 4 16 micro steps 3 125 1600 SAP 210 0 1600 3 8 micro steps 1 5625 800 SAP 210 0 800 2 4 micro steps 0 78125 400 SAP 210 0 400 1 2 micro steps 0 390625 200 SAP 210 0 200 CLEAR ENCODER There is one special function that can also be configured using lt p gt following value to lt p gt For clearing the encoder add the Adder for lt p gt SAP 210 0 lt p gt use SAP 217 0 lt p gt for the external encoder 4 Clear
101. tion 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 lt 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 3 2 Reply Format Every time a command has been sent to a module the module sends a reply The reply format for RS485 USB is as follows Bytes Meaning Reply address Module address Status e g 100 means no error Command number Value MSB first PIB PIR RP Checksum The checksum is also 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 Do not send the next command before you have received the reply www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 14 3 2 1 Status Code
102. uard2 load measurement SG as a function of load 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 system cooler increases motor life and allows reducing cost 0 3 Efficiency with coolStep 08 _ TF OT Efficiency with 50 torque reserve 0 7 0 6 0 5 Efficiency 0 4 0 3 0 2 0 1 0 T T 1 0 50 100 150 200 250 300 350 Velocity RPM Figure 1 2 Energy efficiency example with coolStep WWW trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 6 2 Putting the Module into Operation Here you can find basic information for putting your TMCM 1140 into operation If you are already common with TRINAMICs modules you may skip this chapter The things you need TMCM 1140 Interface RS485 CAN USB suitable to your module with cables Nominal supply voltage 24V DC for your module TMCL IDE program and PC Stepper motor PRECAUTIONS D
103. ure the reference search algorithm to meet your needs chapter 4 4 3 The reference search can be started stopped and the actual status of the reference search can be checked Internal function the reference search is implemented as a state machine so interaction is possible during execution Related commands WAIT Mnemonic RFS lt START STOP STATUS gt motor Binary representation INSTRUCTION NO TYPE MOT BANK VALUE O START start ref search 0 13 1 STOP abort ref search see below 2 STATUS get status REPLY IN DIRECT MODE When using type O START or 1 STOP STATUS VALUE 100 OK don t care When using type 2 STATUS STATUS VALUE 100 OK 0 ref search active other values no ref search active Example Start reference search of motor O Mnemonic RFS START 0 Binary Byte Index 0 1 2 3 4 5 6 7 Function Target Instruction Type Motor Operand Operand Operand Operand address Number Bank Byte3 Byte2 Bytel Byte Value hex 01 0d 00 00 00 00 00 00 With this module it is possible to use stall detection instead of a reference search www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 3 6 14 SIO set input output SIO sets the status of the two general purpose digital outputs either to zero 0 or to one 1 Bank 2 is used fo
104. us master will send a command to the TMCM 1140 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 CAN USB 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 commands 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
105. use a normal USB cable Download and install the file TMCM 1140 inf www trinamic com Pin Label Description 1 VBUS 5V power 2 D Data 3 D Data 4 ID ground 5 GND ground 2 Connect In Out connector If you like to work with the GPIOs or switches use the In Out connector Pin Label Description 1 GND System and signal ground 2 VDD VDD connected to VDD pin of the power and communication connector 3 OUT 1 Open drain output max 1A a Integrated freewheeling diode to VDD 4 OUT 0 5V supply output max 100mA Can be switched on off in software Dedicated analog input 5 AIN 0 Input voltage range 0 10V Resolution 12bit 0 4095 IN 0 General purpose digital input 24V compatible 6 STOP IL Alternate function 1 left stop switch input ENC A Alternate function 2 external incremental encoder channel A input IN 1 General purpose digital input 24V compatible 7 STOP R Alternate function 1 right stop switch input ENC B Alternate function 2 external incremental encoder channel B input IN 2 General purpose digital input 24V compatible 8 HOME Alternate function 1 home switch input ENC N Alternate function 2 external incremental encoder index zero channel input 3 Connect the motor Pin Label Description 1 OB2 Pin 2 of motor coil B 2 OB1 Pin 1 of motor coil B 3 OA2 Pin 2 of motor coil A 4 OA1 Pin 1 of motor co
106. with axis parameter 182 Sets the distance between the lower and the upper threshold SG170 smartEnergy hysteresis for stallGuard2 reading Above the upper threshold the motor current becomes decreased Below this speed motor will not be stopped Above this speed SG181 Stop on stall motor will stop in case stallGuard2 load value reaches zero V182 smartEnergy threshold speed Above this speed coolStep becomes enabled T214 aa Standstill period before the current is changed down to standby current The standard value is 200 value equates 2000msec For further information about the coolStep feature please refer to the TMC262 Datasheet www trinamic com TMCM 1140 TMCL Firmware V1 27 Manual Rev 1 04 2015 JAN 05 72 4 3 Reference Search The built in reference search feature instruction RFS no 13 offers switching point calibration and supports up to two end stop limit switches and one home switch Depending on the selected reference search mode see table below one of the limit switches or the home switch may be used as reference switch and the end limit switches are either respected or ignored during the reference search The internal operation is based on a state machine that can be started stopped and monitored at any time during the reference search operation instruction RFS no 13 REMARKS ON REFERENCE SEARCH OPERATION End limit switches enable disable of the automatic stop function
Download Pdf Manuals
Related Search
Related Contents
OPC-VG1-CCL - Fuji Electric GmbH UT-3100 American Standard 1660144.002 Installation Guide 2 - プレジデント社 Uniform Pro Version 1 CONJUNTOS SINTETIZADOS 取扱説明書 保証書付 ガスBFふろがま - ご家庭のお客さま Fiche pratique « Localiser votre projet Copyright © All rights reserved.
Failed to retrieve file