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

manual interrupts

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







manual interrupts
PostPosted: Wed Mar 31, 2004 9:34 am     Reply with quote

I am new tot he compiler, can someone help me out??




I am manually enabling TMRO interrupt, and testing to see if the TMR0
flag has gone high within the global ISR()

#int_global

I KNOW THAT I COULD USE THE SPECIFIC #int_RTCC, but I want to
try using the global ISR.

MY QUESTION IS:

I KNOW THAT I HAVE TO DO THE FOLLOWING IN A GLOBAL ISR

test flags
clear flags


I have read somewhere you need to save the status of the registers
prior to entering the subroutine (WHEN?, HOW?,WHICH REGISTERS?)
valemike
Guest







PostPosted: Wed Mar 31, 2004 10:15 am     Reply with quote

All the registers are saved for you by CCS when you implement a your isr. Just make sure it is a "void fxn_name(void)".

If i have more than one interrupt source, then i usually just write two separate functions and use the appropriate #int_ext or #int_timer1 directives.

I don't have the manual in front of me, but I don't think there is a way to make a global isr. The Global Interrupt bit GIE (from mem.?) merely enables all selected interrupt sources or turns off all selected interrupt sources.

You really ought to do it the way CCS has prescribed for us. But if you want to try making a global isr like the assembly folks usually do, where they then sort out which is the active interrupt, then I think you'll have to write an isr routine and force its start address where the interrupt vector is for that device. Thus if, the interrupt vector starts at address 0x04, then you place your function starting at 0x04 in program memory. Then I guess you'll have to do all the register saving and restoring manually.
Ttelmah
Guest







PostPosted: Wed Mar 31, 2004 10:45 am     Reply with quote

valemike wrote:
All the registers are saved for you by CCS when you implement a your isr. Just make sure it is a "void fxn_name(void)".

If i have more than one interrupt source, then i usually just write two separate functions and use the appropriate #int_ext or #int_timer1 directives.

I don't have the manual in front of me, but I don't think there is a way to make a global isr. The Global Interrupt bit GIE (from mem.?) merely enables all selected interrupt sources or turns off all selected interrupt sources.

You really ought to do it the way CCS has prescribed for us. But if you want to try making a global isr like the assembly folks usually do, where they then sort out which is the active interrupt, then I think you'll have to write an isr routine and force its start address where the interrupt vector is for that device. Thus if, the interrupt vector starts at address 0x04, then you place your function starting at 0x04 in program memory. Then I guess you'll have to do all the register saving and restoring manually.


There is an example on using the #int_global included with the compiler. ex_glint.c
The registers you have to save, depend entirely on what you do. For instance, on the 18F famiy, the default handler saves W, status, BSR, and then goes ahead, and saves the table pointers, FSR registers, and the scratch area. You can save a _lot_ of time, by not saving these, if you write your ISR not to use them. The table pointers are used for array accesses, and switch statements using a table jump. The scratch area is used when calling a subroutine which returns a value, and some larger arithmetic operations. If (for instance), you are handling a simple operation, and keep it down to just integer increment/decrement type operations, you can reduce the interrupt latency by as much as 10 instruction times, by not doing the save.

Best Wishes
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