Connect with us

time difference calculation

Discussion in 'Microcontrollers, Programming and IoT' started by saurabh17g, Apr 23, 2010.

Scroll to continue with content
  1. saurabh17g

    saurabh17g

    72
    0
    Mar 8, 2010
    --------------------------------------------------------------------------------

    I am developing a circuit for calculation of time spent for the wave to travel from one end of sample to another. The length of sample varies from 0.5 cm to 10 cm.
    I have generated sinewave and I want to determine the instance the wave hits the sample and the instance the wave gets out of it. Once, i determine the first instance, i will start the timer and stop it once i determine the next instance. Transducer is used to convert the electrical signal to ultrasonic signal which hits the sample and viceversa.
    I am developing this circuit using AVR microcontroller. I found that the inbuilt Timer clock frequency doesnot exceed 8KHz. But I want to operate my timers are higher frequencies around 4 Mhz. Please suggest me inputs.
     
  2. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,499
    2,839
    Jan 21, 2010
    Something like this might be what you're after.

    Note that the device selected has a TTL output.
     
  3. saurabh17g

    saurabh17g

    72
    0
    Mar 8, 2010
    @steve
    The link points to various frequency ranges of oscillator. But that is not my requirement.
    I want to measure the time spent and the oscillator will not give me that.
    I have to connect an external timer which runs at 8MHz and calculates the time which I can read through a microcontroller. I found IC 8253 (programmable counter) but there is a lot of programming and IOs required. I want a simple IC.
     
  4. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,499
    2,839
    Jan 21, 2010
    Use a PIC. I know their timers go faster (at clock speed if required). I'd be surprised if an AVR microcontroller cant do it as well.

    And the obvious answer is that they can.

    I presumed you needed a crystal oscillator as an external clock source. If you're doing serious timings then I assume you're already using one (for the obvious reason). The one I pointed you to is *an* option for that.
     
  5. saurabh17g

    saurabh17g

    72
    0
    Mar 8, 2010
    Thanks steve, it was a gr8 tutorial. Just that it mentioned "Now, with only one line of code, we've started the hardware timer 1 counting at 1MHz - the same speed as our AVR. " And the example below was written taking into consideration the clock frequency to be 1Mhz.
    But practically it went slightly more than 8MHz(internal RC).
    So, it served my requirement as 1MHz would not have done it.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-