# Motor Control ICs Forum Discussions Level 2   Level 2

# Imotion IMC 101T Checksum calculation formula

Hi,

Someone Pl clarify how to calculate Checksum For user Uart Communication. AS per Imotion Software user Manual.

2.3.5 Checksum
Checksum is 16-bits and calculated as mentioned below:
[Command: Node address] + Data Word 0 + Data Word 1 + Checksum = 0x0000
Example Checksum calculation:
Input: Node address =1, command =2, Data Word 0 = 0x1122 and Data Word 1 = 0x3344
Checksum = -1*(0x0201+0x1122+0x3344) = 0xB999

As per example transfer data  = { 0x01, 0x05, 0x01, 0x7D, 0x00, 0x00, 0xFE, 0x7D};

my understanding of formula

1st step = (ox0501+ox017D+ox0000) =067E

2nd step (FFFF- 067E)+1  = F982 is check sum

but  in Example checksum is   0xFE, 0x7D.

Can someone Guide what  I am Doing Wrong?

Thanks

1 Solution Moderator    Moderator

# Re: Imotion IMC 101T Checksum calculation formula

Hi @sohail,

As per example transfer data  = { 0x01, 0x05, 0x01, 0x7D, 0x00, 0x00, 0xFE, 0x7D};

1st step = (ox0501+ox017D+ox0000) =067E

Data is stored in little endian format as per example data the word will be 0x0501, 0x7D01 and 0x0000.

In the above calculation given by you the second word was taken wrongly.

First Step : 0x0501 + 0x7D01 + 0x0000 = 0x8202

2nd step (FFFF- 067E)+1  = F982 is check sum

Second Step: 2's Complement ( 0x8202) = 0x7DFE

storing in little endian format checksum will be 0xFE and 0x7D

Please let us know if any further details is required

Thanks,

Krupashankar Moderator    Moderator

# Re: Imotion IMC 101T Checksum calculation formula

Hi @sohail,

As per example transfer data  = { 0x01, 0x05, 0x01, 0x7D, 0x00, 0x00, 0xFE, 0x7D};

1st step = (ox0501+ox017D+ox0000) =067E

Data is stored in little endian format as per example data the word will be 0x0501, 0x7D01 and 0x0000.

In the above calculation given by you the second word was taken wrongly.

First Step : 0x0501 + 0x7D01 + 0x0000 = 0x8202

2nd step (FFFF- 067E)+1  = F982 is check sum

Second Step: 2's Complement ( 0x8202) = 0x7DFE

storing in little endian format checksum will be 0xFE and 0x7D

Please let us know if any further details is required

Thanks,

Krupashankar 