Send TMCL program to 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 is eight bytes: It is the command without the module address.
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.