LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange 16 bit CRC check

Solved!
Go to solution

Hi,

   So I am working with what appears to be a non-standard 16 bit CRC check. I have searched over the forums, and found many great examples of how to do this. I have enclosed the one that I am using at the moment. It seems to work just fine. I went to the website https://www.scadacore.com/tools/programming-calculators/online-checksum-calculator/

and it matches what the CRC check seems to be outputting, with the same set of data. However, this does not match what the system is outputting for a CRC-check. So with the following data set: 2000 5555 5555 5555 5555 5555 5555 5555 5555 5555 5555 5555 5555 5555 5555 5555 5555 5555 AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA 5555 5555 5555 5555 5555 5555 5555 AAAA 5555 5555 AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA 5555 5555 AAAA AAAA AAAA AA55 5555 5555 5555 5555 5555 5555 5555 AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA 5555 5555 5555 5555 5555 5555 5555 AAAA AAAA AAAA AAAA AAAA AAAA 5555 AAAA 5555 AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA 5555 AAAA AAAA 5555 5555 5555 5555 5555 5555 5555 AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA AA55 AAAA AAAA 5555 5555 5555 5555 5555 5555 5555 5555 5555 5555 5555 5555  can anyone see how it might be able to produce an output of " 901C h" ? Is there some additional math gyration that I might be missing? Thanks...

0 Kudos
Message 1 of 8
(2,596 Views)

From my experience with this forum, I know there are a lot of related posts out there.  I Googled "CRC-16 LabVIEW" and I think probably almost all of the hits will be useful.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 8
(2,576 Views)

What instrument are you trying to communicate with?  Is there example code supplied giving more details on how the CRC is calculated?  There are just way too many variables to be just guessing.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 8
(2,559 Views)

Not trying to be cryptic on purpose. There might not be an easy solution to this one. I might see if I can get more information from our software team about it. I thought I would put it out to the forum, to see if the solution might be something obvious that I have overlooked.

 

I was told that it is an IBM CRC 16 style check. And that I would need to use "A001 or 8005" polynomial depending on big or small endian (which I am using). The answers that I am getting seem to match the online stuff, but not what the SW folks are telling me. 🙂

0 Kudos
Message 4 of 8
(2,551 Views)
Solution
Accepted by topic author Z4CRUZN

As with so many things in engineering, the devil is in the details. So I have found what the issue was, I will list it here just in case others may run into this at some later time. As it turns out, the SW team decided to reverse all of the bytes before they get calculated in the CRC checker. So "6D" becomes "76". Once I added this to my code, and changed the polynomial to 8005. Works perfectly. Thanks again to everyone... 🙂

Message 5 of 8
(2,539 Views)

Ah hah!

 

The NUXI problem.

 

Spoiler

 

Since I can not seem to find anything via Google that tells the original story, I will report what I was told about the origin of that term.

 

Old computers used to use a line printer as the user interface and when an operating system started, the first thing that would be printed was the OS name and the version number.

 

That applied to Unix as well. Unix was originally develop on a DEC PDP 11-40 (may have been a 11-70 but I am sticking 11-40 for now). It ran great and it was not long until they made an attempt to port UNIX to an IBM machine. When they stated it up the first time it did the normal "Flying the banner" and printed out the OS was NUXI. DEC addressed bytes within a 16 bit word with the low byte first while the IBM machines considered the High byte the first byte.

 

 

 

Done with the old time trivia (for now)

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 8
(2,529 Views)

I once worked on a project where our PC had to talk to a UNIX box via serial, and we had the same byte order issue.  Fortunately someone had been kind enough to note the byte order in the documents.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 8
(2,496 Views)

@billko wrote:

I once worked on a project where our PC had to talk to a UNIX box via serial, and we had the same byte order issue.  Fortunately someone had been kind enough to note the byte order in the documents.


Exactly why I much prefer the Flatten To String and the Unflatten From String functions: you can choose the Endianness (byte order).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 8
(2,472 Views)