Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 18, 2024, 11:58:02 11:58


Login with username, password and session length


Pages: [1]
Print
Author Topic: [REQ] Simple avr task manager  (Read 4728 times)
0 Members and 1 Guest are viewing this topic.
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« on: January 28, 2013, 10:30:34 22:30 »

I am looking for a simple AVR task manager/scheduler (avr-gcc) that can schedule tasks, I want to configure how often the task is called and give it a certain priority, no more no less, any suggestions are welcome.

thanks
Logged
th_sak
Active Member
***
Offline Offline

Posts: 141

Thank You
-Given: 150
-Receive: 149



« Reply #1 on: January 29, 2013, 03:31:07 15:31 »

Hi, you could try something like this. You can set the Timer to fire an interrupt at 2msec for example and you know that the fourth vector will be executed every 8msec, the third every 6msec and so on.

Code:

volatile uc vector_cntr;

#pragma vector = TIMER0_OVF0_vect
__interrupt void TIM0_OVF(void)
{

  if(++vector_cntr == MAX_VECTOR)
    vector_cntr = 1;

  switch (vector_cntr)
  {
    case 1:
    {
      button_read();
    }break;

    case 2:
    {
      dec2bin();
    }break;

    case 3:
    {
      update_display();
    }break;

    case 4:
    {
      update_relay();
    }break;

    default:
      {}
  }
}
« Last Edit: January 29, 2013, 06:45:34 18:45 by th_sak » Logged
Ichan
Hero Member
*****
Offline Offline

Posts: 833

Thank You
-Given: 312
-Receive: 392



WWW
« Reply #2 on: January 29, 2013, 05:04:36 17:04 »

I think it will be better if the switch-case block being put on the main loop.

-ichan
Logged

There is Gray, not only Black or White.
Mega32
Active Member
***
Offline Offline

Posts: 179

Thank You
-Given: 183
-Receive: 37


« Reply #3 on: January 29, 2013, 06:48:18 18:48 »

Have a look at femtoos
http://www.femtoos.org/

femtoos might be overkill , maybe this one ?
https://sites.google.com/site/avrtutorials2/scheduler


Mega32
« Last Edit: January 29, 2013, 07:54:31 19:54 by Mega32 » Logged
flo0319
Junior Member
**
Offline Offline

Posts: 81

Thank You
-Given: 7
-Receive: 17


« Reply #4 on: January 30, 2013, 08:02:25 08:02 »

Hi Metal, if you want multitasking operation but in very simply mode, you can use interrupt vector and generate software interrupts , in a timer you can implement a tick_clock and a state machine for tasks control (ex. External interrupts without external signals). Also you can use a kernel from a RTOS (or just a simplified  version for it).

but if you have just 2-3 tasks you can use very easy software interrupts to manage this tasks 
Logged
DreamCat
Senior Member
****
Offline Offline

Posts: 284

Thank You
-Given: 223
-Receive: 116



« Reply #5 on: February 04, 2013, 01:31:46 13:31 »

a few years ago, I read the "AVR Scheduler" which link post in this thread by mega32.
It is a basic task manager, but it is very usefull for me, I recommand to read it to all of us.
Logged

May be I expressed the wrong meaning, sorry for my bad english. Please correct it for me if you can.
Pasca
Newbie
*
Offline Offline

Posts: 34

Thank You
-Given: 27
-Receive: 42


« Reply #6 on: February 24, 2013, 09:24:23 21:24 »

Is FreeRTOS too complex?
http://www.freertos.org/

Bye
Pasca
Logged

More I know, more I need to know. Less I know, meglio sto!!!
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC