User manual
TMCM-1161 TMCL Firmware V1.19 Manual (Rev. 1.04 / 2012-NOV-19)  13 
www.trinamic.com   
3.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++) 
  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/RS232/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.  
Do not send the next command before you have received the reply! 










