CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

18F452 Capture Module Inquiry

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ritchie



Joined: 13 Sep 2003
Posts: 87

View user's profile Send private message

18F452 Capture Module Inquiry
PostPosted: Thu Jul 14, 2005 4:27 pm     Reply with quote

Hi,

I just want to know. What is the smallest pulse width that can be captured using a 20MHz clock?.

What ways that can increase the resoultion of the capture module?

Need your feedback.

Thanks.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Jul 14, 2005 7:15 pm     Reply with quote

The capture stores the timer1 value (or timer3 on some pics). At 20MHz the resolution is max 200ns. So technically 200ns is the smallest pulse. But this would be with a large error rate. With a 10% error it would be 2us. Your capture count could always be off by 1. So you would have to determine what is acceptable. If this signal was repeating, you could do some averaging to get better results. You could also use a frequency divider for repeatative signals to increase the capability.
ritchie



Joined: 13 Sep 2003
Posts: 87

View user's profile Send private message

PostPosted: Fri Jul 15, 2005 8:53 am     Reply with quote

Mark wrote:
The capture stores the timer1 value (or timer3 on some pics). At 20MHz the resolution is max 200ns. So technically 200ns is the smallest pulse. But this would be with a large error rate. With a 10% error it would be 2us. Your capture count could always be off by 1. So you would have to determine what is acceptable. If this signal was repeating, you could do some averaging to get better results. You could also use a frequency divider for repeatative signals to increase the capability.


Hi Mark,

So I need a frequency divider such that I can increase the pulse width. Is their a recommended chip or cirsuits that can be utilize for this frequency divider.

Thanks.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Jul 15, 2005 8:57 am     Reply with quote

Many ways to do it. For examples look here
http://www.google.com/search?hl=en&q=frequency+divider+circuit
sseidman



Joined: 14 Mar 2005
Posts: 159

View user's profile Send private message

PostPosted: Fri Jul 15, 2005 9:16 am     Reply with quote

ritchie wrote:

Hi Mark,

So I need a frequency divider such that I can increase the pulse width. Is their a recommended chip or cirsuits that can be utilize for this frequency divider.

Thanks.


Can you be more specific about what you need? If you have a short pulse width, and just need to stretch it out to some constant minimum, you want a one-shot (search on "monostable multivibrator"), and not a frequency divider.

Scott
ritchie



Joined: 13 Sep 2003
Posts: 87

View user's profile Send private message

PostPosted: Fri Jul 15, 2005 6:43 pm     Reply with quote

Mark wrote:
Many ways to do it. For examples look here
http://www.google.com/search?hl=en&q=frequency+divider+circuit


I don't think a one-shot multivibrator will do the trick coz I'll be capturing a series of pulse stream (high and low pulses) from 2uS to 10uS pulse width.

I guess what Mark suggested is a very good inputs for my project.

Thanks.
sseidman



Joined: 14 Mar 2005
Posts: 159

View user's profile Send private message

PostPosted: Sun Jul 17, 2005 11:35 am     Reply with quote

ritchie wrote:
Mark wrote:
Many ways to do it. For examples look here
http://www.google.com/search?hl=en&q=frequency+divider+circuit


I don't think a one-shot multivibrator will do the trick coz I'll be capturing a series of pulse stream (high and low pulses) from 2uS to 10uS pulse width.

I guess what Mark suggested is a very good inputs for my project.

Thanks.


Just be sure to spend plenty of time with this project on paper before you count on anything working! Gather up all the datasheets, and draw a timing diagram of the divider output for every input sequence you're likely to see. be sure to do this for every relative phase of the input vs output clock (i.e., if you're dividing by four, use 0 cycle delay to 3 cycle delay). You'll save yourself a ton of effort.

I don't think a divider will work here, depending upon what the true nature of your input signal is. A divider is not simply a buffer that will take your signal and pump it out slowly. They don't simply play back an input at a slower speed. A random signal at 20MHz will look very different when you pass it through a frequency divider. By definition, you are losing information.

I'd try a number of different approaches, depending on what your exact needs are. First, try bringing the chip speed up to 40MHz. You can do this by using a 10MHz crystal and using the on board 4X PLL multiplier. If this is fast enough, you're done. Based on what Mark said about 2us having a 10% error rate, and your 2us minimum pulse width, it would seem that if you run at 40MHz, you'd be golden.

If this isn't fast enough, now you need to start thinking about a guaranteed-to-work hardware solution. Do you know when your signal will be coming in, and is it of a reasonable length?? If so, I'd try capturing it with a fast shift register, and either parallel-shifting it into the controller when it's done if you have enough free I/O, or bit shifting it in at a rate the controller would like. The latter is tougher, as you'll likely need to do some logic on the clock input of the shift register. Clock synchronization might become an issue either way. Here's where a frequency divider can come in quite handy-- generate your fast shift register clock with something real fast, and divide it down to clock your controller.

It all depends on your needs, whether you're willing to accept error, and the exact nature of the input signal (which I suspect you'll give to us in dribs and drabs until your problem is solved). If it were me, and the input waveform were not extremely well defined, I'd avoid the frequency divider on the input waveform like the plague.

Scott
ritchie



Joined: 13 Sep 2003
Posts: 87

View user's profile Send private message

PostPosted: Mon Jul 18, 2005 6:46 am     Reply with quote

Scott,

That was a very good input. Actually, I am gathering information of what is not pain in the [spam] to do...

Anyway, I'll try your suggestion on my application.

Thank you.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group