[Tinyos-devel] how to implement a delayed ADC on MicaZ in tinyos-2.x?

Razvan Musaloiu-E. razvanm at cs.jhu.edu
Fri Jun 23 11:31:31 PDT 2006


Hi!

On Fri, 23 Jun 2006, Jan Hauer wrote:

> Don't instantiate an AdcReadClient, use an AdcReadNowClientC instead.
> Call Resource.request(), wait for the granted() event, then power up
> your sensor (set a timer), call ReadNow.read and after you are
> signalled the data call release() and power-down the sensor.

Thank you very much! It worked perfectly. :P

> Note that you will block access to the ADC during that time, thus you
> instead might want to consider powering-up the sensor before you
> request the ADC resource (but since you could have used the latter
> approach with Read also, it looked like you wanted to minimize the
> time between powering-up the sensor and sampling it).

Even if I block the ADC for some time it's not an issue in my case so the
solution based on AdcReadNowClientC is perfect.

Once again, thank you for your help! :-)
Razvan ME

> On 6/22/06, Razvan Musaloiu-E. <razvanm at cs.jhu.edu> wrote:
> > Hi!
> >
> > I was asking yesterday on the -help list how to implement a driver for a
> > device that needs to be power a certain time before the sampling takes
> > place. In case someone from here has time here is a more detailed
> > description of my problem.
> >
> > Similar with the Photo and Temp sensors from basicsb I have a sensor that
> > uses a PW pin to get power and an ADC to provide the result. In my case I
> > have to wait some time between putting the PW on high and issuing the ADC.
> > What should be the correct way to this?
> >
> > As far as I understand I cannot use the AdcReadClient because he is using
> > WireAdcP which in turn uses ArbitratedReadC that calls Resource.request
> > just before the read is issued and then calls Resource.release immediately
> > after the read is taken. A way to do want I want would be to produce a new
> > AdcReadClient and a new WireAdcP which uses a DelayedArbitredRead that
> > would implement my timing requirements based on a parameter. Is this the
> > right way to do what I want? :-)
> >
> > [1] http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2006-June/017401.html
> >
> > --
> > Razvan ME
> >
> >
>



More information about the Tinyos-devel mailing list