11 Replies Latest reply on Jul 23, 2011 11:49 PM by userc_44562


      Does anyone knows how does the calculation of the ClacTime(equation 9) in the datasheet of the ADCINCVR (Pg4 of 28) works?   
      The datasheet states that the CalcTime is equivalent to 180 CPU cycles and must be express in terms of dataclock.   
      I assume if my CPU_Clock is SysClk/8=24Mhz/8=3Mhz,   
      my DataClock=VC1=SysCLK/N=24Mhz/12=2Mhz, does that mean that   
      the CalcTime =[180*/(3Mhz)]*2Mhz = 120 DataClock cycles.   
      Does the DataClock mention in the datasheet mean VC1,VC2 and VC3 which you chose to clock the ADCINCVR?   
      What units are the terms in equation 8 using?   
      Sampling Rate=hz?   
      DataClock=hz or seconds?   
      CalcTime=seconds or Dataclock cycles?   
      Please help   
        • 1. Re: ADCINCVR
                  Yes. Your understanding of the CalcTime equation is correct. For a CPU clock of 3MHz and DataClock of 2MHz, the CalcTime is 120.   
          The units are:   
          Sampling Rate = Samples Per Second   
          Data Clock = Hz   
          CalcTime = No. of Data Clocks   
          • 2. Re: ADCINCVR
                    Hi Ganesh,   
            Thanks for the confirmation.   
            Another thing about ADCINCVR....   
            Can the ADC work without using the ADCINCVR_GetSample API?   
            When the ADCINCVR_GetSample API is in use, the global interrupt is uitilise.   
            If a DAC incorprated in the microprocessor also uses the globel interrupt to execute a ISR, will the ADC trigger the ISR also via the ADCINCVR_GetSample API?   
            • 3. Re: ADCINCVR
                      Hi Ganesh,   
              Is there another way to connect the package input to the ADCINCVR input?   
              If I'm using a REFMUX to get port[0]7 to input to the ADCINCVR input, what do i configure for the REF input of the REFMUX?   
              If i'm using a DAC and the ADCINCVR at the same time, do i configure both UM's IntDispatchMode to "OffsetPreCalc"?   
              • 4. Re: ADCINCVR
                        Yes. You can only get the ADC to sample using the ADC_GetSamples function. Also, the ADC conversion involves some interrupt processing when reading the ADC results. The DAC does not use any interrupts.   
                You can connect some of the Port2 pins directly to the ADC without having to go through the CT blocks. Depending on the SC block where you place your ADC, the direct Port2 connection varies. You can check the availability of the Port2 pin by clicking on the Input parameter of the ADC.   
                The InitDispatchMode parameter only applies to dynamic reconfiguration. If you are not using dynamic reconfiguration, then this parameter has no relevance to the ADC.   
                • 5. Re: ADCINCVR
                          Hi Ganesh!   
                  Thank you for the reply.   
                  Maybe i should give more information about the DAC.   
                  I've been working on the DAC to produce the sinewave from the example project recommanded from the previous tread "Sinewave generator".   
                  The example project seems to use the 16BIT Counter to generate a global interrupt to trigger the ISR where instructions for the DAC to pick the relevant value from the lookup table and output the value resides.   
                  If I'm to add in the ADCINCVR into the project, will the UM blocks from the ADCINCVR and the 16BIT Counter for the DAC effect each other's operation via the Global interrupt?   
                  If a zero value is used in the ADC_GetSample function the ADC will get samples continueously. What will other value useds in the function prompt the function to do?   
                  Last question...What value is to put in the CalcTime parameter for the ADCINCVR?   
                  Isn't the CalcTime parameter for the ADCINCVR approximately 180 CPU cycles?   
                  Must I convert the the 180 CPU cycles to Dataclock Cycles and input the parameter as DataClk cycles?   
                  • 6. Re: ADCINCVR
                            If you set the CalcTime parameter right, the interrupt of the Timer will not affect the ADC. The CalcTime parameter is the number of data clocks that the ADC will hold the result for the processor even if the processor is busy with some ISR. The number 180 used in the equation is the number of CPU cycles taken by the ADC's ISR to read the ADC result. If you add the number of clock cycles used by the Timer's ISR, then even if the Timer's Interrupt triggers just before ADC's interrupt, the ADC result will not corrupt till the Timer ISR and the ADC ISR are executed. So, for example, if your timer ISR takes 170 CPU cycles to execute, then use the value 350 (180 + 170) in the CalcTime equation.   
                    On the other hand, when the Timer Interrupt occurs, if the processor is busy with the ADC's interrupt, then the Timer's interrupt will be serviced only after the ADC's interrupt is completed. So, this will result in some interrupt latency which may reflect on the output sine wave. The worst case interrupt latency would be 180 CPU cycles. Place the Timer in a higher row than the ADC's digital blocks. This will place the Timer in a higher interrupt priority and will ensure that the Timer ISR executes first when both ADC and Timer interrupts are pending.   
                    • 7. Re: ADCINCVR
                              Hi Ganesh,   
                      How do I determine the numbers of CPU cycles the Timer ISR take so as to add the value with the ADC 180CPU cycles?   
                      Anyway I've written the ADC part of the program as:   
                      int iData;   
                      void main(void)   
                      if (ADCINCVR_1_fIsDataAvailable() != 0)   
                      iData = ADCINCVR_1_iGetData();   
                      if(iData < 140)   
                      The ADCINCVR Dataformat is set to unsigned.   
                      I've also set the ADCINCVR Calc Time to 248.   
                      Is there a problem with the program i've written or the settings I've done?   
                      • 8. Re: ADCINCVR
                                Hi Yellow,   
                        If you have written the Timer ISR in C, you will have to open the .lst file and manually add the CPU cycles for all the instructions in the function. Check the Assembly Language User Guide (from Help >> Documentation menu) for details of CPU cycles of different instructions.   
                        • 9. Re: ADCINCVR
                                  Hi Ganesh!   
                          Thank you for the info.   
                          I'm still facing some problems with the ADCINCVR.   
                          It seems not to be processing any data.   
                          I hope that I've provided enough information for a discussion.   
                          Global Resources   
                          VC1 = SysVlk/N~12   
                          Ref Mux~P2[4]+/-P2[6]   
                          The rest are as default   
                          Here are the properties settings of the ADCINCVR I've set:   
                          Clock~VC1(Which is 2Mhz)   
                          For the Digital Block placements, I've placed the DAC Counter at DBB00 & 01, the ADCINCVR CNT at DCB12 and the ADCINCVR PWM at DBB20 & 21. All Digital blocks clock are from VC1(2Mhz). The DAC counter will generate a global interrupt in 266hz to trigger the DACs to output.   
                          For the Analog blocks placements the ADC is placed at ASD13 and input from PORT2_2. I've one set of DAC8 placed at ASC10 and ASD20, Analogbus to Buf 0 then to Port_0_3. Then I've another set of DAC8 placed at ASC11 and ASD21, Analogbus to Buf 1 then to Port_0_3.   
                          The C programming I've written is as follows:   
                          BYTE Pointer;   
                          int iData;   
                          void main(void)   
                          { M8C_EnableGInt;   
                          if (ADCINCVR_1_fIsDataAvailable() != 0)   
                          iData = ADCINCVR_1_iGetData();   
                          #pragma interrupt_handler Counter_ISR;   
                          void Counter_ISR(void)   
                          DAC8_1_WriteBlind (SineTable1[Pointer]);   
                          DAC8_2_WriteBlind (SineTable2[Pointer]);   
                          if(Pointer >= 64)   
                          {Pointer = 0}   
                          Sinetable1 and SineTable2 are 64 Points lookup tables stored in ROM.   
                          When i powered up the CY8C29466, the output gives a highpower signal instead of a lowpower signal.   
                          If the ADC is reading and processing signal a lowpower signal should be observed.   
                          Any comments from anyone?   
                          • 10. Re: ADCINCVR
                                    Sorry...I left out one data CPU_Clock~SysCLK/8   
                            • 11. Re: ADCINCVR

                              Regarding use of ADCINCVR and its API 'ADCINCVR_1_fIsDataAvailable' ...


                              Is there a known list of reasons why the ADCINCVR user module would never provide an indication for data being available?


                              Reason I ask is when I comment out the following line of code...


                              //if (ADCINCVR_1_
                              if (ADCINCVR_1_fIsDataAvailable() != 0) () != 0)


                              ...and I therefore allow unconditional entry into the block of code that includes getting the A/D sample and clearing the flag, everything appears to work great. I can tell valid a/d readings are able to be acquired from the ADCINCVR user module.


                              However, when I uncomment the above line of code that checks for data availability, l can never acquire an A/D reading.




                              What are the known reasons that API *fIsDataAvailable() will always return 'no data available'?


                              Thanks much in advance,