Simple interrupts question

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Simple interrupts question

4,604件の閲覧回数
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,109件の閲覧回数
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,109件の閲覧回数
MJB
Contributor I
I'm using metroworks codewarrior.
0 件の賞賛
返信

1,109件の閲覧回数
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 件の賞賛
返信