PULSIN timing of 2 seperate pulses for speed trap
Lloyds
Posts: 75
Hi,
I need help with a logic circuit to measure the time (PULSIN counts) betweeen the leading edge of a start pulse and the leading edge of a stop pulse. Basically a counter for a speed trap.
Here is what I think I need to do:
1) Stamp pin one is input, pulled Low.
2)·give the ·PULSIN command for input pin 1.
3) External Start pulse occurs (~5 Vdc)
4)·Via the logic circuit, this drives pin 1 high.
5) PULSIN starts counting
6) External Stop pulse occurs (~5 Vdc) (this comes from a different source than the start pulse).
7)·Via the·logic circuit, this drives pin 1 Low.
8)·PULSIN stops counting (less than 1 mSec total count time) and writes number of counts to "count" variable.
It sounds simple enough and I know that I probably need to use one of the logic circuits from this page, but I am overwhelmed by the selection.
http://www.play-hookey.com/digital/derived_gates.html
I am assuming that I can't directly use the inputs to 2 seperate stamp pins with PULSIN.
There are a couple of other things I want to do:
9) Reset the logic circuit immediately before giving the PULSIN command to make sure pin 1 is low.
10) Make sure the counter works correctly whether or not the start input is still high when the stop pulse goes high.
Can anyony offer some suggestions on how to accomplish this?· I will study the logic circuits some more ·to see if they become logical!
Thanks very much.
Lloyd
I need help with a logic circuit to measure the time (PULSIN counts) betweeen the leading edge of a start pulse and the leading edge of a stop pulse. Basically a counter for a speed trap.
Here is what I think I need to do:
1) Stamp pin one is input, pulled Low.
2)·give the ·PULSIN command for input pin 1.
3) External Start pulse occurs (~5 Vdc)
4)·Via the logic circuit, this drives pin 1 high.
5) PULSIN starts counting
6) External Stop pulse occurs (~5 Vdc) (this comes from a different source than the start pulse).
7)·Via the·logic circuit, this drives pin 1 Low.
8)·PULSIN stops counting (less than 1 mSec total count time) and writes number of counts to "count" variable.
It sounds simple enough and I know that I probably need to use one of the logic circuits from this page, but I am overwhelmed by the selection.
http://www.play-hookey.com/digital/derived_gates.html
I am assuming that I can't directly use the inputs to 2 seperate stamp pins with PULSIN.
There are a couple of other things I want to do:
9) Reset the logic circuit immediately before giving the PULSIN command to make sure pin 1 is low.
10) Make sure the counter works correctly whether or not the start input is still high when the stop pulse goes high.
Can anyony offer some suggestions on how to accomplish this?· I will study the logic circuits some more ·to see if they become logical!
Thanks very much.
Lloyd
Comments
Post Edited (Mike Green) : 7/28/2010 4:37:23 PM GMT
1. will the direction always be the same ( same sensor is always 1st )
2. will the sensors be pulsing on then off or pulsing on and staying on for any length of time ( staying on while the object is moving through)
3. are all the objects moving through the same size
Ok three I can't count
first pulse to set it, second pulse to reset, the Q output to your Stamp input. A refinement would be a second reset input, so that both the Stamp and the external pulse could put it in the ready state. You make this out of two cross coupled OR gates that are contained in one chip.
You said the total time will be less than one millisecond. The Stamp BS2 measures PULSIN in units of 2 microseconds.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
I had a mental block about learning the logic principles, but I think the time has arrived to just do it.
Mike, I studied the two possibilities you mentioned and hadn't realized that you could click on the inputs in the Play Hookey site to change the states and see how the gates responded. Very cool, and its starting to make sense! This is good!
Thanks again,
Lloyd
I've attached a pdf of a circuit I think will work, but I'm a total novice and like to ask about my "good ideas."
I'm pretty sure the logic will work and that the reset sequence will work, but I'm wondering if I am not making it too complicated.
Again, timing starts when trap·1 goes high, and stops when trap 2 goes high.· But the complication is that trap·2 might go·high before OR after trap·1 goes low.· Both traps will always go low within about 20 milliseconds.
Do I need all 4 diodes, and what about the resistors and their values?
Thanks for any suggestions.
Lloyd