キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Calculating Odd CRC

解決済み
解決策を見る

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

 

すべてをダウンロード
メッセージ1/18
6,126件の閲覧回数

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

 

0 件の賞賛
メッセージ2/18
6,084件の閲覧回数

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 件の賞賛
メッセージ3/18
6,035件の閲覧回数

I'm using LabVIEW 2013 Service pack 1.

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

0 件の賞賛
メッセージ4/18
5,973件の閲覧回数

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 件の賞賛
メッセージ5/18
5,963件の閲覧回数

Here it is in LV 2012

0 件の賞賛
メッセージ6/18
5,958件の閲覧回数

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 件の賞賛
メッセージ7/18
5,944件の閲覧回数

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 件の賞賛
メッセージ8/18
5,938件の閲覧回数

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 件の賞賛
メッセージ9/18
5,935件の閲覧回数

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

0 件の賞賛
メッセージ10/18
5,932件の閲覧回数