ADC Pause

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 Hello, I am currently using ADCIN and I'm wondering if theres a way to "pause" the ADC for a certain time. Right now I'm setting pins that read from an external mux which sends back to my ADC in two different Channels. I have narrowed it down to most likely reading data too fast.

   

 

   

AMUX4_1_InputSelect(AMUX4_1_PORT0_3);

   

Set_Port0_1(0);

   

Set_Port2_7(0);

   

        Read_ADC();

   

 

   

Let me know if you need more info

0 Likes
1 Solution
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

To throw away n samples do a while loop capturing

   

n conversions and exit, last conversion the answer.

   

 

   

Something like this -

   

i = 3

   

     while( i > 0 ) {

   

         while(ADC12BIT_fIsDataAvailable() == 0);                                           // Loop until value ready
         iAtod_val = ADC12BIT_iClearFlagGetData ();                                         // Get settled ADC result

   

         i--;

   

    }

   

 

   

The above will capture the 3'rd sample in iAtod_val;

   

Regards, Dana.

View solution in original post

0 Likes
7 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You can start and stop an adc, but generally, unless there are

   

power considerations, I run the ADC continuously, and throw

   

away sample(s) if I need settling time.

   

 

   

The APIs are in the components datasheet to start and stop the

   

ADC. Read the fine print on the adc as you may need delay after startup,

   

for example flushing the decimator(s).

   

 

   

When you read ADC there is an API that indicates it has a new sample

   

ready. Normally one qualifies the read with this API indicating true, eg.

   

that a sample is ready. Look at the example project for the type ADC

   

you are using. Or the code sample at bottom of component datasheet.

   

Some people do a while() until the api indicates sample is ready, others

   

go do other things and come back to check if sample ready.

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 Thank you so much for answering,

   

my current way of doing things is 

   

 

   

/* Start The ADC */

   

ADCINC_1_Start(ADCINC_1_HIGHPOWER);

   

ADCINC_1_GetSamples(0);

   

   

/* Infinite Loop */

   

while (1)

   

{

   

              //other Code

   

               while (ADCINC_1_fIsDataAvailable() == 0);

   

        /* Read the ADC Result */

   

        ADCINC_1_iClearFlagGetData();

   

        }

   

 

   

 

   

How would I go about throwing away samples or if data was read too fast. would this have to deal with the Hz at which things are running? (Computer Science Major, Not tons of Electrical Experience).

   

 

   

Thanks

0 Likes
Anonymous
Not applicable

 Or I may be looking for something like an interrupt for 10ms for example after I switch channels and set ports which is before Reading the ADC.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

To throw away n samples do a while loop capturing

   

n conversions and exit, last conversion the answer.

   

 

   

Something like this -

   

i = 3

   

     while( i > 0 ) {

   

         while(ADC12BIT_fIsDataAvailable() == 0);                                           // Loop until value ready
         iAtod_val = ADC12BIT_iClearFlagGetData ();                                         // Get settled ADC result

   

         i--;

   

    }

   

 

   

The above will capture the 3'rd sample in iAtod_val;

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Edit: This post was accidental

0 Likes
Anonymous
Not applicable

 Thank you for the help with ADC setteling, My question expands from this and I decided to make a new post about how I should set up my frequencies

   

http://www.cypress.com/?app=forum&id=1573&rID=111784

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Glad to have been of assistance.

   

 

   

Regards, Dana.

0 Likes