avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] interrupts


From: Jamie Morken
Subject: [avr-gcc-list] interrupts
Date: Thu, 17 Mar 2005 14:00:50 -0800

Hi,

When in an interrupt service routine, and another interrupt is triggered (ie. 
timer overflow) how does avr-gcc know to handle that other interrupt once the 
current interrupt exits?  Does it go right to the next interrupt?

I am using the 16bit timer1 to do PWM code. OCR1A is set to the timer1 overflow 
interrupt, and it turns the dutycycle on, and sets the PWM frequency.

OCR1B is set to the timer1 output compare interrupt and it turns the dutycycle 
off, its valid range is zero to OCR1A for 100% dutycycle.

When I have these two interrupts triggering very close together (ie at a high 
PWM frequency when OCR1A is a small number) the AVR will lock up.  I guess this 
is because there is not enough time to execute both interrupt service routines, 
so I have put a check in the code to make sure that the two interrupts have a 
minimum amount of time between them being called and it seems to work fine.

What other kinds of conditions are important to keep in mind to avoid 
intermittent lock ups of the AVR when using interrupts?  I need to make sure 
that the AVR doesn't reset, as it will be controlling a lot of inertia (me at 
10MPH+ on a dynamically balanced scooter) in real time! :)

cheers,
Jamie Morken






reply via email to

[Prev in Thread] Current Thread [Next in Thread]