|
之前ticks是由WDT定时器切换的,可以正常运行,现在因为一些原因想换个定时器timerb
之前
WDT_ISR ; wd timer ISR
PUSHALL ; push all registers
bic.b #0x01, IE1 ; disable wd timer interrupt
cmp.b #0, &OSIntNesting ; if (OSIntNesting == 0)
jne WDT_ISR_1
mov.w &OSTCBCur, R13 ; save task stack
mov.w SP, 0(R13)
mov.w &OSISRStkPtr, SP ; load interrupt stack
WDT_ISR_1
inc.b &OSIntNesting ; increase OSIntNesting
bis.b #0x01, IE1 ; enable wd timer interrupt
EINT ; enable general interrupt to allow for interrupt nesting
call #OSTimeTick ; call ticks routine
DINT ; disable general interrupt
call #OSIntExit ; call ticks routine
cmp.b #0, &OSIntNesting ; if (OSIntNesting == 0)
jne WDT_ISR_2
mov.w &OSTCBHighRdy, R13 ; restore task stack SP
mov.w @R13, SP
WDT_ISR_2
POPALL ; pop all registers
reti ; return from interrupt
现在改到了timerb
#pragma vector=TIMERB0_VECTOR
__interrupt void Timer_B (void)
{
OS_CPU_SR cpu_sr;
OS_ENTER_CRITICAL(); /* Tell uC/OS-II that we are starting an ISR */
OSIntNesting++;
OS_EXIT_CRITICAL();
OSTimeTick(); /* Call uC/OS-II's OSTimeTick() */
OSIntExit(); /* Tell uC/OS-II that we are leaving the ISR */
}
但是任务运行不了,是怎么回事?
我对比了一下,除了保存sp之外,基本一致,仿真时可以进入timerb,但是连续运行,有时候会提示cpuoff,但我根本没进入低功耗~
有人换过ticks时钟源麽? |
|