本帖最后由 wang12zhe 于 2014-7-20 15:32 编辑
void Task_BEEP(void *p_arg)
{
(void)p_arg;
while(1)
{
LED1(ON);
OSTimeDlyHMSM(0,0,0,uLED1Time);
LED1(OFF);
OSTimeDlyHMSM(0,0,0,uLED1Time);
BEEP(BEEP_OFF);
OSSemPend(Fun_Semp,10,&err); //???óD?o?á?
BEEP(BEEP_ON);
OSTimeDlyHMSM(0,0,1,500);
BEEP(BEEP_OFF);
OSTimeDlyHMSM(0,0,1,500);
}
}
关于UCOSII任务间通信的疑问,
以信号量为例,代码如上,
OSSemPend(Fun_Semp,10,&err);
BEEP(BEEP_ON);
OSTimeDlyHMSM(0,0,1,500);
BEEP(BEEP_OFF);
OSTimeDlyHMSM(0,0,1,500);
获取信号量的超时时间为10,当因超时退出后会怎么执行呢,
是直接切换到更高优先级任务呢,还是接续执行本任务下边的代码呢
运行后没有发生信号量,蜂鸣器也会相,
是不是需要加一个判断,像这样
if(OS_NO_ERR==err)
{
BEEP(BEEP_ON);
OSTimeDlyHMSM(0,0,1,500);
BEEP(BEEP_OFF);
OSTimeDlyHMSM(0,0,1,500);
} |