enumerate 1wire bus


Closed Thread
Results 1 to 7 of 7
  1. #1
    justDIY's Avatar
    justDIY Guest

    Default enumerate 1wire bus

    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

  2. #2
    MKP's Avatar
    MKP Guest


    Did you find this post helpful? Yes | No

    Default

    Check out this example: http://www.rentron.com/PicBasic/PBP1-wire.htm

    Mike

  3. #3
    justDIY's Avatar
    justDIY Guest


    Did you find this post helpful? Yes | No

    Default

    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!

  4. #4
    MKP's Avatar
    MKP Guest


    Did you find this post helpful? Yes | No

    Default

    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>

  5. #5
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    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
    Attached Files Attached Files

  6. #6
    justDIY's Avatar
    justDIY Guest


    Did you find this post helpful? Yes | No

    Default

    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?

  7. #7
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default

    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,

Similar Threads

  1. RS485 bus - starting probem
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th January 2010, 13:35
  2. Communicating between two PICs over DC bus
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th May 2009, 12:57
  3. Need the code to write to a memory
    By Hamlet in forum General
    Replies: 0
    Last Post: - 20th August 2007, 00:22
  4. Compass module and I2C bus
    By vladimir059@hot in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 26th December 2006, 20:29
  5. Two pics in a I2C bus?
    By robert0 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 4th January 2006, 13:44

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts