1

I tried to do a simple program using the ATmega16 microcontroller, the program is to toggle two LEDs the first one by using timer0 interrupt and the other using timer2 interrupt.

1
  • If you put them on correct pins, you can setup timers to toggle them without any software handling. Also yes, you can have more than one ISR and even all the timers running at the same time
    – KIIV
    Jun 22, 2022 at 12:27

2 Answers 2

0

Yes, you can. However there is one thing to note:

Only one ISR can run at once.

That means that if one LED wants to toggle while the other one is in the process of toggling it will have to wait until that first ISR is finished before it can toggle.

For simple LED toggling that won't be noticeable, but it's something you need to bear in mind if you are doing multiple things that require precise timing.

1

Yes, we can.

(stackexchange wants the body of the answer to be at least 30 characters, so I have to add some filler. Truth is, for answering the question as asked, there is nothing more to say.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.