Is it possible to change the priority of the timers?

Hi guys!

I'm using the Arduino Mega in a academic project, and I need to set the Timer1 with a highest priority then all the others interrupts. Is this possible? If is it possible, how can I do it?

Ismalty:
Hi guys!

I’m using the Arduino Mega in a academic project, and I need to set the Timer1 with a highest priority then all the others interrupts. Is this possible? If is it possible, how can I do it?

What do you mean by “priority”? Different timers serve different pins, some are 8 bit, some are 16 bit, and if you use the Arduino IDE and code, certain timers are used for certain functions (like delay() and micros(), etc…).

Do you want to rearrange which pins are served by which timers? Or do you want to change what timers are used for which timing functions?

The priorities are fixed in vector table order. Check the datasheet.

Priority only determines which ISR is executed first if several interrupts are triggered at the same clock cycle. If an interrupt is executing, and other interrupts occur, upon completion of the current ISR, the next highest priority interrupt pending gets serviced. If your ISRs are fast, priority isn’t usually the issue.

JimEli:
The priorities are fixed in vector table order. Check the datasheet.

Priority only determines which ISR is executed first if several interrupts are triggered at the same clock cycle. If an interrupt is executing, and other interrupts occur, upon completion of the current ISR, the next highest priority interrupt pending gets serviced. If your ISRs are fast, priority isn’t usually the issue.

Well I wanted to be sure what exactly he was looking for before I (possibly) confused him with something that he (may not) be using (ISR's).

Krupski:
Well I wanted to be sure what exactly he was looking for before I (possibly) confused him with something that he (may not) be using (ISR's).

He did say, "I need to set the Timer1 with a highest priority then all the others interrupts."

On the other hand, your answer was confusingly discussing neither priority nor interrupts. :wink:

On the other hand, your answer was confusingly discussing neither priority nor interrupts. :wink:

One fine day, I was sitting in a meeting. Two people began arguing. A typical outcry was, "What you are saying is IMPOSSIBLE! The KGAM simply does not work that way!" This ensued for about 30 minutes. As luck would have it, the two were "arguing" about radically different systems that had overlapping acronyms (overlapping terminology).

People new to programming microcontrollers often struggle with terminology. @Krupski was simply ensuring he and @Ismalty are using the same terms (something the two people mentioned above should have done). On this forum, when trying to communicate with someone who has a post count of 6, doing that is never a bad idea.

JimEli:
He did say, "I need to set the Timer1 with a highest priority then all the others interrupts."

On the other hand, your answer was confusingly discussing neither priority nor interrupts. :wink:

Sorry... I suppose I should turn the computer off and go to sleep for a while. I've only had about 2 hours of sleep in the last 36 hours and I guess my brain is in powersave mode.

I'm reading, but the text is bouncing off my eyes and falling on the floor.

Good night. :grin:

Thank you.

Ismalty:
Hi guys!

I'm using the Arduino Mega in a academic project, and I need to set the Timer1 with a highest priority then all the others interrupts. Is this possible? If is it possible, how can I do it?

I agree with reply #2, you can't change the priority and it probably won't matter that you cannot.