ts-7000
[Top] [All Lists]

[ts-7000] Re:U Sleep

To:
Subject: [ts-7000] Re:U Sleep
From: "charliem_1216" <>
Date: Mon, 23 Feb 2009 18:48:53 -0000
Hi Girisha --

--- In  Girisha De Silva <> wrote:
>
> Hey
> 
> Thanks Rod for your reply. Anyways this is what I do in the loop.
> 
> cur_ch = ADC_CH2;
>     
>         //discard two samples 
>         read_channel(adc_page, cur_ch);
>         read_channel(adc_page, cur_ch);
> 
> 
>         //read 1000 more samples
>         for(j = 0; j < NOSAMPLE; j++)
>         {
>             usleep(1000); 
>             adc_result[j] = read_channel(adc_page, cur_ch);

Here you need to look into what is happening in read_channel, with the
EP9301 User Guide in hand.  (The EP9301 guide has a better explanation
of ADC operation than the later EP93xx guide, which just describes the
touch screen interface).

read_channel() spins, waiting for SDR bit to be set (Synchronous Data
Ready).  If set, read_channel() returns the data from the *next* read
as the ADC value.  The User Guide, though, says that the ADC data is
ready immediately when the SDR bit is set: "So when two consecutive
reads show the bit clear and then set, the second read has the new
valid [ADC] value".  

You could try changing read_channel() to return the data immediately
when SDR is set, rather than reading a second time to get the data. 
It may be an issue, I don't know.

Also, I see read_channel() is unlocking the ADC, and writing the
channel selection for *each* conversion.  I'm sure at least channel
selection has some non-trivial settling time that could interfere with
your readings without usleep().  If you are interested in multiple
fast readings of one channel, you could set the channel once and skip
it on later reads.

>     
>             avg = adc_result[j];
> 
>             if(avg < 0x7000)
>             avg = avg + 0x10000;
> 
>             avg = avg - 0x9E58;
>             val = ((double)avg * 3.3) / 0xC350;
>     
>             sprintf(pBuff,"%f",val);    
>             fprintf(file,"%s\n",pBuff);
>     
>         }
> 
> Hope I am doing it the correct way.

For best accuracy, use the ADC calibration data stored in EEPROM by TS.

In general, I would not hold too much hope for the speed or accuracy
of the on-board A/D: it was included in the ep930[1,2] mostly as a
touch-screen interface for higher model chips.

regards, ......... Charlie 

> 
> Regards Girisha
> 
> 
> 
> 
> ________________________________
> From: Rod Nussbaumer <>
> To: 
> Sent: Sunday, February 22, 2009 1:11:06 AM
> Subject: [ts-7000] Re:U Sleep
> 
> 
> How are you reading the ADC? Most ADCs have a bit somewhere to signal 
> End-of-Conversion. If your loop is simply reading a register that is 
> supposed to contain converted data, but is not waiting for EoC, that 
> would explain erratic readings. If a time-delay is inserted, as with 
> usleep(), it would allow time for the conversion to complete, and 
> provide you with valid readings. Again, this is consistent with the 
> behavior you are seeing. Can you confirm that you are reading the
ADC in 
> a way that assures it has completed a conversion?
> ---   rod.
>




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

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU