Hi!

On Sun, 18 Jun 2006, Zhimin He wrote:

> I'm trying to connect external sensors to the 51pin interface and get the
> reading by accessing the ADC.  Is there any documentation on how to write
> the code?
>
> For example, is there anything to help understanding the setting I found in
> \opt\tinyos-2.x\tos\sensorboards\basicsb\PhotoDeviceP.nc
>
>   PhotoP.PhotoPin -> MicaBusC.PW1;
>   PhotoP.PhotoAdc -> MicaBusC.Adc6;

The photo sensor from that board uses PW1 to power the sensor and ADC6 to
read the resistance. On page 7 in the MTS/MDA Sensor Board User's Manual
[1] there is a picture of the circuit.

I'm just a tinyos-2.x user so the following explanation might not be
accurate. :P

The photo sensor is implemented using 3 files:
        PhotoC.nc
        PhotoDeviceP.nc
        PhotoP.nc

The first is a configuration that wires the final result a user like: a
Read interface. He uses a AdcReadClient that gets the configuration from
PhotoDeviceP.

PhotoDeviceP doesn't directly provide the final configuration the
AdcReadClient wants. He is using PhotoP for which he provides the PW and
ADC pins.

PhotoP is the one that does the configuring job. On the ADC part he
selects a channel (the ADC pin he got from PhotoDeviceP), a reference
voltage and a prescaler factor. For the ResourceConfigure he provides a
.configure an .unconfigure which will be called by the arbiter before a
read is done. In our case the configure consists in putting on high or low
the PW pin we got from PhotoDeviceP.

One thing that I still don't understand yet is what is the proper way for
a device to inform the arbiter that he needs a certain delay between
configuration and the read. :P

[1] 
http://www.xbow.com/Support/Support_pdf_files/MTS-MDA_Series_Users_Manual.pdf

--
Razvan ME



_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to