Advertisement
Guest User

Untitled

a guest
Feb 18th, 2013
4
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. void read_adc_0(uint8_t *high, uint8_t *low)
  2. {
  3. ADCSRA |= (1<<ADEN)|(1<<ADPS2)|(1<<ADPS1);
  4.  
  5. _delay_ms(10);
  6.  
  7. ADCSRA |= (1<<ADSC);//start conversion
  8.  
  9. while((ADCSRA & (1<<ADSC)));//Wait for conversion to complete
  10.  
  11.  
  12. *high = ADCL;
  13. *low = ADCH;
  14.  
  15.  
  16. ADCSRA &= ~(1<<ADEN);//turn off the ADC
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement