So... I finally got my hands on this Atmega1284 beast 8), and am trying to get a mega32 program running on it.
I have changed uart names, and it works, but the timer seems to have changed names as well, and while I found the new names and changed them, I dont get any interrupts.
Atmega32 code.
void initTimer(void) { TCCR1B |= (1 << WGM12); // Configure timer 1 for CTC mode OCR1A = 125; // Compare value 125 TCCR1B |= (1 << CS12); // Start timer at Fcpu/256 timerCounter = 0; TIMSK |= (1 << OCIE1A); // Enable CTC interrupt } ISR(TIMER1_COMPA_vect) { tick++; timerCounter++; twiDecTo(); if (tickDiff(seconds) >= 500) { tickS++; seconds = tick; } }
My attempt on Atmega1284 code
void initTimer(void) { TCCR0B |= (1 << WGM12); // Configure timer 1 for CTC mode OCR0A = 125; // Compare value 125 TCCR0B |= (1 << CS12); // Start timer at Fcpu/256 timerCounter = 0; TIFR0 |= (1 << OCF0A); // Enable CTC interrupt } ISR(TIMER0_COMPA_vect) { tick++; timerCounter++; twiDecTo(); if (tickDiff(seconds) >= 500) { tickS++; seconds = tick; } }
Anyone can see whats wrong the the timer setup?
The freq is the same, in fact the board is the same, since the 1284 seems to be pin compatible with 32A :)
The goal is to have an interrupt every 2ms (like it did on atmega32).