1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

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

Discussion in 'AVR' started by muashr, Mar 10, 2015.

  1. muashr

    muashr Member

    Joined:
    Feb 11, 2014
    Messages:
    43
    Likes:
    0
    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.
     
  2. Tony Stewart

    Tony Stewart Well-Known Member Most Helpful Member

    Joined:
    Aug 31, 2012
    Messages:
    3,152
    Likes:
    281
    Location:
    Richmond Hill , ON Canada near Toronto
    I suggest you show what you get and what expected for every input and output.
     

Share This Page