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

Lost cycles in interrupt call

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



Joined: 07 May 2013
Posts: 23

View user's profile Send private message

Lost cycles in interrupt call
PostPosted: Mon Oct 14, 2013 11:24 am     Reply with quote

Hello,

I am writing a very time sensitive 8 bit MCU application where processor cycles are at premium.

I am trying to replace an interrupt handling routine with assembly, but even before the processor reaches the interrupt service function there are already 50 lost cycles spent determining the source!

Is there a way I can tap into the interrupt control to speed up the redirect for this particular higher priority interrupt?

Many thanks for your input.
temtronic



Joined: 01 Jul 2010
Posts: 9178
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Oct 14, 2013 11:51 am     Reply with quote

You should use the 'search' option for this forum.
This topic has been covered quite a few times.
Depending in the PIC type 16,18,24,dsPIC you have several options on how to handle the task.
Easiest is to write your own 'global ISR' handler and not use the CCS supplied one.As you've found out about 50 cycles are used to handle the handler.....
Another 'cheat' is to max out the speed of the PIC or change PIC to a faster one.18s generally are faster than 16s.
Obviously do NOT do ANY math,especially FP operations in your ISR, do NOT use 'printf' either.ISR mantra...get in quick, set a flag or two, get out fast.

If you post your code, we may be able to help further..

hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19383

View user's profile Send private message

PostPosted: Mon Oct 14, 2013 12:31 pm     Reply with quote

50 cycles is more than should be lost. Typically 30 if there is only one interrupt handler. However if there are multiple handlers the interrupts are polled in order until you get to the one to be serviced. Each poll involves testing the IE, and the interrupt bit, so takes about five cycles. It sounds as if there is more than one interrupt enabled, and the one you are timing, is quite well down the list.
Temtronic has pointed out that this has been covered many times in the past. Also look at EX_GLINT.C. The 'equivalent' for high priority interrupts, is the 'fast' directive.

Best Wishes
jackmicro



Joined: 07 May 2013
Posts: 23

View user's profile Send private message

PostPosted: Mon Oct 14, 2013 1:08 pm     Reply with quote

thanks. Will do.

Much appreciated.
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