Shop OBEX P1 Docs P2 Docs Learn Events
1-wire — Parallax Forums

1-wire

Lars50Lars50 Posts: 23
edited 2004-10-11 15:24 in BASIC Stamp
I'm using·DS 2405, a couple of them for a relay control. How do I check the status of the switch when starting up the prgrm.

OWOUT OWpin, OW_FERst, [noparse][[/noparse]$F0, STR Switch1\8]········································ 'point at a specific device·
OWIN OWpin, OW_BitMode + OW_BERst, [noparse][[/noparse]status]········································· ' read status ??
IF (status = 1) THEN· OWOUT OWpin, OW_FERst , [noparse][[/noparse]MatchROM, STR Switch1\8]· ' toggle switch if =1

It seems that I get 0 and 1 every other time when I really shoul see 0 every time.

Lars

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-26 20:01
    Because each access of the DS2405 toggles its state -- you can't read the device and NOT affect its state. What you need to do is read it at the beginning of your program, note the state, then go from there.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Lars50Lars50 Posts: 23
    edited 2004-09-26 20:07
    This was my understanding too.

    I run this as the first couple of line, to set them all as 0. This works one time and then when restarting again I get 1 and then 0 etc.

    The Search_rom should not toggle the switch, whilst Match_rom does, or?

    Lars
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-26 20:21
    According to the docs (you should have them....) the Search ROM ($F0) function does NOT toggle the DS2405, but the Match ROM ($55) always will.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Lars50Lars50 Posts: 23
    edited 2004-09-26 20:39
    I agree that's in the documentation and that was the plan.

    What's missing is how to detect the "status". Is that done the way I tried or should it be done by using the Active-Only Search ROM $EC, this should only pick out those which is low, but I guess I would need some support on the code here.

    Lars

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-09-26 20:47
    You need to do a Match ROM to get the status -- knowing full well that it will get toggled. Based on what you read back and where you want it to be, you may need to send another Match ROM command to (re)set the state.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Lars50Lars50 Posts: 23
    edited 2004-09-26 21:02
    That will work but with a blink on the relays, possible less than 0.1 sec.

    It must be diffrent way of doing this. Let's see if some of the other guys has an advise here.

    Lars
  • GadgetmanGadgetman Posts: 2,436
    edited 2004-09-27 07:40
    A friendly little tip: Toss those DS2405's out the window and replace them with DS2407 chips instead.
    Or even the DS2408 which has 8 outputs...
  • Buck RogersBuck Rogers Posts: 2,175
    edited 2004-09-27 16:01
    Hello from Buck Rogers
    I beg to differ. Yes he should toss those DS2405s. The company only makes them for replacement value. That is to replace used ones in contracts that actually made the mistake of ordering them. The proper one is the DS2406. The DS2407 may not even be made anymore.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Buck Rogers

    www.gregg.levine.name
  • Lars50Lars50 Posts: 23
    edited 2004-09-27 17:20
    Well, what to do??

    I got two similar suggestions to move away from the 2405 that I got for free from Dallas. Why should I go and buy two new 2406. Just kidding, what is the main difference with the 2406 except for the·double switches. Why is it better??

    Lars
  • Buck RogersBuck Rogers Posts: 2,175
    edited 2004-09-27 19:00
    Hello from Buck Rogers

    Lots of reasons. The TO-92 package for the DS2406 has only one switch. The TSOC version is the double.

    Also the DS2405 is not well thought of now, by the folks at the company, and by alumuni. Also by technolgy users, such as myself.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Buck Rogers

    www.gregg.levine.name
  • Lars50Lars50 Posts: 23
    edited 2004-09-27 19:28
    Thanks Buck

    I vent through the datasheet and felt it is well above me knowledge, for the 2405 I could always find bit and pieces of code that I can put together to a working system. As you understand I'm not pro only a happy newbie.

    I could see myself using a TO package to keep my PCB unchanged. i.e still one channel.

    Any hint how to find a piece of code or hint·for the 2406 is appreciated.

    Again, thank for your advice.



    Lars
  • HardwareWizardHardwareWizard Posts: 9
    edited 2004-10-11 15:24
    could someone point me in the direction of some code to access a ds 2408??? or any 1-wire device.


    Thanks
Sign In or Register to comment.