高中生
最后登录1970-1-1
在线时间 小时
注册时间2015-11-17
|
实验条件:野火ISO-MINI开发板
实验目的:通过KEY2(PC13)的EXIT中断,发送一个信号量给KEY2任务,然后控制蜂鸣器响一下。
实验中的部分函数:
OS_EVENT *Key2_Sem;
INT8U Key2_Sem_err;
OS_STK task_key2_stk[TASK_KEY2_STK_SIZE];
void Task_KEY_2(void *p_arg)
{
(void)p_arg;
Key2_Sem = OSSemCreat(0);//创建信号量
while (1)
{
OSSemPend(Key2_Sem , 0 , &Key2_Sem_err);
OSTimeDlyHMSM(0, 0,0,100);
printf("Key2 is Active!***%d\r\n");
}
}
同时:
/* ------------------------ SEMAPHORES ------------------------ */
#define OS_SEM_EN 1u /* Enable (1) or Disable (0) code generation for SEMAPHORES */
#define OS_SEM_ACCEPT_EN 1u /* Include code for OSSemAccept() */
#define OS_SEM_DEL_EN 1u /* Include code for OSSemDel() */
#define OS_SEM_PEND_ABORT_EN 1u /* Include code for OSSemPendAbort() */
#define OS_SEM_QUERY_EN 1u /* Include code for OSSemQuery() */
#define OS_SEM_SET_EN 1u /* Include code for OSSemSet()
编译之后出现以下问题:
compiling Task_Key_2.C...
APP\Task_Key_2.C(11): warning: #223-D: function "OSSemCreat" declared implicitly
Key2_Sem = OSSemCreat(0);
APP\Task_Key_2.C(11): error: #513: a value of type "int" cannot be assigned to an entity of type "OS_EVENT *"
Key2_Sem = OSSemCreat(0);
APP\Task_Key_2.C(17): warning: #224-D: the format string requires additional arguments
printf("Key2 is Active!***%d\r\n");
请教大神指教!谢谢!
|
|