Using NMI with timer

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I'm using a UC3C. I need an interrupt each usec with a timer. I am working at 65MHz with PLL, the fastest interrupt I can get is each 2.7usec. The problem is the interrupt routine takes ~120 cycles by itself so I can't get it within a usec. I was looking at the NMI interrupt, is there a way to link the timer interrupt with NMI, instead of using autovector?

Sorry for my English :wink:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

inquirer888 wrote:
I was looking at the NMI interrupt, is there a way to link the timer interrupt with NMI, instead of using autovector?
No, I don’t think so. I also don’t think that that would help you.

Your first problem is that you’re probably using the ASF. The interrupt handling of the ASF functions is very slow. See this thread. Even if you save 5 clock cycles by using the NMI interrupt, you still have the ASF weighing you down.

The second problem is that if you want a 1 μs interrupt with a clock speed of 65 MHz, you only have 65 clock cycles available per interrupt. Entering an interrupt handler takes at least 12 cycles and exiting takes another 12. So in a best case situation, you only have 41 clock cycles available. You can’t really do much with that, unless you’re trying to make a trivial program, IMO.