cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating Odd CRC

SOLVED
MikeMack747
Member
Solved!

Calculating Odd CRC

Message contains an attachment

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

 

17 REPLIES 17
Trusted Enthusiast

Re: Calculating Odd CRC

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

 

sunaenae
Member

Re: Calculating Odd CRC

Message contains a hyperlink

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
Highlighted
MikeMack747
Member

Re: Calculating Odd CRC

I'm using LabVIEW 2013 Service pack 1.

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

nathand
Proven Zealot

Re: Calculating Odd CRC

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.

MikeMack747
Member

Re: Calculating Odd CRC

Message contains an attachment

Here it is in LV 2012

Bob_Schor
Knight of NI

Re: Calculating Odd CRC

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)

MikeMack747
Member

Re: Calculating Odd CRC

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

MikeMack747
Member

Re: Calculating Odd CRC

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)

MikeMack747
Member

Re: Calculating Odd CRC

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