ucosii 如何确定定时器的时间_ucos-ii 定时器延时求助???

huaxin 发表于 2012-7-3 12:56

OSTimeTick();  看你这个函数的执行频率是多少, 还有OSTimeDly ( 100/1 );   100/1就是延时这么多个系统 ...

你好,下面是这个“void  OSTimeTick ”函数,至于执行的频率是多少,我没有看明白哦!!!!!!! 你看看你能否百忙之中抽一点时间帮我看看啊???!

void  OSTimeTick (void)

{

OS_TCB    *ptcb;

#if OS_TICK_STEP_EN > 0u

BOOLEAN    step;

#endif

#if OS_CRITICAL_METHOD == 3u                               /* Allocate storage for CPU status register     */

OS_CPU_SR  cpu_sr = 0u;

#endif

#if OS_TIME_TICK_HOOK_EN > 0u

OSTimeTickHook();                                      /* Call user definable hook                     */

#endif

#if OS_TIME_GET_SET_EN > 0u

OS_ENTER_CRITICAL();                                   /* Update the 32-bit tick counter               */

OSTime++;

OS_EXIT_CRITICAL();

#endif

if (OSRunning == OS_TRUE) {

#if OS_TICK_STEP_EN > 0u

switch (OSTickStepState) {                         /* Determine whether we need to process a tick  */

case OS_TICK_STEP_DIS:                         /* Yes, stepping is disabled                    */

step = OS_TRUE;

break;

case OS_TICK_STEP_WAIT:                        /* No,  waiting for uC/OS-View to set ...       */

step = OS_FALSE;                          /*      .. OSTickStepState to OS_TICK_STEP_ONCE */

break;

case OS_TICK_STEP_ONCE:                        /* Yes, process tick once and wait for next ... */

step            = OS_TRUE;                /*      ... step command from uC/OS-View        */

OSTickStepState = OS_TICK_STEP_WAIT;

break;

default:                                       /* Invalid case, correct situation              */

step            = OS_TRUE;

OSTickStepState = OS_TICK_STEP_DIS;

break;

}

if (step == OS_FALSE) {                            /* Return if waiting for step command           */

return;

}

#endif

ptcb = OSTCBList;                                  /* Point at first TCB in TCB list               */

while (ptcb->OSTCBPrio != OS_TASK_IDLE_PRIO) {     /* Go through all TCBs in TCB list              */

OS_ENTER_CRITICAL();

if (ptcb->OSTCBDly != 0u) {                    /* No, Delayed or waiting for event with TO     */

ptcb->OSTCBDly--;                          /* Decrement nbr of ticks to end of delay       */

if (ptcb->OSTCBDly == 0u) {                /* Check for timeout                            */

if ((ptcb->OSTCBStat & OS_STAT_PEND_ANY) != OS_STAT_RDY) {

ptcb->OSTCBStat  &= (INT8U)~(INT8U)OS_STAT_PEND_ANY;          /* Yes, Clear status flag   */

ptcb->OSTCBStatPend = OS_STAT_PEND_TO;                 /* Indicate PEND timeout    */

} else {

ptcb->OSTCBStatPend = OS_STAT_PEND_OK;

}

if ((ptcb->OSTCBStat & OS_STAT_SUSPEND) == OS_STAT_RDY) {  /* Is task suspended?       */

OSRdyGrp               |= ptcb->OSTCBBitY;             /* No,  Make ready          */

OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;

}

}

}

ptcb = ptcb->OSTCBNext;                        /* Point at next TCB in TCB list                */

OS_EXIT_CRITICAL();

}

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值