OSStatInit(); /* 初始化统计任务 */
OSTaskCreate(YouTask,(void *)0, &YouTaskStk[TASK_STK_SIZE - 1], 2); //创建任务函数
for (;;)
{
s = "MyTask get source S";
PC_DispStr(2,++y1,s,DISP_BGND_BLACK+DISP_FGND_WHITE);
//如果恩下ESC键,则退出UC/OS-II
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 */
}
}
OSTimeDly(200); /* 等待200个时钟节拍 */
}
}
void YouTask(void *pdata)
{
#if OS_CRITICAL_METHOD == 3 //Allocate storage for CPU status register
OS_CPU_SR cpu_sr;
#endif
INT8U err;
pdata=pdata;
for (;;)
{
s = "YouTask get source S";
PC_DispStr(28,++y2,s,DISP_BGND_BLACK+DISP_FGND_WHITE);
OSTimeSet(0); //置OSTime为0
while(OSTime<500) //显示字符串
{
PC_DispStr(55,y2,s,DISP_BGND_BLACK+DISP_FGND_WHITE);
}
OSTimeDly(10); //等待10个时钟节拍
}
}