Go Down

Topic: 1-Wire, DS18B20... How do I search the bus? (Read 22 times) previous topic - next topic

Rusty in Texas

#10
Apr 28, 2009, 03:11 am Last Edit: Apr 28, 2009, 03:15 am by Fe2o3Fish Reason: 1
Ward,
   I've dumped 4 1820's and 2 18B20's onto my Arduino.  I'm having no
problems with the search algorithm although search() is only called
after a system reset/powerup.  Parasitic power is NOT used and the
data line has a 4k7 ohm resistor pulling it up to +5v.

Ward

I have now commented out line 268 as suggested by Waffle, deleted the OneWire.o file to cause a recompile, and tested the revised code with seven devices. It works.

For those who might want to duplicate this fix, here is a print out of the area in question with the commented line in place.

 263                } else {                            // we are blazing new tree, take the 0
 264                  a = 0;
 265                  searchJunction = i;
 266                  done = 0;
 267                }
 268                // lastJunction = i;
 269            }
 270            if ( a) address[ ibyte] |= ibit;
 271            else address[ ibyte] &= ~ibit;

Rx

I had the same problem as soon as I added a 6th device to my prototype DS18B20 network (parasite powered). Only 2 devices were affected; as soon as I removed either of them, the search function worked properly. The symptom of the problem was a search that endlessly cycled between device 28 C6 and 28 5E

My devices (all values in hex):

28 78 09 06 02 00 00 92
28 1C 23 02 02 00 00 C6
28 C6 0D 06 02 00 00 99 <-- remove either device 28 C6
28 5E FB 05 02 00 00 3B <-- or device 28 5E for search to work
28 01 47 02 02 00 00 D9
28 D9 FF 05 02 00 00 4B

Once I commented out line 268 and recompiled the OneWire library, all devices work fine.

Rx

pwillard


beduino

This is great, I was stuck with the same problem: I could connect the AAG weather station (3 sensors) but when i tried to add one more ds18s20 the search program got in a loop.
Thank you for the detailed solution.

Go Up