LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need a vi to calculate crc8 from the Polynomial x8 + x7 + x6 + x4 + x2 + 1 (D5)

Hi there.
 
I need a vi to calculate crc8 from the polynomial x8 + x7 + x6 + x4 + x2 + 1.
 
Is it possible to find one that is ready for use?
 
I have found a one example of an 8 bit crc vi, but it is not using the specific polynomial that I need, and I don't know enough about crc to modify it...
 
Hope you can help.
 
Chuck.
0 Kudos
Message 1 of 12
(8,269 Views)


@ChuckNorris wrote:
I have found a one example of an 8 bit crc vi, but it is not using the specific polynomial that I need, and I don't know enough about crc to modify it...


What do you mean by crc vi ? Where did you find it in LabVIEW ?

What version of LV are you using ?

- Partha ( CLD until Oct 2024 🙂 )
0 Kudos
Message 2 of 12
(8,259 Views)
I am using LabVIEW 8.20.
 
By crc vi I mean a vi that can calculate the crc (cyclic redundancy code) checksum byte from a hex-string or a byte array.
0 Kudos
Message 3 of 12
(8,255 Views)

I did not find anything in LabVIEW, but I found a llb file in this forum that contains a vi for doing crc calculations.

I attached it to this message.

0 Kudos
Message 4 of 12
(8,253 Views)
Hi!
   Once I had to calculate CCITT CRC-16, of polinomial x^16 + x^12 + x^5 + X^0, and I didn't find a vi.  So I decided to use a Formula Node, and translate a C-program which you can almost easily find for computing CRCs.

   If you want, I can post my code (both LabVIEW and C).

   You can use also Code Interface Node.  I just used Formula node because I'm more used to...

   The only problem is the optimization: I've an un-optimized C code.  If you need speed, you can use table-based C code, but I'm not familiar with it.

   Hope I can help you, please let me know how I can...

   Have a nice day!

graziano
0 Kudos
Message 5 of 12
(8,252 Views)

Hi graziano.

I would love to see your code!

Speed is not critical as the crc calculation is only perfomed on a small amount of data and not very often.

Chuck.

 

0 Kudos
Message 6 of 12
(8,249 Views)
I'm back in a minute!
0 Kudos
Message 7 of 12
(8,242 Views)
Hi!

   This is my simple formula node, note that:
    
     CRC initial value is 0xFFFF (according to standard I'm using);
  
    The final result of computation must be bit-wise inverted (one's complement, also defined in the standard I'm using)

     The polynomial is inserted as 0x8408, which is (x^16 omitted....) + X^12 + x^5 + x^0, swapped (bit15 goes to bit 0, bit 14 to bit 1 ... bit 8 to bit 7...).

    As you know, there're many parameters in CRC calculation, inversion, initial register value, one's complement of the result or not....

    Have a nice day!

graziano
Message 8 of 12
(8,237 Views)
Just let me say taht Data_validation_functions.llb is quite interesting, Thanks for it, I'll check it!

graziano

PS.: I think that the CCITT crc function in Data_validation_functions.llb misses 0xFFFF initialization.... but I've to check.
0 Kudos
Message 9 of 12
(8,233 Views)

I probably won't get to it today, but thanks for the file!

Crc is a pretty tricky subject...

0 Kudos
Message 10 of 12
(8,230 Views)