On 6/13/07, Dave Hylands <dhylands@...> wrote:
> How are you declaring your interrupt? If you're using an older gcc you
> want to use SIGNAL and not INTERRUPT. For newer gcc's use ISR
I double checked, this is correct for my gcc (ISR).
I've done 1 Mb serial, which is generating interrupts 100,000/sec.
> That still gives 160 instructions/interrupt.
> Make sure you're compiling with -Os
Also, if it's at all possible make sure that there are NO function
> calls in your interrupt handler. GCC is smart enough to only save the
> registers that are actually used in the interrupt handler, but as soon
> as you add a function call (inlined functions are fine), GCC no longer
> knows which registers the called function might use, so it has to save
> quite a few more.
No function calls.
> System clock / 256 is 62,500Hz and so I set Timer/Counter2 to increment
> > the system clock and interrupt on the overflow, which I gather should
> > the desired effect. However... my Robostix was soon unresponsive...
> > makes sense I guess, as the quadrature decode logic is probably barely
> > finished with the first interrupt before the next arrives at this
> > I am relatively new to this whole thing, but presuming I'm not
> > something, might anyone have a suggestion as to how to minimize the
> > I'll observe on the encoder counts given the above?
> If you can't get that to work, I have some LS7366 chips for sale on my
> web site. These have an SPI interface and maintain an internal 32-bit
I was actually updating four counters in the ISR, I had managed to overlook
this critical point. Further experimentation revealed the fourth was the
straw that broke the camel's back. I scaled back to two, which works fine
for now at the higher frequency... but eventually I'll need all of them. I
may be back for those chips! :]
Thanks for the help!