LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

crc checksum calculation

Hi,

   I am new to LabView ...I want to create vis for automatic control of instrument...I am really need help in crc checksum calculation....i have an example

  slave address 0x08

function code   0x06

register adress 0x0001

Register data 0x1388

checksum 0xD5C5

  I would like to get checksum above one from the above mentioned data..How to create this vi can any one help please......

maheshk
0 Kudos
Message 1 of 5
(3,221 Views)

Hi maheshk,

 

you really should read the manual of your "instrument". Somewhere hidden in there should be an explanation on how to calculate that checksum!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(3,203 Views)

HI GerdW,

   Thanks for the reply ....i found a programming code for that..i would like to have vis for that programme accordingly..i tried out in many ways but couldnt...here i have attached the document of code...please look into it ..and i would like to get the above check sum mentioned in the  above post..

 Thanking you...

maheshk
0 Kudos
Message 3 of 5
(3,176 Views)

Hi Maheshk,

 

your rtf as simple text looks like that:

Data meaning :data frame CrC checkupsum, using 2 bytes.
Checksum =address +functioncode+data
CRC computation program:
unsigned int cal_crc16 (unsigned char*data,unsigned int length)
{
unsigned int i,crc_result = 0xffff;
while(length--)
{
crc_result^=*data++;
for(i=0,i<8;i++)
{
if(crc_result&0x01)
crc_result=(crc_result>>1)^0xa001;
else crc_result=crc_result>>1;
}
}
crc_result=((crc_result&0xff)<<8)|(crc_result>>8);
return(crc_result);

This is just basic bit/boolean operations (AND, OR, XOR, shift). Try to code that in LabVIEW, it's a good exercise...

Post what you got and we will help, when problems arise!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(3,172 Views)

Or search for crc16!

Spoiler

CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 5 of 5
(3,165 Views)