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

Hos fast is the external interrupt on PIN_B0 of 16F628

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







Hos fast is the external interrupt on PIN_B0 of 16F628
PostPosted: Sun Apr 10, 2005 10:17 pm     Reply with quote

Hi,

MCU: 16F628
Compiler: PCM 3.15

I would like to count the number of pulses , given on RB0 of 16F628 , this is an interrupt pin.

What would be the highest pulse rate possible , so that the PIC does not miss out any pulses, ( On a 4 Mhz xtal) ?? I am counting only the low-to-high events.

thanks
arun
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Apr 11, 2005 3:24 am     Reply with quote

Quote:
Compiler: PCM 3.15
This is not a valid compiler version. Compiler versions have 3 digits after the dot. Check the top of your list file (*.lst) for the compiler version.

Running at 4MHz your processor is executing 1 million instructions per second. Using the standard CCS interrupt routines and version 3.216 the interrupt overhead for saving and restoring all registers, clearing and dispatching the interrupt takes 50 instructions. Assuming you could increment your counter in 1 instruction would allow for a maximum pulse rate of 19,607 pulses / second.

Building your own interrupt dispatcher using the #int_global is more efficient but requires great care in making sure you save all used registers. Let's assume you can do it all in 10 instructions, then you get a maximum of 100kHz pulse rate.

Please note that all this interrupt based counting assumes you have no other interrupts enabled.

The 16F628 has a hardware CCP module especially designed for the counting purpose, why don't you use it? You can even use of the timers for counting purposes up to rates much higher than possible in software.
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