Main Site Documentation

Onewire CRC


Trying to use the onewire CRC function.

byte[] data;
UInt16 CRC;
ow.Read(data, 0, 34);
CRC = OneWire.CalculateCRC(data, 0, 32);

When I run this code, it seems to generate an 8 bit CRC instead of 16 bit. Not sure though and wanted confirmation as to what it generates. Can’t seem to find this info in the docs.



The one wire CRC is 8-bit so I am nto sure why you are looking for 16-bit
See this


You can also see it in the libary documentation

Here is the syntax

public static byte CalculateCRC(
byte[] buffer,
int offset,
int count

You see the return value is 8 bit not 16 bit


I am looking for a 16bit CRC because reading a page of memory from an iButton such as the Thermochron can provide a 16bit CRC for you to use to verify the data transmitted. That is why my code example reads a total of 34 bytes instead of the page size of 32.

I suppose I’ll have to find or write a function for this.

Thanks for the clarification.


I think this 16-bit CRC is new. We will ad this to our to do list
Here is some info


It’s not new as the iButtons with memory such as the Thermochron have had this CRC 16 method for many years. As I’ve stated in other posts, I’ve been tinkering with these things using other platforms such as the Primer2(STM32 based) device. I now await the Fez Cobra to be my savior if the price is right. If not, I think I can still complete my project with the Domino just with limited bells and whistles.

Thanks for considering adding this function!