PDA

View Full Version : enumerate 1wire bus



justDIY
- 17th June 2004, 05:14
Is it possible (ie, can someone please share an example) to enumerate a 1-wire bus using pbp?

example, I have a 1-wire bus consisting of qty X (unknown number of sensors, unknown serial numbers) temperature sensors, qty 1 8 port gpio (known qty, unknown serial number)


I have example code that spits out the address of a single connected device, and using that, I could hard code the pic to talk to specific devices, but what if down the road I need to swap out a probe or add more ... is there a way to automate probe finding and reading?


Gordon

MKP
- 26th June 2004, 04:08
Check out this example: http://www.rentron.com/PicBasic/PBP1-wire.htm

Mike

justDIY
- 26th June 2004, 08:21
thanks for the link.... been there, read that :)

all the 1-wire examples I find either rely on having only a single 1 wire device present, or predetermining the individual addresses.

seeing that the 1-wire bus could technically support 100's (if not more) of devices, there must be some way to programmaticly identify each device on the bus.

the datasheet talks about a "process of elimination" search;
basicly, asking all the devices to indentify themselves repeatedly, and shifting through the 64 address bits until you find an address to which only 1 device answers... then store that address, and start the whole process over!

MKP
- 26th June 2004, 21:09
I'm fairly sure that this is what the code does. Here is the explanation of the code that is on the link posted.


<Snip> http://www.rentron.com/PicBasic/PBP1-wire.htm

This project shows how to identify each 1-wire device prior to inserting them into the 1-wire network. By identifying each component you'll know the unique 64-bit ROM code for each 1-wire device, and be able to talk to individual components on your 1-wire network as necessary. You can use the 1-wire command Search ROM [$F0], but this doesn't tell you where each device is physically located on the 1-wire network. It only identifies all components on the network

<snip>

Dave
- 27th June 2004, 14:02
justDIY, 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. Hope this helps....

Dave Purola, N8NTA

justDIY
- 29th June 2004, 06:35
Thanks Dave!

I'm working with picbasic plus now, so I had to change a few things in your code

I had a nice long reply typed up and then the board ate it, something about too many pictures in my signature?!

anyway

I compiled it successfully after ironing out some code differences and downloaded it to the pic, its been going for several min now with no output

how long should this thing take to execute?

Dave
- 30th June 2004, 19:19
Justdiy, It should only take about .2 seconds for each node found as far as gathering the data over the 1 WIRE BUS. I don't however know what you are talking about as the code is written and compiled with PBP 2.45. Opps, My mistake PicBasic Plus is from some other manufacture. The program as attached only needs the LCD Defines to work and I have had it find on a single wire bus upto 32 devices of 5 diferent types.

Dave Purola,