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

external interrupt speed

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



Joined: 14 Oct 2008
Posts: 103

View user's profile Send private message

external interrupt speed
PostPosted: Fri Sep 11, 2009 8:56 pm     Reply with quote

Guys, if I have 12f675 with external 20MHz crystal oscillator what is the maximum external interrupt speed it can have? (within safe margins, without losing any interrupts).
Is there any theory or equation to calculate this so I can calculate speed for other pics?
And does this speed depend on programming language or compiler? (I use CCS C 4.084) Question
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Sep 11, 2009 10:21 pm     Reply with quote

See the description of the CCS interrupt handler code in this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=29173

Print the ASM code for the interrupt handler from the .LST file for your
version of the compiler. Write the number of instruction cycles next to
each instruction. Most instructions are one instruction cycle. Instructions
that execute a jump take 2 instruction cycles (if they do the jump).

You have to count the interrupt handler code that both enters and exits
from the interrupt. You also have to count the user code in your isr
routine.

Let's say that it takes 60 instruction cycles. At 20 MHz, you have 5
instruction cycles per microsecond. So the time is 60/5 = 12 us.

There is also a short amount of time necessary for the PIC hardware
to recognize and execute the interrupt (3 to 4 instruction cycles).

So if it takes 13 us, that gives a maximum interrupt rate of about 77 KHz.
But if you run interrupts at near that rate, your code in main() will have
a very small duty cycle. Most of the time will be spent in the interrupt
handler, just saving and restoring the context. Do you want to do that ?
aruna1



Joined: 14 Oct 2008
Posts: 103

View user's profile Send private message

PostPosted: Sat Sep 12, 2009 7:04 am     Reply with quote

thanks
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