PDA

View Full Version : Delay with 50nS resolution...



batee
- 17th May 2006, 21:17
I'm working with 18 pin devices (16F88 is what I'm using now, but I'm open to whatever). I need a way to do timing down to about 50nS resolution. By my calculations, with a 20MHz clock, a clock cycle will be 50nS and an instruction cycle will be 200nS. Even if I went with a 40MHz proc, I wouldn't achieve my goal.

Is there a way to do resolution with a (hopefully small/cheap) PIC?

Thanks,

Bryan A. Thompson
[email protected]

Melanie
- 18th May 2006, 16:46
No, not with a PIC at this time.

BigWumpus
- 18th May 2006, 21:51
50ns


Whow !!!

15 meters of lightspeed.... ;-)

Melanie
- 19th May 2006, 01:30
Your calculator is 10.3mm faster than mine....

Luciano
- 19th May 2006, 13:13
Beer slows your reaction time!

In one nanosecond, light travels about 22.26 cm in beer.
(Beer has a refractive index of 1.3466).

In one nanosecond, light travels exactly 29.9792458 cm in a vacuum.
(Refractive index of a vacuum is defined as having a value of 1.0).

In one nanosecond, light travels about 29.89 cm in air.
(Refractive index of air is 1.003).

The exclusion of water from this theory was intentional.
(RI 1.33).


Luciano

ErnieM
- 19th May 2006, 18:28
Of course you can! (And you were worried, right?)

Courtesy Electronic Design mag:

[Design Briefs]
Measure Nanoseconds With A PIC Microcontroller

Jeffrey L. Rothman, Richard Michta
ED Online ID #5649
September 1, 2003

"Based on a PIC16F887 MCU, this circuit described measures pulse lengths from 2 to 950 ns with a 1-ns resolution."

http://www.elecdesign.com/Articles/ArticleID/5649/5649.html

Melanie
- 20th May 2006, 02:12
But it's not a real-time measurement, but one that is delayed by the response of the ADC spinning up, and the PICs associated instruction processing. The equivallent of "Can I use an Abacus to calculate the National Debt?". Sure you can if you wait long enough for an answer....

batee
- 22nd May 2006, 14:52
I think it's a shame that Ernie contributed a useful answer, the first I've seen around these parts, and gets mocked for it? By an admin?

Melanie
- 22nd May 2006, 15:10
No, it was a valid answer. If you want to convert your Digital signal to Analogue, then wait, then have it converted back to Digital... then that's fine. But as at today, they've not made a PIC that can measure 50nS without a heap of external help.

>the first I've seen around these parts

Are you suggesting that this forum doesn't provide useful answers to it's members?

batee
- 22nd May 2006, 15:17
>the first I've seen around these parts

Are you suggesting that this forum doesn't provide useful answers to it's members?[/QUOTE]


Quite.

Melanie
- 22nd May 2006, 16:52
That's kinda insulting to everyone that's ever helped someone on this forum. From your posts I don't think you're qualified to make that kind of comment - even you got an answer by Ernie (thanks Ernie by the way, because batee obviously doesn't appreciate the answers folks receive here). Which begs another question, if this forum is so bad, then what are you doing here? After one and a half years since you became a member, how many times have you given up a jot of your time to help someone else?

batee
- 22nd May 2006, 17:04
While I have no Earthly idea how many posts I've made here, I can tell you exactly how many times I've given the unhelpful responses "RTM" or "Use Search Tool": 0 And for that I am most proud.

The elitist attitude (reference your "not qualified" comment) and the unhelpful and in this case harmful and argumentative responses have indeed caused me to think twice before posting. Now it will be three times.

Bryan

Acetronics2
- 22nd May 2006, 18:03
Hi, Bryan

I could answer you your " problem" deals with pure assembler ... and this is not here the right place to post it.

I will just tell you some ANs from µchip's site play with those time windows.

My electronics knowledge ( LOL !!! ) tell me to use a HF oscillator, a gated counter ... and read the counter result.

This sounds familiar to me as I read a while ago a datasheet from µchip where it was written " external gated TMR1 " ...

as I am a kind guy ... I remember it was the 16F636 ... but may be this feature exists aboard other PICs.

Counting my answers to your threads, I know one thing : a bit will be enough for that.

Alain

PS : "RTFM " means a little brain work from the author is Welcome. This Forum is not intended to give you " already kooked " solutions... But to try to learn you something ...

The Chinese story of the fisherman ...
or else:
If the finger shows the moon, the idiot looks at the finger ...

SteveB
- 22nd May 2006, 19:13
Bryan,
I find your responses to Melanie quite shortsighted. In the short time I have been a member of this forum, I have read countless posts from Melanie (and many others) containing great information and answers. However, as Alain pointed out, this forum is not about giving people cookie cutter answers (but that does happen). Nor is it a place to substitute for someones lack of effort. It is more about helping people work through the process of application and understanding.

As you can deduce from my avatar, I am a Pilot. More accurately, for the last 10 years I have been an instructing pilot teaching others to fly. It is quite common for me to respond to a student's question with some version of RTFM, particularly when the question involves simple factual information which is easlily located (or when I preceive a lack of effort in learning the information). On the other hand, if a student has a question related to the application of what is in the manual, then I get excited. Now I can really do my job and help them work through the question/problem to get the answers. In the process, hopefully, they will learn more than just the answer to their question. That is exactly what I have seen on this forum, and why I consider it a key resource in my PIC education.

Is the response "RTFM" used too often by some, or employed rudely and indiscriminatly? Perhaps. But is that a reason to discount all the insightful, and FREE, help that is provided by the active (and very cabable) members of this group? Certainly not.

As for this thread, Melanie's second post was spot on, and not mocking at all. It did not reject the technique given, just pointed out that it
had considerable weaknesses in application, and may not be appropriate for your intended application.

As for me, thanks Melanie, Alain, Steve (mister_e), Darrel, ErnieM, and the many others I can't remember off the top of my head. I have learned a lot from your contributions.

Steve

Melanie
- 22nd May 2006, 19:28
Well I'm sorry the forum doesn't meet your expectations. There's a couple of thousand members, some who contribute and some who don't, some who provide help, and some who receive help that would probably disagree with you that the forum isn't a useful source of information, education, inspiration and more than occasionally a kick up the butt where it's needed.

Now Ernie provided a nice answer for you, and I simply commented that it's not strictly the PIC measuring in real-time. But since I'm not aware if you wanted real-time measurement or not it could well be the exact thing you're looking for. Great - another statisfied punter rides into the sunset.

In the same way other folks have received answers, help, tips, schematics, code, set-up information and heaps of other goodies from this forum - you've obviously missed those posts. Some may even have been helped along the way. That information may not have been of use or interest to you - but it was to somebody somewhere. I stand by my comments - all of them!

BigWumpus
- 22nd May 2006, 19:32
Why must I think to "eng444" ?

mister_e
- 22nd May 2006, 22:12
probably because some of your lights blinked :D