我创建了三个任务,
os_err = OSTaskCreateExt((void (*)(void *)) App_TaskKEYSCAN,//按键扫描 (void * ) 0,
(OS_STK * )&App_TaskKEYSCANStk[APP_TASK_KEYSCAN_STK_SIZE - 1],
(INT8U ) APP_TASK_KEYSCAN_PRIO,
(INT16U ) APP_TASK_KEYSCAN_PRIO,
(OS_STK * )&App_TaskKEYSCANStk[0],
(INT32U ) APP_TASK_KEYSCAN_STK_SIZE,
(void * ) 0,
(INT16U )(OS_TASK_OPT_STK_CLR | OS_TASK_OPT_STK_CHK));
#if (OS_TASK_NAME_SIZE >= 9)
OSTaskNameSet(APP_TASK_KEYSCAN_PRIO, "User KEYSCAN", &os_err);
#endif
os_err = OSTaskCreateExt((void (*)(void *)) App_TaskTEST,//啥都没干
(void * ) 0,
(OS_STK * )&App_TaskTESTStk[APP_TASK_TEST_STK_SIZE - 1],
(INT8U ) APP_TASK_TEST_PRIO,
(INT16U ) APP_TASK_TEST_PRIO,
(OS_STK * )&App_TaskTESTStk[0],
(INT32U ) APP_TASK_TEST_STK_SIZE,
(void * ) 0,
(INT16U )(OS_TASK_OPT_STK_CLR | OS_TASK_OPT_STK_CHK));
#if (OS_TASK_NAME_SIZE >= 9)
OSTaskNameSet(APP_TASK_TEST_PRIO, "User TEST", &os_err);
#endif
os_err = OSTaskCreateExt((void (*)(void *)) App_TaskGui,//GUI
(void * ) 0,
(OS_STK * )&App_TaskGuiStk[APP_TASK_GUI_STK_SIZE - 1],
(INT8U ) APP_TASK_GUI_PRIO,
(INT16U ) APP_TASK_GUI_PRIO,
(OS_STK * )&App_TaskGuiStk[0],
(INT32U ) APP_TASK_GUI_STK_SIZE,
(void * ) 0,
(INT16U )(OS_TASK_OPT_STK_CLR | OS_TASK_OPT_STK_CHK));
#if (OS_TASK_NAME_SIZE >= 9)
OSTaskNameSet(APP_TASK_GUI_PRIO, "GUI", &os_err);
#endif
在按键扫描任务里,当检测有按键按下时GUI_SendKeyMsg(key_vaule, 1),给GUI发送按键信号;但不知道为什么会死机,当我把TEST任务去掉后就没问题。GUI 的优先级最低,按键扫描的优先级最高。哪位大神帮忙解释下为什么会死机,有何解决办法。
|