请问在uc/OS 中该如何应用函数OSTimeDly ()。 下面是我的源程序,在运行的过程中,运行到OSTimeDly (1)中就在OS_TaskIdle (void *pdata)函数中式循环,不能返回 ,请问是怎么回事啊? #define LED0_ON WrPortI(PDB0R, NULL, 0); #define LED0_OFF WrPortI(PDB0R, NULL,1); #define LED3_ON WrPortI(PDB2R, NULL, 0); #define LED3_OFF WrPortI(PDB2R, NULL, 1<<2); void task0(void *data) ; void task1(void *data) ; void msDelay(unsigned int delay) ;
OS_STK TaskStk1[100]; OS_STK TaskStk0[100]; main() { WrPortI(PDDDR, &PDDDRShadow, 0x07); WrPortI(PDDR, &PDDRShadow, 0x07); OSInit();
OSTaskCreate (task1,(void*)0,&TaskStk1[99],4); OSTaskCreate (task0,(void*)0,&TaskStk0[99],5); OSStart(); }
void task0(void*data) { INT16U i; BOOLEAN LED0_state; i=0; data=data; LED0_state=TRUE; //LED3_ON; while(1) { if(LED0_state==FALSE) { LED0_state=TRUE; LED0_OFF; printf("LCALL TASK0 %d
",i++); } else { LED0_state=FALSE; LED0_ON; printf("LCALL TASK0 %d
",i++); } //msDelay(500); OSTimeDly (1); } }
void task1(void*data) { INT16U j; BOOLEAN LED3_state; j=0; data=data; LED3_state=TRUE; //LED3_ON; while(1) { if(LED3_state==FALSE) { LED3_state=TRUE; LED3_OFF; printf("LCALL TASK1 %d
",j++); } else { LED3_state=FALSE; LED3_ON; printf("LCALL TASK1 %d
",j++); } //msDelay(500); OSTimeDly (1); } |