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

Frequency meter

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



Joined: 22 Dec 2003
Posts: 82

View user's profile Send private message

Frequency meter
PostPosted: Tue Jan 06, 2004 11:20 am     Reply with quote

I want to measure frequency in range of 20KHz-40KHz the accuracy can be few hertz.
I think of useing the CCP in capture mode (div by 16)
and timer0 div by 1.

The device is 16F819 or 16F877.

1. Can someone help me with a simple code for that? or give me another idea how to do it?
2. Is it posible to read the CCP value at the CCP event without an interrupt
or I must wait for the Interrupt to read the CCP value

Thanks.
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: Frequency meter
PostPosted: Tue Jan 06, 2004 11:43 am     Reply with quote

edi wrote:
I want to measure frequency in range of 20KHz-40KHz the accuracy can be few hertz.
I think of useing the CCP in capture mode (div by 16)
and timer0 div by 1.

The device is 16F819 or 16F877.

1. Can someone help me with a simple code for that? or give me another idea how to do it?
2. Is it posible to read the CCP value at the CCP event without an interrupt
or I must wait for the Interrupt to read the CCP value

Thanks.


You can use the 16 bit timers to count instruction cycles and have a period of fixed time. You can use another timer to count rising edges on it's external clock input pin. You may then compute cycles per time and then convert to frequency. I have not used the CCP module to measure frequency but I know it can be done. I dont think that you can get the same level of accuracy with the CCP module that you can get using timers. The method using timers will only work on a periodic signal. For capture of a single cycle to determine frequency the CCP module is better.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 06, 2004 1:07 pm     Reply with quote

Here are links to some tachometer examples which use
the CCP. These are for the CCS compiler. Both of these
contain full source code. Also, you can search this board
for CCP, or tachometer, and find various routines that
are helpful.

Look at the project called: DIESEL TACHOMETER
http://www.vermontficks.org/

Look at the project called: PicTacho
http://home.t-online.de/home/cord.johannmeyer/
edi



Joined: 22 Dec 2003
Posts: 82

View user's profile Send private message

PostPosted: Wed Jan 07, 2004 5:52 am     Reply with quote

Thanks a lot.
Guest








PostPosted: Fri Jan 09, 2004 11:44 am     Reply with quote

Try www.respiflow.com their hardware is already programed to capture frequency at your specified range and o/p to rs232
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