Hi Antonio, This might be hardware related, if I remember correctly. Read the datasheet, maybe if you use different reference voltage, then at least one extra ADC reads must be inserted.
Miklos On Tue, Aug 30, 2011 at 6:21 PM, antonio rosa <[email protected]> wrote: > > > ---------- Forwarded message ---------- > From: antonio rosa <[email protected]> > Date: 2011/8/30 > Subject: Re: [Tinyos-help] Problems with ADC to perform two consecutive > readings on IRIS Mote > To: Janos Sallai <[email protected]> > > > Hi Janos, > I understand you. I use the ReadNow interface of the AdcReadNowClient > component, but the source of the problem is that when I do two consecutive > reading of diferents channels of ADC, if the first reading is a channel > different of ATM128_ADC_SNGL_1_23 channel (internal voltage on IRIS) the > value is correct, and the seconds readings is the ATM128_ADC_SNGL_1_23 > channel the value is wrong. > Also, If I read only the ATM128_ADC_SNGL_1_23 channel the value is correct, > but when I read other channel in the same application, the read of > ATM128_ADC_SNGL_1_23 channel is wrong. I have guess that when you read the > internal voltage of Atmega1281, the first time the reading is wrong, the > second time the reading si correct. > > In short, if you make several readings of different ADC channels, you must > do two consecutive read internal voltage channel and discard the first > reading because it is wrong, yet the latter is correct. > > > > read the ATM128_ADC_SNGL_1_23 channel, > > 2011/8/30 Janos Sallai <[email protected]> >> >> Antonio, >> >> I have a guess what can be wrong. I assume you're using either the >> Atm128AdcSingle or Atm128AdcMultiple interface. While the dataReady >> event is slightly different in these two interfaces, in each cases it >> has a bool parameter, not an error_t. Notice that the value of the >> SUCCESS constant is 0, which happens to be the value of FALSE. That >> is, when you think that the dataReady event came back with a SUCCESS, >> it is, in fact, coming back with a FALSE. >> >> Let me know if this was the issue. >> >> Janos >> >> On Mon, Aug 29, 2011 at 7:37 AM, antonio rosa >> <[email protected]> wrote: >> > Hello all, >> > I have a problem with the IRIS platform. When I do readings of different >> > channels of ADC reading the microcontroller's internal voltage (channel >> > ATM128_ADC_SNGL_1_23) the event (dataReady) is SUCCESS but the reading >> > (data) is erroneous. I have cheked that if I make two consecutive >> > readings >> > of the same channel ADC, everything is correct. However, if I previously >> > do >> > a reading from a channel different than used to read the internal >> > voltage >> > and then read channel internal voltage, the value returned by the adc is >> > wrong (superior the voltage of the batteries). >> > >> > In TinyOS.1.x with Moteworks, doesn't ocurrs this problem. I have >> > reviewed >> > the TinyOS-2 driver 1.1 for the module Adc Atmega1281, and I think the >> > problem may be related to reading different channels that aren't managed >> > properly. >> > >> > Regards, Antonio Rosa. >> > _______________________________________________ >> > Tinyos-help mailing list >> > [email protected] >> > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >> > > > > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
