It is possible to load a TMCL file onto a Trinamic module.
First of all, you will have to assemble your program using the TMCL-IDE and save the result as a binary file. To do that, choose "Options" in the menu "TMCL" of the TMCL Creator. There, switch on the option "Write output to binary file". Now, assemble your program, and the result will be saved in a binary file. The file will have the same name as your TMCL file, but with the extension ".BIN". This file contains all the TMCL commands of your program in binary format. Each command is saved as eight bytes: it is the command without the module address.
Now there two options:
Option 1:
In your application, do the following things:
- Send command 132 (enter download mode), with type, motor/bank and value set to 0.
- Open the binary file.
- Read eight bytes from the file.
- Add the module address of your module (in most cases 1) to the eighth byte (so that the check sum is correct).
- Send the module address (in most cases 1) and the eight bytes to the module.
- You will get a reply with (9 bytes) with the status set to 101 (which means that command has been stored in the EEPROM).
- If you are not at the end of the file then go to step (3).
- Send a command opcode 0 to the module (with module address 1 this would be 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x01). This is just an end marker for the disassembler in the TMCL-IDE.
- Send command 133 (exit download mode), with type, motor/bank and value set to 0.
This is all. You can check if it works by using the Disassemble function of the TMCL-IDE.
If you have jump commands with labels you can additionally activate the "Generate a symbol file" option within the TMCL Options menu. In addition after assembling the program a .sym file will be generated that lists the labels with addresses you can use for your own program to jump to the corresponding label.
Or if you just would like to send a few commands, without jump commands (so that you do not need the assembler), then you can just send command 132, then send your commands, and then send command 133. After that, send command 129 to start the program.
Option 2:
We also have a small program that only downloads such a file (TMCLDownload.exe attached). With this program you can either download such a binary file manually, or the program can also be called with appropriate command line options on another program (which will simplify the process). Please note, it only supports the download via RS232, RS485 or USB.