Hello Antonio.

This TEP can help you, http://www.tinyos.net/tinyos-2.x/doc/html/tep101.html

You have 3 ways to get data from ADCs: interface Read, ReadStream and ReadNow.

I only use the interface Read. In the app module you use the interface Read: 
uses interface Read<uint16_t> as Conductividad;



To read the command: 

if (call Conductividad.read() != SUCCESS)

call Leds.led2Toggle(); // Mostrar error.



When the data is ready you have it in the event:

event void Conductividad.readDone(error_t result, uint16_t data) {

//call Leds.led0Toggle();

if (result != SUCCESS)

{

data = 0xffff;

call Leds.led2Toggle(); // Mostrar error.

}

LecturaConductividad = data;

LeerConductividad = FALSE;

if(!LeerConductividad & !LeerTemperatura) EnvioDatosPendiente = TRUE;

}



The app configuration:

components new Msp430ADC0C() as ADC0;

...

App.Conductividad -> ADC0;



I add the files that i use to get data from ADCs. In the 

Msp430ADC0P you can select the ADC (inch: INPUT_CHANNEL_A0,)and other things.



I hope that help you.



A greeting,

Juan Antonio.

  ----- Original Message ----- 
  From: antonio gonga 
  To: TINYOS 
  Sent: Wednesday, February 06, 2008 3:43 PM
  Subject: [Tinyos-help] ADC_MSP430_how


  Dear all,

  I'm starting now with ADC in TinyOS-2.x. I was browsing TinyOS folders and I 
still have problems.
  How can I read external sensors connected to my Mote in TinyOS-2.x?. 
  How can I use "msp430adc12_channel_config_t"  if I want to read  data from 
example ADC0, ADC1, ADC2? The example that I found in 
  /opt/tinyos-2.x/tos/chips/msp430/adc12/README.txt does not help so much...

  thanks in advance.

  -Antonio




------------------------------------------------------------------------------
  Express yourself instantly with MSN Messenger! MSN Messenger 


------------------------------------------------------------------------------


  _______________________________________________
  Tinyos-help mailing list
  Tinyos-help@millennium.berkeley.edu
  https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Attachment: Msp430ADC0P.nc
Description: Binary data

Attachment: Msp430ADC0C.nc
Description: Binary data

_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to