Author Options:

Can an arduino perform multiple functions at once? Answered




Multitasking Operating Systems had been there for even smaller processors than the 168 or the current 328p included in the newest Arduinos. We have released a full open source preemptive multitasking real time operating system (RTOS), called DuinOS, which can be donwloaded from:


Any comments are welcome!



9 years ago

AVRs (the "bare" chip the Arduino is based upon), like most microcontrollers, can trigger IRQs (short for interrupts.) These are separate blocks of code that will execute when the core processor receives a signal.

That signal might be time-based, or it might be triggered by an external pin changing. See the two sections on interrupts in the Arduino advanced reference.

IRQs are and integral part of computers, and often the structure of multitasking is an offshoot of this feature.

AVRs handle many different tasks (PWM, serial IO, ADC capture, etc.) with the help of IRQs.

For single-core processors, however, it's an misnomer to say more than one thing happens at once--usually other processing is suspended while the IRQ is executing.

The arduino is based around the Atmel Atmega168 processor (older versions are based on the Atmega8), which is a single core processor. So, the short answer is no. However, some peripherals on the processor (in particular, the Atmega168's timer/counter units) are able to perform some things without CPU intervention. (namely input captures and output compares)

So the arduino should be able to do multiple functions at once, but it depends on what exactly you're trying to do.