#include <avr/eeprom.h>
#include <util/delay.h>
-char dbg[5] __attribute__((section(".eeprom")));
+uint16_t adcval EEMEM;
int main(void)
{
DDRB |= _BV( PB5 );
PORTB &= ~_BV( PB5 );
+ ADCSRA = _BV(ADEN) | _BV(ADATE) | _BV(ADPS1) | _BV(ADPS0);
+ ADMUX = _BV(REFS1) | _BV(MUX0);
+ ADCSRB = _BV(REFS2);
+ DIDR0 = _BV(ADC1D) | _BV(AREFD);
+
+ ADCSRA |= _BV(ADSC);
_delay_ms(1000);
- eeprom_write_byte(&dbg[0], TCNT1);
- eeprom_write_byte(&dbg[1], OCR1C);
- eeprom_write_byte(&dbg[2], OCR1D);
- eeprom_write_byte(&dbg[3], TIFR);
- eeprom_write_byte(&dbg[4], TCCR1B);
+ eeprom_write_word(&adcval, ADCW);
+
DDRA |= _BV( PA0 );
while( 1 ) {
PORTA |= _BV( PA0 );