Dear friends I have a question I want to manage three different tasks via OSA and mikroc source code, even though I configured the system for 3 different tasks the system only manages 2 different tasks. If some helps me, I will be appreciate. My two source codes (main and OSAcfg) is below;
#include "osa.h"
#define T2CON_CONST 0x25 // post = 8, period = 250*4*5* 0.2 us = 1 ms
#define PR2_CONST (250-1)
void Init (void)
{
TRISB = 0x00;
PORTB = 0x00;
T2CON = T2CON_CONST;
PR2 = 250-1;
INTCON = 0;
PEIE_bit = 1;
TMR2IE_bit = 1;
}
void interrupt (void)
{
if (TMR2IF_bit)
{
OS_Timer();
TMR2IF_bit = 0;
}
}
void Task_1 (void)
{
for(;;)
{
OS_Delay(65);
PORTB.F0 = ~ PORTB.F0;
}
}
void Task_2 (void)
{
for(;;)
{
OS_Delay(230);
PORTB.F1 = ~ PORTB.F1;
}
}
void Task_3 (void)
{
for(;;)
{
OS_Delay(250);
PORTB.F2 = ~ PORTB.F2;
}
}
#pragma funcall main Task_1
#pragma funcall main Task_2
#pragma funcall main Task_3
void main (void)
{
Init(); // Init periphery
OS_Init(); // Init OS
OS_Task_Create(0, Task_1); // Create tasks.
OS_Task_Create(0, Task_2); //
OS_Task_Create(0, Task_3); //
OS_EI(); // Enable interrupts
OS_Run(); // Running scheduler
}
-------------------------------------OSAcfg is below;
/******************************************************************************/
//
// This file was generated by OSAcfg_Tool utility.
// Do not modify it to prevent data loss on next editing.
//
// PROJECT NAME: Running lights
//
// PLATFORM: mikroC for PIC16
//
/******************************************************************************/
#ifndef _OSACFG_H
#define _OSACFG_H
//------------------------------------------------------------------------------
// SYSTEM
//------------------------------------------------------------------------------
#define OS_TASKS 3 // Number of tasks that can be active at one time
#define OS_DISABLE_PRIORITY //
//------------------------------------------------------------------------------
// ENABLE CONSTANTS
//------------------------------------------------------------------------------
#define OS_ENABLE_TTIMERS // Enable task timers (OS_Delay and OS_xxx_Wait_TO)
#endif
Edit: Use Code posting samples of code.. Make it easy for others to read and no
;