LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating Odd CRC

Solved!
Go to solution

Greetings!

I've built an interface for a Sonotec bubble sensor. 

There is a detail I have not been able to solve; calculating the CRC.

The manufacturer sent me a pair of examples in script based languages, Delphi and C for the CRC calculation. (see attached .txt files)

I've made an attempt at interpreting the two examples and creating LabVIEW code (See Calc Sonotec CRC.vi)

 

I've built a brute force method that increments the CRC from 0 - FF, while checking for any return bytes.

Some commands do not return a reply, so no clue as to when my "Guess the CRC" code works on these.

 

I thank anyone who takes interest in helping me out.

Mike

 

Download All
Message 1 of 18
(4,723 Views)

I'd ask for a VB6 script. Easier to understand.

 

0 Kudos
Message 2 of 18
(4,681 Views)

Hi Mike,

 

Have you tried importing the C code from the manufacturer as a DLL and running it in LabVIEW? More details on how to do so can be found here: http://zone.ni.com/reference/en-XX/help/371361F-01/TOC74.htm

 

Regards,

Sunayna R.
Applications Engineering
National Instruments
0 Kudos
Message 3 of 18
(4,632 Views)

I'm using LabVIEW 2013 Service pack 1.

The CIN seems to have gone to be with the beep command

0 Kudos
Message 4 of 18
(4,570 Views)

The C code doesn't look that hard to duplicate. I'm still on LabVIEW 2012; if you can save your VI back to that version, I'll take a look at making it match the C source.

0 Kudos
Message 5 of 18
(4,560 Views)

Here it is in LV 2012

0 Kudos
Message 6 of 18
(4,555 Views)

The two routines are confusing (to me), and don't seem to be saying the same thing.  Maybe you can help.  What is "the buffer" -- are you always given 3 bytes, of which the first is always FE, the second is something else, and the third will become the CRC?  The Delphi code seems to suggest this, but the C code seems to have a fourth byte in there (but I'm unsure what PS means).

 

There are "standard" ways of computing CRCs -- do you know if one of these is being used?

 

Puzzled (a.k.a. BS)

0 Kudos
Message 7 of 18
(4,541 Views)

This CRC is unlike any I've ever seen. It is proprietary to the sensor interface (Sonotec)

I've set up controls to allow for as few or as many bytes of data to be included, along with a reversed array.

I occasionally get a right answer (pure chance) for one message, but I never get the right CRC for more than one message

0 Kudos
Message 8 of 18
(4,535 Views)

Four messages that I have working are as follows:

F1 00 06 32 00 1C (1C is the CRC)

F1 00 06 32 10 3C (3C = CRC)

F1 00 06 32 30 3C (3C = CRC)

F1 00 06 32 50 3C (3C = CRC)

0 Kudos
Message 9 of 18
(4,532 Views)

The "Buffer" is the incoming array of bytes, a.k.a. the message

0 Kudos
Message 10 of 18
(4,529 Views)