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

About timer0

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



Joined: 28 Jul 2005
Posts: 3

View user's profile Send private message

About timer0
PostPosted: Thu Aug 11, 2005 6:38 am     Reply with quote

Hi, I`m using a PIC18F452. Can somebody give me some code to make timer0 interrupt every 10 us?
MikeValencia



Joined: 04 Aug 2004
Posts: 238
Location: Chicago

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

PostPosted: Thu Aug 11, 2005 9:48 am     Reply with quote

Do you want 10 microseconds or 10 milliseconds?

At 10 us, you'd be interrupting ALL the time, and won't have any time to do stuff outside the ISR!

For example, at 4MHz, each instruction would take 1uS to fulfill, and isr context saving overhead alone is a good 20+ instructions.

If you really want a solid 10uS delay, then you'd have to turn off interrupts, and do 10 Noops (@4Mhz Fosc), or call delay_us(10); or delay_cycles(10);
Mark



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

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

PostPosted: Thu Aug 11, 2005 10:54 am     Reply with quote

You also don't specify the frequency of the PIC which is important.
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