Using ADC & Timer For Measuring Time A Varying Voltage Takes To Reach A Certain Level

muashr

Member
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.
 
I suggest you show what you get and what expected for every input and output.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…