Why is the other task not being executed ?

Status
Not open for further replies.

bianchi77

Advanced Member level 4
Joined
Jun 11, 2009
Messages
1,313
Helped
21
Reputation
44
Reaction score
20
Trophy points
1,318
Location
California
Activity points
9,442
Friends,

I'm doing uCOSII and put task like this :


Code:
static  void  App_TaskCreate (void)
{
#if (OS_VIEW_MODULE == DEF_ENABLED)
	App_OSViewTaskCreate();
#endif	
	
 
	App_BlinkTaskCreate();	
	App_LCDTaskCreate();	
 
}

Why is the BlinkTask not being executed ?
Is it because of this one ?

Code:
#define  APP_TASK_BLINK_PRIO          	 (OS_LOWEST_PRIO - 4)
#define  APP_TASK_LCD_PRIO          	 (OS_LOWEST_PRIO - 7)

Thanks
 

I'm assuming you are using mini-term as example.. please post subs:
App_BlinkTaskCreate();
App_LCDTaskCreate();

________________

#define APP_TASK_BLINK_PRIO (OS_LOWEST_PRIO - 4)
#define APP_TASK_LCD_PRIO (OS_LOWEST_PRIO - 7)

check os_cfg.h



Code C - [expand]
1
2
#define OS_LOWEST_PRIO           63    /* Defines the lowest priority that can be assigned ...         */
                                       /* ... MUST NEVER be higher than 254!                           */



keep in mind that highest prio is 0
 
Last edited:

I'm assuming you are using mini-term as example.. please post subs:
App_BlinkTaskCreate();
App_LCDTaskCreate();
Code:
void  App_BlinkTaskCreate (void)
{
    CPU_INT08U  os_err;

	os_err = os_err; /* prevent warning... */

	os_err = OSTaskCreate((void (*)(void *)) uctsk_Blink,				
                          (void          * ) 0,							
                          (OS_STK        * )&App_TaskBlinkStk[APP_TASK_BLINK_STK_SIZE - 1],		
                          (INT8U           ) APP_TASK_BLINK_PRIO  );							

	#if OS_TASK_NAME_EN > 0
    	OSTaskNameSet(APP_TASK_BLINK_PRIO, "Task LED Blink", &os_err);
	#endif

}


Code:
void  App_LCDTaskCreate (void)
{
    CPU_INT08U  os_err;

	os_err = os_err; /* prevent warning... */

	os_err = OSTaskCreate((void (*)(void *)) uctsk_LCD,				
                          (void          * ) 0,							
                          (OS_STK        * )&App_TaskLCDStk[APP_TASK_LCD_STK_SIZE - 1],		
                          (INT8U           ) APP_TASK_LCD_PRIO  );							

	#if OS_TASK_NAME_EN > 0
    	OSTaskNameSet(APP_TASK_LCD_PRIO, "Task LCD Display", &os_err);
	#endif


}
 

check the next example, and check if you are doing similar.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
OS_STK Task1Stk[1024];
 
void main (void)
{
   INT8U err;
 
   OSInit(); /* Initialize µC/OS-II */
 
   OSTaskCreate(Task1,
                       (void *)0,
                       &Task1Stk[1023],
                       25);
 
   OSStart(); /* Start Multitasking */
}
 
void Task1 (void *p_arg)
{
   (void)p_arg; /* Prevent compiler warning */
 
   for (;;)
   {
     /* Task code */
   }
}




also check this link to get to know how to declare number of tasks ftp://ftp1.digi.com/support/documentation/html/DynCUsersManual/14ucos.htm
 
Last edited:


I created like this :

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
INT32S main (void)
{
    CPU_INT08U  os_err;
    os_err = os_err; /* prevent warning... */
 
    /* Note:  ÓÉÓÚʹÓÃUCOS, ÔÚOSÔËÐÐ֮ǰÔËÐÐ,×¢Òâ±ðʹÄÜÈκÎÖжÏ. */
    CPU_IntDis();                    /* Disable all ints until we are ready to accept them.  */
 
    OSInit();                        /* Initialize "uC/OS-II, The Real-Time Kernel".         */
    
 
    os_err = OSTaskCreateExt((void (*)(void *)) App_TaskStart,  /* Create the start task.                               */
                             (void          * ) 0,
                             (OS_STK        * )&App_TaskStartStk[APP_TASK_START_STK_SIZE - 1],
                             (INT8U           ) APP_TASK_START_PRIO,
                             (INT16U          ) APP_TASK_START_PRIO,
                             (OS_STK        * )&App_TaskStartStk[0],
                             (INT32U          ) APP_TASK_START_STK_SIZE,
                             (void          * )0,
                             (INT16U          )(OS_TASK_OPT_STK_CLR | OS_TASK_OPT_STK_CHK));
    
#if OS_TASK_NAME_EN > 0
    OSTaskNameSet(APP_TASK_START_PRIO, (CPU_INT08U *)"Start Task", &os_err);
#endif
 
    OSStart();                                                  /* Start multitasking (i.e. give control to uC/OS-II).  */
 
    return (0);
}

 

Its hard to say... have you read that link? ftp://ftp1.digi.com/support/documentation/html/DynCUsersManual/14ucos.htm

you probably need to redifine the number of stacks at os_cfg.h

this is the default for uCOSII lib

#define STACK_CNT_256 3 // number of 256 byte stacks
#define STACK_CNT_512 1 // number of 512 byte stacks
#define STACK_CNT_1K 2 // number of 1K stacks
#define STACK_CNT_2K 1 // number of 2K stacks
#define STACK_CNT_4K 0 // number of 4K stacks
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…