Showing results for 
Search instead for 
Did you mean: 

PSoC™ 5, 3 & 1

Not applicable

I am trying to get uCos to work, I have a small keypad program as a set-up to build from.  I have no errors that I can see yet uCos never leaves my lowest priotiy task.  


I have three tasks Start Task (priority 2) which initializes several things including timers and starts Keypad Task and Display Task.


Keypad Task (priority 5) scans the keypad and includes calls to OSTimeDly and OSSemPost, both functions run without errors, however the task never returns once it is started.    


This pervents my main Display Task (priority 4) from running.  The Display Task which makes a call to OSSemPend on the flag from Keypad Task never gets reached because Keypad_Init never returns, instead Keypad Task constantly scans the keypad and posting semphore which go unchecked by Display Task.  All three tasks have OSTimeDly's.


I will include the code for Keypad_Init, hopefully someone who is familiar with uCos can help me.


    void KeyInit(void){   
     OS_ERR err;   
     OS_TCB UcosKey_KeyTask_TCB;   
     Keypad_Write(0x00);    /* Preset all rows to zero    */   
        OSSemCreate(&Key.flag,"Flag Semaphore",0,&err);   
     OSTaskCreate((OS_TCB      *)&UcosKey_KeyTask_TCB,   
               (CPU_CHAR    *)"Scan Keypad",   
                     (OS_TASK_PTR  )KeyTask,    
                     (void        *)0,   
                     (OS_PRIO      )KEYTASK_PRIO,   
                     (CPU_STK     *)&KeyTaskStk[0],   
                     (CPU_STK_SIZE )KEY_STK_SIZE_LIMIT,   
                     (CPU_STK_SIZE )KEY_STK_SIZE,   
                     (OS_MSG_QTY   )0u,   
                     (OS_TICK      )0u,   
                     (void        *)0,   
                     (OS_OPT       )(OS_OPT_TASK_NONE),   
                     (OS_ERR      *)&err);   
     if(err != OS_ERR_NONE){   
     LCD_Disp_PrintString("ERR IN KEYINIT");   
    Thank you.   
3 Replies