PDA

View Full Version : 1-wire client



Codeswinger
11-19-2011, 12:26 AM
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!

bsnut
11-19-2011, 03:35 AM
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/

JonnyMac
11-19-2011, 04:49 AM
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.

Codeswinger
11-20-2011, 10:04 PM
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 (http://datasheets.maxim-ic.com/en/ds/DS2408.pdf) to interface with the propeller for the time being and do my homework on 1w buss timing...

JonnyMac
11-20-2011, 10:48 PM
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.