The Magic of "Multitasking" on AVR is done by SPEED :D
You only have ONE MAIN LOOP and Processor can only handle one Command at a time, so no multithreading can be handled.
But the AVR is very quick.
Now there are two way's:
1) use hardware functions inside AVR, which relieve the processor
2) processing only in short steps (...to get time for other "tasks")
The advantage of a micro is SPEED. So never make use of WAIT Statements.
Use Interrupts to act on events, this gives MAGIC to your micro.
Don't handle "big things" inside interrupts. Set a Flag and do the work inside main loop.
Do not try to build Rome in a day! Little steps are always the right way.
Micros can be magic Walter
:lol:
↧