I want to measure the time a varying voltage takes to reach a particular level. This idea can be the basis for measuring time constant. However, the timer doesnot give the correct value. The device being used is ATmega8. Basic settings for Timer and ADC being used are:
TCNT1 = 0;
TCCR1B |= (1 << CS11) | (1 << CS10);
ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);
ADMUX |= (1 << ADLAR);
ADMUX |= (1 << REFS0);
ADCSRA |= (1 << ADIE);
ADCSRA |= (1 << ADEN);
Any ideas or suggestions are welcomed.
TCNT1 = 0;
TCCR1B |= (1 << CS11) | (1 << CS10);
ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);
ADMUX |= (1 << ADLAR);
ADMUX |= (1 << REFS0);
ADCSRA |= (1 << ADIE);
ADCSRA |= (1 << ADEN);
Any ideas or suggestions are welcomed.