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

1-wire client

CodeswingerCodeswinger Posts: 5
edited 2011-11-20 15:48 in Propeller 1
Attention solderers,
Forgive me but I am quite new to this little piece of art (the prop) but as my home is a 1-wire tangle of sensors and switches with a PC master controlling it all, I thought props in different configurations could make some of my unfulfilled whishes come through as eg a 1-wire power meter slave. To the question; Is there any 1-wire generic tweakable slave s/w developed for the propeller? I know there are some master ditto, but I am looking for code making the prop a 1-wire slave. Anyone seen any?
Mille graize!

Comments

  • bsnutbsnut Posts: 521
    edited 2011-11-18 20:35
    Welcome to the forums
    I know there are some master ditto, but I am looking for code making the prop a 1-wire slave. Anyone seen any?
    Where you can look, is the OBEX Exchange were I found these two and is the IC2 driver which is master/slave based.

    1) Basic IC2 Driver http://obex.parallax.com/objects/672/
    2) 1-wire Routines in Spin http://obex.parallax.com/objects/342/
  • JonnyMacJonnyMac Posts: 9,198
    edited 2011-11-18 21:49
    With respect, I would suggest that my 1-Wire object will give you better guidance as it is written in PASM and the timing values are directly from an Applications Engineer at Maxim/Dallas.

    It is in fact a master object but has code elements that may be useful. I remember being told that 1-Wire devices restart an internal timer on detecting the line being pulled low. When returning a bit the device is expected to place the value on the line within 15us of the falling edge of the 1W buss.
  • CodeswingerCodeswinger Posts: 5
    edited 2011-11-20 15:04
    Thank you both for the input. I will sink my teeth in that PASM and try to make the snippet run as a device, but I must admit it is a little bit over my head for now. Think I'll put a DS2408 to interface with the propeller for the time being and do my homework on 1w buss timing...
  • JonnyMacJonnyMac Posts: 9,198
    edited 2011-11-20 15:48
    The key is watching for the line to drop and then starting a timer. You can do that in PASM like this
    wait0                   waitpne owmask, owmask                  ' wait for drop
                            neg     timer, cnt                      ' start timer
                           
    wait1                   waitpeq owmask, owmask                  ' wait for release
                            add     timer, cnt                      ' timer has pulse time
    

    Now you can determine what the timing means, based on the state of the driver. The OW slave code I posted above shows how to write bits back to the OW buss.
Sign In or Register to comment.