Guest User

Untitled

a guest
Apr 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. ISR(ADC_vect){
  2.     ad[channel] = ADCH; // Store the result (8 -bits, discard the 3 LSB)
  3.     ADCSRA &= ~(1 << ADEN); // Disable the ADC
  4.     if(channel<7){ //Cycle trough the channels 0-4
  5.         channel ++;
  6.         ADMUX |= channel;//Update the ADMUX register
  7.         ADCSRA |= (1 << ADEN); // Enable the ADC
  8.     }      
  9.     else if (channel == 7){
  10.     cli(); // disable interrupts for now
  11.     newSampleReady = 1; // 7 channels sampled
  12.     channel = 0; // Reset to channel 0
  13.     ADMUX = channel; //Update the ADMUX register
  14.     }  
  15. }
Add Comment
Please, Sign In to add comment