Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 05, 2016, 03:40:50 15:40


Login with username, password and session length


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

Posts: 2018

Thank You
-Given: 514
-Receive: 477


Top Topic Starter


« on: January 28, 2013, 11:30:34 23: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

nothing to say..
th_sak
Active Member
***
Offline Offline

Posts: 141

Thank You
-Given: 149
-Receive: 149



« Reply #1 on: January 29, 2013, 04:31:07 16: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, 07:45:34 19:45 by th_sak » Logged
Ichan
Hero Member
*****
Offline Offline

Posts: 840

Thank You
-Given: 312
-Receive: 387



WWW
« Reply #2 on: January 29, 2013, 06:04:36 18: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: 175

Thank You
-Given: 71
-Receive: 38


« Reply #3 on: January 29, 2013, 07:48:18 19: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, 08:54:31 20:54 by Mega32 » Logged
flo0319
Junior Member
**
Offline Offline

Posts: 82

Thank You
-Given: 7
-Receive: 16


« Reply #4 on: January 30, 2013, 09:02:25 09: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
Active Member
***
Offline Offline

Posts: 235

Thank You
-Given: 130
-Receive: 77



« Reply #5 on: February 04, 2013, 02:31:46 14: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
*
 Muted
Offline Offline

Posts: 32

Thank You
-Given: 26
-Receive: 42


« Reply #6 on: February 24, 2013, 10:24:23 22: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