PDA

View Full Version : 1 Wire Search Routine



Dave
- 30th June 2004, 20:31
A while back I wrote a bit of code to search a 1 WIRE BUS to find the device rom numbers and store them into ram for future use. Attached is the basic routine I used based on the application notes form Dallas Semiconductor. The storage array can be made larger or smaller as you wish. I have successfully been able to locate upto 32 nodes made up of 5 different types of Dallas products. The only thing needs to be added to the program are the LCD Defines. This was written for a 2 X 40 display connected to a 18F452 @ 40 Mhz. After looking at how many times the attached routine was downloaded I decided to put it in the software section. Hope this helps you 1 wire guy's....

Dave Purola, N8NTA

mikebar
- 3rd March 2016, 12:38
Hi, I've no experience in getting the info from more than one sensor, but I've found some other approach to the DS18B20.
Seems that:


Temp VAR WORD
ID VAR BYTE[8] '64 bit memory array

OWOUT Pin, 1, [$33] 'This read the internal eeprom of the sensor
OWIN Pin, 0,[STR ID\8] 'Save the result into a 8 byte array

SELECT CASE ID[0]
CASE $28
'a DS18B20 has been found

CASE $10
'a DS18S20 has been found

END SELECT

OWOUT Pin, 1, [$CC, $44] ' Jump the ROM and convert
PAUSE 900 ' Give enough time for conversion (you could reduce it using 10 bit resolution)
OWOUT Pin, 1, [$CC, $BE]' Jump the ROM and read
OWIN Pin, 2, [Temp.Lowbyte, Temp.Highbyte] ' Read 2 bytes

As said I've not experience in using more than one of those sensor, but probably there is a way to choose wich one using the data of the internal EEPROM.
If you get some result, please post your experience for future use.

Heckler
- 3rd March 2016, 16:13
There might be something of use for you here...
http://www.picbasic.co.uk/forum/content.php?r=374-How-to-read-a-one-wire-DS18B20-temperature-sensor-or-nine-of-them

iw2fvo
- 4th March 2016, 08:39
thanks everybody for the assistance.
I suggest the indication provided by Heckler:
http://www.picbasic.co.uk/forum/cont...r-nine-of-them

Thanks again.
Ambrogio