Shop OBEX P1 Docs P2 Docs Learn Events
Dallas DS18b20 CRC code — Parallax Forums

Dallas DS18b20 CRC code

VonSzarvasVonSzarvas Posts: 3,527
edited 2007-09-12 22:55 in General Discussion
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... roll.gif

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

  • PJMontyPJMonty Posts: 983
    edited 2007-09-10 23:56
    Max,

    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
  • David BDavid B Posts: 592
    edited 2007-09-12 22:49
    I got the floppy disk raw sector CRC calculation working in Spin.

    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
  • VonSzarvasVonSzarvas Posts: 3,527
    edited 2007-09-12 22:55
    I will check it, thanks for the tip. When I get it running I will post the code here - so check back if you ever need it!!

    Regards, Max.
Sign In or Register to comment.