[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-libc-dev] atmega32 and interrupt handler problem
From: |
Andrew S |
Subject: |
[avr-libc-dev] atmega32 and interrupt handler problem |
Date: |
Tue, 15 Jan 2008 20:56:43 -0700 |
User-agent: |
KMail/1.9.6 (enterprise 0.20070907.709405) |
I have been having a problem the last couple of days, I'm hoping someone here
has some advice:
I am trying to write a simple interrupt handler for handling a TIMER2
comparison interrupt. I placed this at the top of my code:
ISR(TIMER2_COMP_vect)
{
PORTD ^= 0x40;
}
The Timer registers were initialized as appropriate, and interrupts (as well
as the appropriate mask) were enabled. The interrupt was being generated, but
the interrupt handler routine defined above was not being run, instead the
microcontroller was being reset.
I was able to get the interrupt handler to run by adding the following code:
ISR_ALIAS(__vector_default, TIMER2_COMP_vect);
Confirming that the interrupt was being generated, but not being handled
correctly.
Investigating this further, I found that the following corresponded with the
microcontroller running the correct interrupt handler for the interrupt in
question:
ISR(_VECTOR(8))
{ .. }
Examining iom32.h, TIMER2_COMP_vect has been defined as _VECTOR(4). The
difference (unconfirmed) being that $008 is the interrupt vector address and
4 is the index number? Can someone with more knowledge explain whats going on
here?
--
Andrew S.
- [avr-libc-dev] atmega32 and interrupt handler problem,
Andrew S <=