I continue working with the h5 board. I leave the "light show" turned off since it interferes with my use of the GPIO pin I selected for one-wire experiments.
I add the delays from the Maxim AN126 and code up a reset function. It should return a presence bit (and does). The bit comes back "1" with nothing on the bus, which is correct.
Now I connect up my DS18B20 temperature probe and try it again. It comes back with "0" which is correct. This marks my first successful interaction with a one-wire device!!
Now I code up read/write bit/byte and send the code to
trigger a conversion and read the 9 scratchpad bytes.
I get:
Val 0: 50 - temp LSB Val 1: 05 - temp MSB Val 2: 4b - Th Val 3: 46 - Tl Val 4: 7f - config Val 5: ff - always ff (reserved) Val 6: 0c - reserved Val 7: 10 - always 10 (reserved) Val 8: 1c - CRCThis first temperature value (0x55) is the 85C value that is the power on value and prior to the first read. That I read it suggests that I didn't have a long enough delay after a start the conversion.
Val 0: c6 Val 1: 01This value (0x1c) is 28 degrees C or 82F, which is exactly right.
Raw temp = 01d2 Temp = 29C 84F
Rom 0: 28 - family code for DS18B20 Rom 1: 37 -- 48 bit serial number Rom 2: 31 -- 48 bit serial number Rom 3: e5 -- 48 bit serial number Rom 4: 58 -- 48 bit serial number Rom 5: 20 -- 48 bit serial number Rom 6: 01 -- 48 bit serial number Rom 7: 36 - CRC
I bought a 5-pack of these and am curious if they indeed have unique ROM codes.
Here is what I get from my unit 2 and unit 3 (the above is unit 1).
Rom 0: 28 Rom 1: 83 Rom 2: 0d Rom 3: cc Rom 4: 58 Rom 5: 20 Rom 6: 01 Rom 7: ab Rom 0: 28 Rom 1: f9 Rom 2: f8 Rom 3: bb Rom 4: 58 Rom 5: 20 Rom 6: 01 Rom 7: a6So indeed, the 3 units I tested (of my 5) all show unique ROM codes. I am honestly somewhat surprised. I expected these to be Chinese clones, not genuine Dallas parts, and thought that it was unlikely that they would perform the laser surgery to set up unique ID codes on each chip.
Tom's software pages / tom@mmto.org