WinAVR-1221 new bug report!

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Since i have installed WinAVR-1221, my program suddenly failed!
My ADC of Atmega64 can not work continuously!

I want to start an ADC as fast as possible, so i discard the single conversion which wastes more cycles than the continuous one.
My idea is that ADC works all the time but does not interrupt until i need it. So if i need an ADC, I make ADC interrupt enable. Then the program in the ISR() transfers the ADC result to me. After finished the transfer, close the ADC interrupt enable function which will trouble my main program.

My main codes are listed below:

#define sbi(x,y) x|=(1<<y)
#define cbi(x,y) x&=~(1<<y)
#define gbi(x,y) x&(1<<y)

void adc_init(uchar channel,uint volt_ref)
{
cbi(DDRF,channel);
cbi(PORTF,channel);
ADMUX=(volt_ref<<REFS1)|(1<<REFS0)|(channel<<MUX0);
ADCSRA=(1<<ADEN)|(1<<ADATE)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADSC);
}

void start_an_adc(void)
{
sbi(ADCSRA,ADIE);
loop_until_bit_is_set(ADCSRA,ADIF);
cbi(ADCSRA,ADIE);
}

ISR(SIG_ADC)
{
adc_sum=ADC;
}

I use WinAVR-0525 to work properly, But not Winavr-1221! Using the latter, Atmega64 just converts a few times then stops, by the way, when it stops, the other function like keyboard function can not work properly, sometimes is fine, sometimes is amazing!

This bug makes our Martian go to Jupiter, but our intention is to go to earth! D A M N it!

Our Martians are beginning to learn AVR