AVR Silly Interrupt problem
- From: "ja.......@.mail.com" <jasimpson@xxxxxxxxx>
- Date: 3 Feb 2006 00:16:14 -0800
I have timer0 set to overflow and generate an interrupt, but for
whatever reason AVR Studio doesnt seem to be doing what the ISR is
supposed to be doing! I'm attaching the code here, can you find
something that I'm missing!?
Is this a problem with the simulation in AVR Studio or with the code
itself? I haven't tested it on a device yet.
#include <avr/io.h>
#include <avr/interrupt.h>
ISR(TIMER0_COMP_vect) {
PORTA = 0xAA;
TCNT0 = 0x00;
}
void init_timer(void) {
sei();
TCCR0 = 0x0D; // Force Output Compare Off - CTC mode - OC0
disconnected
TCNT0 = 0x00;
OCR0 = 0xA0; // Overflow at 0xA0;
TIMSK = TIMSK | 0x02 ; // Generate interrupt on Overflow
TIFR&=~(1<<TOV0);
TIFR&=~(1<<OCF0);
}
int main (void) {
DDRA = 0xff; // Set Port A as output
init_timer();
while(1) {}
return 0;
}
Thanks,
Jim
.
- Follow-Ups:
- Re: AVR Silly Interrupt problem
- From: Meindert Sprang
- Re: AVR Silly Interrupt problem
- From: ja.......@.mail.com
- Re: AVR Silly Interrupt problem
- Prev by Date: Re: DS1307 no response
- Next by Date: Re: AVR Silly Interrupt problem
- Previous by thread: books or materials for vxworks
- Next by thread: Re: AVR Silly Interrupt problem
- Index(es):