//LED0任务
void led0_task(void *p_arg)
{
int t=0;
OS_ERR err;
while(1)
{
LED0 = !LED0;
t+=1;
Show_Str(5,5,16*9,16,"任务一运行了 次",16,0);
LCD_ShowNum(5+16*6,5,t,2,16);
if(t%5==0)
{
OSTaskSuspend((OS_TCB*)&Led11TaskTCB,&err);
Show_Str(5,25,16*9,16,"任务一挂起了任务二",16,0);
}
if(t%10==0)
{
OSTaskResume((OS_TCB*)&Led11TaskTCB,&err);
Show_Str(5,25,16*9,16,"任务一恢复了任务二",16,0);
}
OSTimeDlyHMSM(0,0,1,0,OS_OPT_TIME_HMSM_STRICT,&err);//延时1s
}
}
void led1_task(void *p_arg)
{
int i=0;
OS_ERR err;
while(1)
{
LED1=!LED1;
i+=1;
Show_Str(5,50,16*9,16,"任务二运行了 次",16,0);
LCD_ShowNum(5+16*6,50,i,2,16);
OSTimeDlyHMSM(0,0,1,0,OS_OPT_TIME_HMSM_STRICT,&err);//延时1s
}
}
|