Re: Timing pulses
- From: "petrus bitbyter" <pieterkraltlaatditweg@xxxxxxxxxxxxxxxxx>
- Date: Thu, 13 Aug 2009 17:27:23 +0200
"BobS" <rnscrs@xxxxxxxxxx> schreef in bericht
news:563cb9f9-4ea6-4ba7-863c-42f67aea51c2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Aug 12, 8:02 pm, "petrus bitbyter"
<pieterkraltlaatdit...@xxxxxxxxxxxxxxxxx> wrote:
"Joerg" <inva...@xxxxxxxxxxxxxxx> schreef in
berichtnews:7eg4amF2fg30rU1@xxxxxxxxxxxxxxxxxxxxx
petrus bitbyter wrote:
"BobS" <rns...@xxxxxxxxxx> schreef in bericht
news:f534aed1-9a52-4346-94af-f7aea8e07c75@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
What is the best way to measure the time between 2 pulses, each a
separate signal? I'd like to do this with a micro, but am concerned
about faulty timing when the pulses are near each other. The pulse
pair repetition rate is about 80Hz, with the time between pulses from
near 0.0 ms to near 12.5ms.
You can bet you will get faulty timing when the pulse are very near. A
micro has a instruction cycle time of let's say 0.2us. Impossible to
measure the time between the pulses edges if that time is only some ns.
...
Not impossible. You could, for example, measure the bulk of the delay
with
the internal timer and an interrupt routine. If it has to be
super-precise, the "left-overs" at the beginning and the end could be
handled by ramp circuits that are then read out with an internal ADC.
... So with a simple
micro you can measure times downto let's say 1us. Using some extra
hardware (Jan Panteljes flipflop for instance) and the right micro you
can go downto about 0.1us. Shorter times can be detected or missed.
Accuracy depends on the accuracy of your clock.
--
Regards, Joerg
http://www.analogconsultants.com/
"gmail" domain blocked because of excessive spam.
Use another domain or send PM.
As far as I understood, the time between the start of two pulses has to be
measured. Each on has own line and they are apparently unrelated. I see no
way to measure ns or even tens of ns using a micro with a us clock. The
standard procedure, starting a timer on one edge and stopping it on the
other, using interrupts, will fail if the time between that edges becomes
too short. Uncertainty is in the magnitude of at least on processorcycle.
You sure can do better using some additional hardware. Jan Pantelje
mentioned a flipflop and you some ramp circuits. A fast (external) clock
may help as well. Most important you can prevent unreliable results that
you
are not aware of.
I do not like to go much deeper in it as long as the OP does not make
clear
what his actual requirements are.
petrus bitbyter- Hide quoted text -
- Show quoted text -
|
| Its been an interesting discussion.
|
| Additional information;
|
| Both pulses are about 1 ms long, and can coincide with the time
| between A and B pulses edges right at if not zero, or the time is long
| enough B pulse is on top of the following A pulse. This indicates
| edge detection is required, and missing an edge could cause wildly
| inaccurate results. The data is in the time the B pulse follows the
| preceding A pulse. and is always a positive number.
|
| 8 bit accuracy is adequate. A micro has not been selected pending
| arriving at a scheme for this task, preferably the smallest micro
| possible for cost and space. The micro does have to manage a 25 Hz
| PWM out in addition to the input pulses.
|
| The ramp circuit referred to above does differentiate the pulse edge
| and requires bilateral switches or possibly a couple Mosfets. An RC
| ramp is iffy, nonlinear but simple. I'd like to use a constant
| current source for the ramp but prefer minimum parts. A constant
| current diode might work if the current tolerance isn't an issue.
|
| Any further suggestions appreciated.
|
Measuring a 12.5ms interval with 8 bit accuracy means time steps of about
50us. A PIC like a 16F628 running on its internal 4MHz clock has an
instruction time of 1 or 2us. As your pulse width is about 1ms you will
always have plenty of time using the conventional procedure. No need to miss
an edge either. On the first edge you can check whether or not the second
one already occured. If not, you start a counter and wait for that edge,
otherwise you found the time <=50us but sure did not miss it.
petrus bitbyter
.
- References:
- Timing pulses
- From: BobS
- Re: Timing pulses
- From: petrus bitbyter
- Re: Timing pulses
- From: Joerg
- Re: Timing pulses
- From: petrus bitbyter
- Re: Timing pulses
- From: BobS
- Timing pulses
- Prev by Date: Re: passive component tolerances for op amps used in front end of 18-bit ADC
- Next by Date: Solution manual to Principles Of Corporate Finance 9E By Brealey Myers Allen
- Previous by thread: Re: Timing pulses
- Next by thread: Re: Timing pulses
- Index(es):
Relevant Pages
|