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

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

Re: [avr-gcc-list] Hard coded asm in an interrupt routine


From: Grant Stockly
Subject: Re: [avr-gcc-list] Hard coded asm in an interrupt routine
Date: Thu, 25 Jul 2002 09:53:13 -0800

At 09:29 AM 7/25/2002 -0600, you wrote:
If you're integrating this into a C project, why not use the processor timers to achieve your timing requirements instead of nops and jmps?

I need to have 4 precise 10kHz timers with the same time base and with ~14bit accuracy. So I use the 16 bit timer, and on every 10kHz overflow I generate an external interrupt to run the secondary timers.

You could "bookend" the assembly routine: In C, initialize an output compare for the fixed time length, then call or inline your assembly code (minus the additional jmps and nops), then in C, sit in a loop waiting for the output compare to match. The only other caveat is to make sure that the timer output compare is not being used in the mainline code and only used in your ISR.

My most important question is in an ISR in C, can I use the temporary registers in the AVR for anything that I want? I don't plan on having any C code in the ISR. Just a C shell.

Grant

avr-gcc-list at http://avr1.org



reply via email to

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