TIM1 vs TIMER1 on Uno vs ATTiny24/44

Sheesh! Just took me nearly 12 hours to work this out...

I had a piece of code to read an IR remote control using interrupts with Timer! input capture. It was written on 16MHz Arduino Uno R3 and once it was working perfectly, I ported it to an 8MHz ATTiny24. I tweaked some values to cope with the slower clock...and...nothing, zip, nada, zero, zilch.

TURNS OUT that the Timer1 Overflow ISR on ATTiny24/44/84 is called TIM1_OVF_vect whereas it seems to be called TIMER1_OVF_vect everywhere else. Bizarrely the capture vect TIMER1_CAPT_vect works fine on ATTiny24/44/84.

I changed it to TIM1 and it burst into life perfectly.

Anyone know why this is?

PS The code is 1500 bytes and won't run on the '24..I guess I'm getting heap/stack clash in that small memory space? The '44 runs like a dream.

I have learnt a lot in those 12 hrs, but I wish I hadn't had to!!!!

I guess I will put some #if's in the code and get rounf it that way for portability.

No real reason. Just happens to be what Atmel decided to call them in the datasheet. See page 41 of the Attiny84 datasheet.

For a complete list of vector names used in avr-libc, see this page:

http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html

If you want compatibility between codes, add this to the top of your sketch:

#if !defined(TIMER1_OVF_vect) && defined(TIM1_OVF_vect)
#define TIMER1_OVF_vect TIM1_OVF_vect
#endif

BareMetal: PS The code is 1500 bytes and won't run on the '24..I guess I'm getting heap/stack clash in that small memory space? The '44 runs like a dream.

The heap/stack are in the RAM and have nothing to do with program code size.

What will matter is that while the Attiny44 has 256bytes of RAM, the Attiny24 only has 128bytes of RAM.

Its can be possible to reduce RAM usage by better optimising your program.