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 CCS Technical Support

multiple interrupts -- determining frequency of signal

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



Joined: 16 Mar 2005
Posts: 3

View user's profile Send private message

multiple interrupts -- determining frequency of signal
PostPosted: Sun Apr 10, 2005 9:36 pm     Reply with quote

Basically, I'm curious what the best way to determine the frequency of a singnal is. I have the input hooked up to the rb0/int pin on the PIC. I enable interrupts and have an int_ext interrupt set up.

The way that I'm thinking of coding this is to have the interrupt subroutine jump into a function that will start a timer and wait for another interrupt to come. Once this second interrupt comes it will check to see the value of the timer and calculate the period of time that has elapsed.

What I'm curious about it if there's a way to receive multiple interrupts while in the ISR. Also with a 20MHz clock and a ~6KHz signal will there be too much overhead of hopping in and out of functions that it will mess up my value?

Any suggestions or examples would be greatly appreciated. Thanks in advance! Smile
Mark



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

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

PostPosted: Sun Apr 10, 2005 9:43 pm     Reply with quote

If your PIC has a CCP module, then look there. Read the section in the datasheet on it. You can configure it to capture a timer value. Knowing the rate of the timer will allow you to calculate the freq.
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