PDA

View Full Version : Did you know that... Dallas 1-Wire search trick/work around



Heckler
- 16th February 2015, 17:29
Hey group,

Just thought I'd relate my findings with respect to the 1-wire protocol.

I have a project that uses two 1-wire devices. A DS18b20 temperature sensor and a DS2417 Real Time Clock. I needed both devices to share the same PIC pin.

So I spent much time working on the 1-wire discovery code that I found here... http://www.picbasic.co.uk/forum/showthread.php?t=3671
which actually works quite well (thanks jimbab!!)

Then after studying the different command sets for each device I realized that there was no overlap between them.

So I have tested and verified that I can still use the $CC (skip ROM) command and talk to each sensor as though it was the only one on the line because the Function command sets for each device don't overlap..

I have been able to read and write to both sensors on the same line, no problems (so far).

I was planning on using the search routine so that I could swap out 1-wire devices and have the code learn the address of the new device without my intervention. But now I don't need to.

Now keep in mind this only applies if the two (or more??) devices don't share any function commands.

I had even called Dallas/Maxim to inquire if there was a way to just specify the family code to access each device without having to include the full 64 bit ROM code. The engineer told me I would have to include the full address.

This simplifies my code quite a bit. Sweet!