7 Replies Latest reply on Apr 28, 2015 2:44 PM by syth.ryan

    ADC Pause

    syth.ryan

       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

        • 1. Re: ADC Pause
          user_14586677

          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.

          • 2. Re: ADC Pause
            syth.ryan

             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

            • 3. Re: ADC Pause
              syth.ryan

               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.

              • 4. Re: ADC Pause
                user_14586677

                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.

                • 5. Re: ADC Pause
                  syth.ryan

                  Edit: This post was accidental

                  • 6. Re: ADC Pause
                    syth.ryan

                     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

                    • 7. Re: ADC Pause
                      user_14586677

                      Glad to have been of assistance.

                         

                       

                         

                      Regards, Dana.