Please help with code for DS18B20


Results 1 to 40 of 110

Threaded View

  1. #11
    Join Date
    Dec 2008
    Location
    Ploiesti, ROMANIA
    Posts
    582


    Did you find this post helpful? Yes | No

    Default

    Thank you all for reply !
    In this book : "PIC Microcontrollers: Know It All" from Lucio Di Jasio, Tim Wilmshurst, Dogan Ibrahim, John Morton, Martin Bates, Jack Smith, D.W. Smith, and Chuck Hellebuyck - witch is my inspiration , I read this :
    "Dallas Semiconductor’s 1-wire specifications define device serial numbers as 8 bytes (64 bits) long.The family code for 18B20 digital thermometer chips is $28. The CRC (cyclic redundancy code) is an error-checking feature, so that, should we desire, we may verify that the 56 bits of the family code and serial number have been correctly received and were not corrupted. We’ll not further consider how CRCs are calculated, as it’s a topic well beyond the level of this introductory book.
    When we run the program, we see the following output:
    28 4C D4 3E 0 0 0 D6
    ...
    The digits 4C D4 3E 0 0 0 D6 are, of course, dependent upon the particular DS18B20 chip.
    I plugged in a second DS18B20 chip and found its serial number:
    28 FE DA 3E 0 0 0 C1
    In the output, $28 is the family number and $D6 (or $C1 in the second example) is the CRC. The center six bytes represent the serial number of the chip. But, here’s a difference between the result and the serial number specification isn’t there? The definition has the CRC sent first and the family code sent last. Yet, Program 22.1 displays the family code first, and the CRC last.The explanation is that 1-wire devices store the least significant byte at the lower address and
    the most significant byte at the higher address. Bytes are transmitted and received from lowest address to highest address. Hence, the net effect is the send/receive byte order is reversed from the data sheet description. This is more confusing to describe than to use; when we wish to address a particular device, we just repeat the byte order we read with Program 22.1"

    So, I think it is enough for me these results.
    Next step is : Reading multiple sensors on the same bus.
    ... Wish me luck !
    I will keep you informed and - hope- I will receive yours advices again.
    All the best !
    Last edited by fratello; - 10th January 2009 at 11:26.

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

Members who have read this thread : 3

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts