AnsweredAssumed Answered

aduc7061 adc resolution

Question asked by pve on Sep 29, 2016
Latest reply on Sep 30, 2016 by barryzhang

Hello

I use aduc7061 with accelerometer to make angle sensor, and now I'm trying mo set up ADC

In datasheet it is said, that ADC of Aduc7060/7061 is 24bit, but when I read it, I see only 16 bits of value with maximum of 0x7fff and minimum 0x8000 value.

What should I do to enable 24 bits?

I have experimented with conversion rate, but nothing changes. Result of adc conversion is more precise, but it is still 16 bit (with right align)

 

void initAdc()
{
        // Configure ADC0 for continuous conversions, 1Khz, AIN0 in Single-ended mode
        ADCMSKI = BIT0;    // Enable ADC0 result ready interrupt source
      
        //ADCFLT = 0x7;    // Chop off, 1Khz samping rate, SF = 7.    No averaging
        //ADCFLT = BIT15 + BIT14 + BIT8 + 127;
        ADCFLT =  127;
        //ADCFLT = BIT15 + BIT14;
    
       ADCMDE = BIT0 + BIT7;    // Continuous Conversion mode, Normal mode, 4Mhz clock source to ADC.        

 

      
        ADC0CON =
//                BIT0 + // pga gain
//                BIT4 + // external ref
//              BIT6 +         // AIN0 selected in Single ended mode
              BIT7 +         // AIN0 selected in Single ended mode

 

//              BIT10 +         // Unipolar ADC output
//                BIT11 + // pga output common-mode voltage to avdd/2
//                BIT12 +  // external referene exceeds 1.35v
    
              BIT15;        // enable adc
                            
    ADCCFG = 0;

 

    IRQEN = BIT10 + BIT11; // Enable ADC and UART interrupts

 

}

 

 

__irq void IRQ_Handler(void)
{
    unsigned long IRQSTATUS = 0;
    unsigned char ucCOMIID0 = 0;

 

    IRQSTATUS = IRQSTA;       // Read off IRQSTA register
    if ((IRQSTATUS & BIT11) == BIT11)    //UART interrupt source
    {
        ucCOMIID0 = COMIID0;   // Read the UART IRQ ID register

 

        if ((ucCOMIID0 & 0x2) == 0x2)      // Transmit buffer empty
        {
           ucTxBufferEmpty = 1;
        }
        if ((ucCOMIID0 & 0x1) == 0x1)      // Receive buffer Full      
        {
            ucRxChar = COMRX;              // read COMRX register
            bSendResultToUART = 1;          // Set flag to return a string to the PC
        }
    }
    
    if ((IRQSTATUS & BIT10) == BIT10)    //If ADC0 interrupt source
    {
      ulADC0Result = ADC0DAT;    // Read ADC0 conversion result
        bSendResultToUART = 1;
    } 


}

Outcomes