Simple interrupts question

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Simple interrupts question

4,606 次查看
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.
标签 (1)
0 项奖励
回复
3 回复数

1,111 次查看
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 项奖励
回复

1,111 次查看
MJB
Contributor I
I'm using metroworks codewarrior.
0 项奖励
回复

1,111 次查看
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 项奖励
回复