void Task_Start(void *p_arg)
{
INT8U err,err1;
(void)p_arg;
OSTaskCreate(Task_LED2,(void *)0,
&task_led2_stk[TASK_LED2_STK_SIZE-1], TASK_LED2_PRIO);
OSTaskNameSet(TASK_LED2_PRIO, (INT8U *)"LED2_TASK", &err);
OSTaskCreate(Task_LED3,(void *)0,
&task_led3_stk[TASK_LED3_STK_SIZE-1], TASK_LED3_PRIO);
OSTaskNameSet(TASK_LED3_PRIO,(INT8U*)"LED3_TASK",&err1);
while (1)
{
LED1( ON );
printf("\r\n this is a task_start demo \r\n");
OSTimeDlyHMSM(0, 0,1,0);
LED1( OFF);
printf("\r\n this is a task_start demo end\r\n");
OSTimeDlyHMSM(0, 0,1,0);
}
}
void Task_LED2(void *p_arg)
{
(void)p_arg;
while (1)
{
int i;
for(i=0;i<10000;i++)
{
LED2( ON );
printf("\r\n this is a task_led2 demo \r\n");
}
OSTimeDlyHMSM(0, 0,2,0);
LED2( OFF);
printf("\r\n this is a task_led2 demo end\r\n");
OSTimeDlyHMSM(0, 0,2,0);
}
void Task_LED3(void *p_arg)
{
(void)p_arg;
while (1)
{
LED3( ON );
printf("\r\n this is a task_led3 demo \r\n");
OSTimeDlyHMSM(0, 0,3,0);
LED3( OFF);
printf("\r\n this is a task_led3 demo end\r\n");
OSTimeDlyHMSM(0, 0,3,0);
}
}
start_task是最高优先级的,他有个延时,在延时的时候切换到led2_task,在led2_task中连续发送10000次,他的时间应该已经大于10ms,10ms是我的systick时钟中断,那不是应该每个10ms中断一次,找到最高优先级的任务start_task,并且执行吗,但是我通过串口调试助手发现他是led2_task发送10000次完成之后才切换到最高优先级任务的
|