AnsweredAssumed Answered

ADuC845 ADC

Question asked by DevAlex on Sep 8, 2015
Latest reply on Sep 18, 2015 by MMA

Hi! I develop the high-precision device of measurement of a tilt angle with use of an inclinometer of Seika NB3 and the ADuC845 microconverter. After measurement I collect result from ADC registers. The result surprises me very much - huge dispersion of ADC counting. For example from 2500000 to 2501000. I use an external source of basic tension of Refin+ 5V, Refin- GND.

Code:

void adc_config(void)

{

  //CONFIGURE ADC AND START CONVERTING....

    SF = 0xFF;

    ADC0CON1 = 0x27;  //Full Buffer, Unipolar, 5.12V range.

    ADC0CON2 = 0x4A; //Refin+/-, AIN1 -> AIN2

    EADC = 1;           //Enable ADC Interrupt

    EA = 1;             //Enable Global Interrupts

    ADCMODE = 0x23; // continuous conversion

}

------------------------------------

void ADC_int () interrupt 6

{

  CODE = ADC0H;

  CODE = CODE << 8;

  CODE = CODE | ADC0M;

  CODE = CODE << 8;

  CODE = CODE | ADC0L;

 

    sprintf(ext, "%llu", CODE);

    lcd_cmd(0x80);

    delay(1);

    lcd_data(ext);

    delay(30);

  }

  RDY0 = 0;

}

 

Need help to resolve this problem.@@

Outcomes