How to Make an AVR Perform Multiple Tasks

[ad_1]

This article describes how to make an AVR perform multiple tasks. Beginners who wish to get an in-depth knowledge in AVR assemble language programming can try out this project. The assembly language helps to utilize all the functions and capabilities of the processor. Read on to know more.

AVR-Multitasking-1.png

The most important and major functionality of an operating system is performing multiple tasks on the CPU. What is being done here is time sharing or multitasking on an AVR. An Atmega32 is set up to perform Round-Robin Multitasking. Quasi-parallel execution of multiple tasks is possible through Round-Robin Multitasking. The tasks are time-sliced and are not done in parallel.

The project demonstrates how the switching mechanism is done between 7 individual tasks. The RAM is divided between the number of processes that are running. A timer is used here and a trigger is executed when it reaches a compare value. The necessary registers are pushed onto the stack.

Now comes the process of switching between the various tasks. A backup of the current stack pointer is required as this helps to identify the previous task that was being executed. About 50 bytes of memory is made available to store the task index. This is the stack pointer backup table.

Now suppose, task 1 is interrupted by the timer, the CPU registers and the status registers are pushed. The task index is checked at this point and the stack pointer of the next task is now obtained. Now this task starts executing and this continues for a few microseconds until it is interrupted. This cycle continues and this gives an impression that all tasks are being performed in parallel.

The most important and major functionality of an operating system is performing multiple tasks on the CPU. What is being done here is time sharing or multitasking on an AVR. An Atmega32 is set up to perform Round-Robin Multitasking. Quasi-parallel execution of multiple tasks is possible through Round-Robin Multitasking. The tasks are time-sliced and are not done in parallel.

The project demonstrates how the switching mechanism is done between 7 individual tasks. The RAM is divided between the number of processes that are running. A timer is used here and a trigger is executed when it reaches a compare value. The necessary registers are pushed onto the stack.

Now comes the process of switching between the various tasks. A backup of the current stack pointer is required as this helps to identify the previous task that was being executed. About 50 bytes of memory is made available to store the task index. This is the stack pointer backup table.

Now suppose, task 1 is interrupted by the timer, the CPU registers and the status registers are pushed. The task index is checked at this point and the stack pointer of the next task is now obtained. Now this task starts executing and this continues for a few microseconds until it is interrupted. This cycle continues and this gives an impression that all tasks are being performed in parallel.

“/>

[ad_2]

Source link

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.