void mainTask( void *pData )
{
pData = pData;
OSTaskCreate(Task1LED,(void *)0,&stkTask1LED[StkSize-1],3);
while(1)
{
OSTimeDly(20);
}
}
void Task1LED(void *pvData)
{
pvData = pvData;
OSTaskCreate(Task2LED,(void *)0,&stkTask2LED[StkSize-1],5);
OSTaskCreate(Task3LED,(void *)0,&stkTask3LED[StkSize-1],6);
LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 6);
LPC_IOCON ->PIO1_5&= ~0x07;
LPC_GPIO1 ->DIR |= LED2; /* 蜂鸣器初始化 */
LPC_GPIO1 ->DATA |= LED2; /* 蜂鸣器关 */
while (1)
{
LPC_GPIO1->DATA &= ~LED2;
OSTimeDly(OS_TICKS_PER_SEC); /* 移除当前任务 */
}
}
void Task2LED( void *pData)
{
pData = pData;
LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 6);
LPC_IOCON ->PIO2_7&= ~0x07;
LPC_GPIO2 ->DIR |= BEEP; /* 蜂鸣器初始化 */
while (1) {
LPC_GPIO2->DATA &= ~BEEP;
OSTimeDly(2*OS_TICKS_PER_SEC);
}
}
void Task3LED(void *pvData)
{
pvData = pvData;
LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 6);
LPC_IOCON ->PIO0_1 &= ~0x07;
LPC_GPIO0 ->DIR |= LED; /* 蜂鸣器初始化 */
LPC_GPIO0 ->DATA |= LED; /* 蜂鸣器关 */
while (1)
{
LPC_GPIO0->DATA &= ~LED;
OSTimeDly(4*OS_TICKS_PER_SEC); /* 移除当前任务 */
}
}
int main(void)
{
SystemInit(); /* 初始化目标板,切勿删除 */
OSInit();
OSTaskCreate(mainTask, (void *)0, &stkMainTask[StkSize - 1], 2);
OSStart();
}
请问下 不是开始创建任务时 是按顺序 进行么 为什么任务3的灯一直没亮呢