Simple interrupts question

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Simple interrupts question

3,992 Views
MJB
Contributor I
Hello,

I think when an interrupt is triggered the cpu goes to a vector table. From this vector table it'll do whatever you tell it to do.

So I guess in the appropriate vector location you'd say

BRA (address of isr)

And at the address of your ISR you just do your code and pop in an RTI at the end.

Now the simple question is... How do you do this in C?:smileyhappy:

Thanks and apologies for the dumb Qs.
Labels (1)
0 Kudos
3 Replies

497 Views
peg
Senior Contributor IV
Hi MJB,
Almost correct!
When the interrupt is triggered the CPU does not _go_ to the vector table it retrieves just the address of the ISR (interrupt service routine) and loads it into the PC (programme counter) then starts executing from there until it sees a RTI, then back to where it left from.
As to how it is done in C, you should tell us what compiler as it varies a lot between them.
BR Peg
0 Kudos

497 Views
MJB
Contributor I
I'm using metroworks codewarrior.
0 Kudos

497 Views
bigmac
Specialist III

Hello MJB,

You will find CW ISR issues briefly described in the FAQ section, towards the end of AN2616.  Three alternatives are available.

Regards,
Mac

 

0 Kudos