Trinamic 11-0011 TMCM-171 BLDC Output For 3-phase BLDC Motors 11-0011 数据表

产品代码
11-0011
下载
页码 134
 
TMCL Reference Manual 
 
 
 
Trinamic Motion Control GmbH & Co KG 
Sternstraße 67 
D – 20357 Hamburg, Germany 
http://www.trinamic.com 
 
2  Basic TMCL Concepts 
2.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 RS232 or RS485 interface, it has to be enclosed by an address byte 
at the  beginning and a  checksum byte at the end. So it then consists of nine  bytes. This is not the case when 
communicating via the CAN bus as address and checksum are included in the CAN standard in do not have to be 
supplied by the user. 
When using a module with IIC interface the first byte (address byte) is left out because IIC has its own addressing 
scheme. So for IIC the telegram consists of eight bytes, starting with the command byte. 
So the binary command format when using RS232 or RS485 is as follows: 
Bytes  Meaning 
Module address 
Command number 
Type number 
Motor or Bank number 
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). When using IIC, leave out the first byte. 
2.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