Author Topic: ADCRESULT1  (Read 3172 times)

0 Members and 1 Guest are viewing this topic.

Offline orchidTopic starter

  • Full Member
  • ***
  • Posts: 54
  • Helpful? 0
ADCRESULT1
« on: April 04, 2008, 12:24:00 AM »
Hi there...

I have a problem here regarding to the ADCRESULT1. When I use 1 sensor, then I got the ADC value on the ADCRESULT0. But, when I connect the second sensor to the ADC pin on the tms320f2812 dsp board, the ADC value on the ADCRESULT1 are not as expected. Here I attach some of the source code that I have edited for your reference.
Code: [Select]
  AdcRegs.ADCTRL1.bit.ACQ_PS = ADC_SHCLK;
   AdcRegs.ADCTRL3.bit.ADCCLKPS = ADC_CKPS;     
   AdcRegs.ADCTRL1.bit.SEQ_CASC = 1;        // 1  Cascaded mode
   AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x8;
   AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0xA; 
   AdcRegs.ADCTRL1.bit.CONT_RUN = 1;       // Setup continuous run

  AdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 0x1;  // convert and store in 2 results registers
// Clear SampleTable
   for (i=0; i<BUF_SIZE; i++)
   {
     SampleTable[i] = 0;
   }

   // Start SEQ1
   AdcRegs.ADCTRL2.all = 0x2000;
   GpioDataRegs.GPBDAT.all = 0xFFFF;
   // Take ADC data and log the in SampleTable array 
   while(1)
   { 
     for (i=0; i<AVG; i++)
     {
        while (AdcRegs.ADCST.bit.INT_SEQ1== 0) {} // Wait for interrupt
        // Software wait = (HISPCP*2) * (ADCCLKPS*2) * (CPS+1) cycles
        //               = (3*2)      * (1*2)        * (0+1)   = 12 cycles
        asm(" RPT #11 || NOP");
        AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
        Voltage1[ConversionCount] =( (AdcRegs.ADCRESULT0>>4) );
Voltage2[ConversionCount] =( (AdcRegs.ADCRESULT1>>4) );

Please help me to solve this prob.
thanks...

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: ADCRESULT1
« Reply #1 on: April 06, 2008, 11:36:13 AM »
Quote
When I use 1 sensor, then I got the ADC value on the ADCRESULT0. But, when I connect the second sensor to the ADC pin on the tms320f2812 dsp board, the ADC value on the ADCRESULT1 are not as expected.
It sounds like cross interference.

Make sure your power supply is clean and good.

Also, make sure you have the sensors plugged into the same place as specified in code - sometimes the ADC can 'take' voltages from nearby ADC pins.

Offline orchidTopic starter

  • Full Member
  • ***
  • Posts: 54
  • Helpful? 0
Re: ADCRESULT1
« Reply #2 on: April 06, 2008, 07:25:16 PM »
i got it...

thanks

 


Get Your Ad Here