Shop OBEX P1 Docs P2 Docs Learn Events
Quick BS2 Timing question — Parallax Forums

Quick BS2 Timing question

SouLJahSouLJah Posts: 35
edited 2006-02-18 18:25 in BASIC Stamp
I am using a ADC to read the values of 2 analog waves, I want to measure the time difference between each wave reaching its peaks, and the time difference is miliseconds apart, what device could I SUCCESSFULLY use to achieve this.· If you have an answer help me out, thanks.

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2006-02-17 20:34
    The problem is that you probably need to sample the waveform several times between the peaks, to accurately determine where the peaks are.

    Also, most A to D converters do take SOME time to sample the signal.

    Also, the BS2 runs at about 300 uSec per instruction -- so you may only be able to take two or three samples between the 'peaks'.

    Short answer -- this could be asking too much of the BS2.
  • SouLJahSouLJah Posts: 35
    edited 2006-02-17 22:22
    Ok, but let me ask if you were measuring short times, what would you use to do it.
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2006-02-18 18:25
    This would probably require some external analog hardware. Two analog peak detectors, one to set a flip flop and the other to reset it. Then you have a pulse duration, and the BASIC Stamp can easily measure that with the PULSIN command.

    The external circuitry required would depend on the shape and cleaness of the signals. A peak detector often consists of a differentiator, followed by a zero crossing detector.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.