Shop OBEX P1 Docs P2 Docs Learn Events
1-wire Problem - Reading a specific Address — Parallax Forums

1-wire Problem - Reading a specific Address

bdickensbdickens Posts: 110
edited 2010-09-07 06:43 in Propeller 1
I've got a program that is reading a couple of 1-wire sensors. Ultimately, there will be 8 on the line, but I've only got 2 connected for now. Using a lot of different code sources, I've got a program that does most of what I want with 1 major obstacle (and a nit)

I will have 4 temperature sensors. So I need to be able to store their results in the correct bucket (airtemp, watertemp etc). I can't seem to get MATCHROM to work. Micah Dowty's seems to work but I can't replicate it.

Code included and at the end are the PST output so you can see it with addr (micah style) and RevAddr (lsb corrected). The routine that is the issue is GETDATA. The first parts all seem to work correctly.

(the nit is the ugly 64bit comparison which surely can't be the best way to do this)



Thanks

Comments

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-09-05 04:08
    You might take a good look at Dallas Semi and what they offer in 1-wire driver/master ICs.

    The iButton and other slave units seem to work well with micro-controllers when one is attached. But as you start to add more and more, the requirements for timing become tighter and tighter. It seems that you end up having to use their driver chips to get larger networks running right.

    Reading the specific address is a general indicator of the networks good health. With the CRC function, it confirms that all units are happily on line. Other functions may seem to work, but be sending errors that you have no basis to question.

    I have a TINI400 board from Dallas Semi that uses their drivers and works fine with 1-wire networks (because they built it themselves with their drivers). But it programs in a subset of Java and that is a whole additional learning curve.

    Also, the 1-wire network generally works well with +5 volts, being driven at 3.3 volts has a reputation for marginal results.
  • bdickensbdickens Posts: 110
    edited 2010-09-05 11:58
    Good thoughts. I am powering it with 5V normally and one sensor needs 12 so I've got both sets running to the devices. 5 normal, 12 for those who need it.

    The part thats funny is that if I run Jon McPhalen's 1-wire or anyone elses, the devices respond to a read but they both work with one device (except Micah Dowty) so I'm obviously down to something I am not putting on the network correctly.

    Thanks
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2010-09-06 01:40
    I was guessing you were working exclusively with one type of 1-wire product. The whole problem becomes more complex if you are mixing several kinds as Dallas Semi created a standard for timing and voltages, then 'adapted' it in rather creative ways to accommodate more ambitious 1-wire and iButtons.

    If you are using the temperature 1-wire devices, there are two options to power the slaves. And the documentation for active pull-up circuits have been revised and revised again to the point that I've no idea which examples would really work - other than using their in-house driver/master chips (which are the late-comers to fix problems).

    I've done a lot of reading at there website and others in consideration of using 1-wire networks in greenhouses and pig farms. Unless you are knowledgeable (and equipped) in wire network impedance matching (something that is usually applied to coax cable networks and antenna feeds), it just seems easiest to use their chips and keep the networks close to their ideal configurations.

    On the internet there is a huge divide between those that love 1-wire and have had excellent results and those that curse the day they tried them. I suspect that those without the equipment and education to make long wire networks work form the latter.
  • bdickensbdickens Posts: 110
    edited 2010-09-06 15:26
    All one type. But again, I'm getting temperature from all of them if I loop through so my default position is to try it that way. But it would be a lot easier if I can ask the sensor I need what the value is.

    Thanks
  • JonnyMacJonnyMac Posts: 9,209
    edited 2010-09-06 16:12
    The attached demo shows how to read the temperature from a known device.
  • bdickensbdickens Posts: 110
    edited 2010-09-07 06:43
    Ah ha. Perfect. Thanks. That made it clear. I have some rewriting to do and your address storage method was a whole lot more elegant than mine.

    Thanks for posting that.
Sign In or Register to comment.