2 Replies Latest reply on Feb 28, 2011 8:20 PM by graa

    ADCINC problem

    qun.lai

      I want to test a very simple code, insamp (with two PGA and one ADC). When I run the code, it stop in the line:

         

      if (ADCINC_1_fIsDataAvailable() != 0);

         

      Below is the code, can anyone tell me what wrongs, thankks a lot in advance!

         

      #include <m8c.h>        // part specific constants and macros
      #include "PSoCAPI.h"    // PSoC API definitions for all User Modules
      #include "PSoCGPioInt.h"

         

      int  iResult;

         

      void main(void)
      {
          PGA_1_Start(PGA_1_HIGHPOWER);
          PGA_2_Start(PGA_1_HIGHPOWER);
          ADCINC_1_Start(ADCINC_1_HIGHPOWER); /* Turn on ADC power */
          ADCINC_1_GetSamples(0);            /* Sample forever */
         
          while(1) {
           if (ADCINC_1_fIsDataAvailable() != 0) /* If ADC sample is ready... */
           { 
               iResult = ADCINC_1_iGetData() + 2048; /* Get result, convert to unsigned and clear flag */
               ADCINC_1_fClearFlag();
           }
       }
      }

         

      The general system setup as below:

         

      VC1=sys/3

         

      VC2=VC1/8

         

      VC3=sys/1

         

       Analog Power: SC on/RefH

         

      RefMax:Vdd/2+/-BandGap

         

      OpAmp bias Low

         

      A-buff_power low

         

      Switch Mode Pump OFF

         

      Trip Voltage LVD4.81V

         

      Including is my project codes.