comparison main.c @ 61:62112fc2af21

sort out voltage logging
author Matt Johnston <matt@ucc.asn.au>
date Tue, 26 Jun 2012 08:08:48 +0800
parents 5100e0bdadad
children 68c1e2b26bc5
comparison
equal deleted inserted replaced
58:5100e0bdadad 61:62112fc2af21
610 static void 610 static void
611 adc_internal(uint16_t *millivolt_vcc, uint16_t *int_temp) 611 adc_internal(uint16_t *millivolt_vcc, uint16_t *int_temp)
612 { 612 {
613 PRR &= ~_BV(PRADC); 613 PRR &= ~_BV(PRADC);
614 614
615 // left adjust
616 ADMUX = _BV(ADLAR);
617
618 // ADPS2 = /16 prescaler, 62khz at 1mhz clock 615 // ADPS2 = /16 prescaler, 62khz at 1mhz clock
619 ADCSRA = _BV(ADEN) | _BV(ADPS2); 616 ADCSRA = _BV(ADEN) | _BV(ADPS2);
620 617
621 // set to measure 1.1 reference 618 // set to measure 1.1 reference
622 ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1); 619 ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);