Dallas DS18b20 CRC code
VonSzarvas
Posts: 3,527
Hello all,
With the help of several resources, including this forum post http://forums.parallax.com/showthread.php?p=574938 and some code examples by Mike Cook, I have an SX28 (SX/B) running some DS18b20 1-wire temperature sensors. The temperature streams into Hyperterminal perfectly!
Now I would like to add CRC checking. The DS18b20 datasheet explains some theory about CRC. I admit, I cannot understand it. There are many examples found on Google, but sadly for other platforms and languages. Dallas themselves do not offer assistance with the best chips, just some others...
Does anyone on this forum have a sample code or link that they have previously used ?
I guess even if its in PBasic/Stamp basic, I could likely translate it. So any pointers gratefully received.
Thank you for looking!
Max.
With the help of several resources, including this forum post http://forums.parallax.com/showthread.php?p=574938 and some code examples by Mike Cook, I have an SX28 (SX/B) running some DS18b20 1-wire temperature sensors. The temperature streams into Hyperterminal perfectly!
Now I would like to add CRC checking. The DS18b20 datasheet explains some theory about CRC. I admit, I cannot understand it. There are many examples found on Google, but sadly for other platforms and languages. Dallas themselves do not offer assistance with the best chips, just some others...
Does anyone on this forum have a sample code or link that they have previously used ?
I guess even if its in PBasic/Stamp basic, I could likely translate it. So any pointers gratefully received.
Thank you for looking!
Max.
Comments
Check out this page:
www.sxlist.com/techref/ubicom/lib/io/index.htm
Half way down you'll see a bunch of links for CRC code.
Thanks,
PeterM
Floppies use a different polynomial than the Dallas chip, and for a floppy, the accumulated value is initalized to some magic number, where Dallas specifies that their value is initialized to 0.
But maybe my Spin code can be of some help. Search the propeller forum for "Floppy", select "Floppy Drive Interface" and my code is included partway down the discussion.
David
Regards, Max.