Shop OBEX P1 Docs P2 Docs Learn Events
Time meassure betwean tvo inputs in sec ! — Parallax Forums

Time meassure betwean tvo inputs in sec !

Johan1968Johan1968 Posts: 22
edited 2008-02-11 12:54 in Propeller 1
I wanna messure time betweean two input signals and present it on VGA and pull it to a register for chare the fastest value.
Have anyone same sample, or code.

Regards Johan

Comments

  • Chuck McManisChuck McManis Posts: 65
    edited 2008-02-10 20:44
    Johan,

    Thats great. But unless you can be more specific about your requirements then no one can answer your questions.

    Describe your two signals, where do they come from, are they voltages? currents? puffs of smoke?

    What do you expect the shortest and longest time to be between the two of them? nanoseconds? years?

    When you "present it", what are you presenting, the time difference? a graph of the two signals?

    There is a simple oscilloscope demo in the propeller library demos that puts a line on the VGA screen representing the sound the microphone is measuring, does that help?
    --Chuck
  • Johan1968Johan1968 Posts: 22
    edited 2008-02-11 06:49
    I·have to messure the time for·the persons in·a waterslide, therse time from start to Goal.

    And it starts with a input signal from a fotocell (24 volt to a optocuppler for decrese the voltage to 1,6 volt, and so it is for the signal as on a for eg, "P0" as start time,·end the same for the goal time it is the same but a nwe input on eg."P1"
    End the time to messures is abaout 12-20 sec, and accurancy is would be present in .two sec (12.34sec) .

    I want to present the last time and also the fastest for this moment.

    I will try to look at the Exapmle you told me..

    Thanks. so far.

    Regards Johan
  • OzStampOzStamp Posts: 377
    edited 2008-02-11 06:57
    Hi

    Use one COG to generate a frequency of 1000 HZ... ( we call this COG1)
    Start stop this COG1 with the 2 inputs start ...measure... stop...
    Also generate one signal (output) l in COG1 that tells COG2 to count or not...

    COG1 generates a 1000HZ signal fed back into for example pin 3 ...
    Set up a cntr in COG 2 (hardware cntr) CTRA function which counts these pulses on PIN 3..

    Voila done ... timer to within 1/1000 of a second... display value on screen numerical use TV text driver...


    Cheers ron mel oz...
  • Johan1968Johan1968 Posts: 22
    edited 2008-02-11 10:59
    Hello Oz !

    So you mean that pin 3 will stand as a output and allso ainput at the same time ? or ?

    Thanks any way for this solution for this system.

    Tries to mace it work so ..



    Regards Johan
  • OzStampOzStamp Posts: 377
    edited 2008-02-11 12:54
    Hi Johan.

    Cog 1 generates 1000HZ on pin 3 which you connect to for example pin4 on Cog2 (with a resistor 1K or so to protect i/o pins)
    Using the synth object ( Beau Schwabe wrote this awhile ago.. or Martin Hebels BS2.functions object..

    Cog 1 detects the start (pin0) signal and also monitors the stop signal (pin1)
    Cog 1 also has an output to Cog 2 via for example pin5 which signals count or not count...



    Cog 2 looks at pin4 and counts the pulses when Cog 1 has been started.. (pin5 high)
    Use the CTRA mode with pins 4 and 5 as freq and enable...

    This is a thought that I have not tested but I am pretty sure this concept will work.
    You should be able to get 1/1000 of sec no problems at all .. as the counter register is 32 bits long...
    Even at 1000 HZ that will last a very long time...


    cheers ron mel oz.. where are you Johan in Europe somewhere..??
Sign In or Register to comment.