刚学UC/OS,有不懂的地方请教各位: 看书中写在OSStart()后要安装并启动UC/OS的时钟节拍,但我看书中实例怎么样没写??(红色部分没出现) void main (void) { PC_DispClrScr(DISP_FGND_WHITE + DISP_BGND_BLACK); /* Clear the screen */
OSInit(); /* Initialize uC/OS-II */
PC_DOSSaveReturn(); /* Save environment to return to DOS */ PC_VectSet(uCOS, OSCtxSw); /* Install uC/OS-II's context switch vector */
RandomSem = OSSemCreate(1); /* Random number semaphore */
OSTaskCreate(TaskStart, (void *)0, &TaskStartStk[TASK_STK_SIZE - 1], 0); OSStart(); /* Start multitasking */ } void TaskStart (void *pdata) { #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */ OS_CPU_SR cpu_sr; #endif char s[100]; INT16S key;
pdata = pdata; /* Prevent compiler warning */
TaskStartDispInit(); /* Initialize the display */
OS_ENTER_CRITICAL(); PC_VectSet(0x08, OSTickISR); /* Install uC/OS-II's clock tick ISR */ PC_SetTickRate(OS_TICKS_PER_SEC); /* Reprogram tick rate */ OS_EXIT_CRITICAL();
OSStatInit(); /* Initialize uC/OS-II's statistics */
TaskStartCreateTasks(); /* Create all the application tasks */
for (;;) { TaskStartDisp(); /* Update the display */
if (PC_GetKey(&key) == TRUE) { /* See if key has been pressed */ if (key == 0x1B) { /* Yes, see if it's the ESCAPE key */ PC_DOSReturn(); /* Return to DOS */ } }
OSCtxSwCtr = 0; /* Clear context switch counter */ OSTimeDlyHMSM(0, 0, 1, 0); /* Wait one second */ } } |