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)
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!