AT90PWM3B differential ADC gain 1x

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How in the AT90PWM3B on the differential channel ADC to use the gain 1x (turn off the amplifier)? In Complete Datasheet of the microcontroller (document version 4317K-AVR-03/2013) on page 247 (example 2), this option is described. But when I try to turn off the amplifier (AMP0EN = 0), the ADC stops working.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Show a minimum, complete, compilable example which illustrates the issue.

 

Instructions for posting source code: http://www.avrfreaks.net/comment...

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

Did you do that?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
void adc_init(void)
{
    ADMUX = 0b11000010;
    ADCSRA= 0b10010100;
    ADCSRB= 0b10000000;
    DIDR0 = 0b00000000;
    DIDR1 = 0b00011011;
    AMP0CSR=0x00;
}

//******************************************************
uint16_t ReadSignADC(uint8_t ch) {
    ADMUX=0b11000000|ch;
    ADCSRA|=BIT(ADSC); //start ADC
    while (ADCSRA & (1<<ADSC))    { };
    return ADC;
}

The code works with a gain 5x (AMP0CSR = 0x80), but "freeze" on the line "while (ADCSRA & (1 << ADSC)) {}" if I put AMP0CSR = 0x00.
Variant "while (ADCSRA & (1 << ADIF)==0) {}" also does not work.

Last Edited: Fri. Sep 22, 2017 - 03:00 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

awneil wrote:
Show a minimum, complete, compilable example which illustrates the issue.

 

That's not a complete example - is it?