![Trinamic TMCM-351 Firmware Manual Download Page 12](http://html1.mh-extra.com/html/trinamic/tmcm-351/tmcm-351_firmware-manual_1163054012.webp)
TMCM-351 TMCL Firmware V4.45 Manual (Rev. 1.06 / 2014-MAY-16)
12
www.trinamic.com
Bytes Meaning
1
Module address
1
Command number
1
Type number
1
Motor or Bank number
4
Value (MSB first!)
1
Checksum
-
The checksum is calculated by adding up all the other bytes using an 8-bit addition.
-
When using the CAN bus, just leave out the first byte (module address) and the last byte (checksum).
4.1.1
Checksum Calculation
As mentioned above, the checksum is calculated by adding up all bytes (including the module address byte)
using 8-bit addition. Here are two examples 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<8; i++)
C=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:=CCommand[i];
Command[8]:=Checksum;
//Now, send the “Command” array (9 bytes) to the module
4.2
Reply Format
Every time a command has been sent to a module, the module sends a reply.
The reply format for RS485, RS232, and USB is as follows:
Bytes Meaning
1
Reply address
1
Module address
1
Status (e.g. 100 means
no error
)
1
Command number
4
Value (MSB first!)
1
Checksum
-
The checksum is also calculated by adding up all the other bytes using an 8-bit addition.
-
When using CAN bus, the first byte (reply address) and the last byte (checksum) are left out.
-
Do not send the next command before you have received the reply!