User Manual

TMCM-3230 TMCL
Firmware Manual Firmware Version V1.07 | Document Revision V1.05 2017-OCT-10
10 / 103
TMCL Command Format
Bytes Meaning
1 Module address
1 Command number
1 Type number
1 Motor or Bank number
4 Value (MSB rst!)
1 Checksum
Table 1: TMCL Command Format
Info
The checksum is calculated by accumulating all the other bytes using an 8-bit
addition.
Note
When using the CAN interface, leave out the address byte and the checksum byte.
With CAN, the CAN-ID is used as the module address and the checksum is not
needed because CAN bus uses hardware CRC checking.
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 which show how to do this:
Checksum calculation in C:
1
unsigned char i, Checksum;
unsigned char Command [9];
3
//Set the Command array to the desired command
5
Checksum = Command [0];
for(i=1; i <8; i++)
7
Checksum += Command[i];
9
Command [8]= Checksum; // insert checksum as last byte of the command
//Now , send it to the module
Checksum calculation in Delphi:
var
2
i, Checksum : byte;
Command: array [0..8] of byte;
4
//Set the Command array to the desired command
6
//Calculate the Checksum:
8
Checksum := Command [0];
for i:=1 to 7 do Checksum :=Checksum + Command[i];
10
Command [8]:= Checksum ;
//Now , send the Command array (9 bytes) to the module
©2017 TRINAMIC Motion Control GmbH & Co. KG, Hamburg, Germany
Terms of delivery and rights to technical change reserved.
Download newest version at www.trinamic.com