This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

f28027定时器计数值



cputimer0默认的是减一计数,我想知道一段时间后的计数值,可是我把time 加到expression里面它显示变量错误。请问这是什么问题啊?程序如下

uint16_t    time=0;

time= ReadCpuTimer0Counter();

  • 你好,

    expression只可以观察全局变量。

    将time设置为全局变量即可。

    Eric

  • cputimer0是32位的,但为什么我用如下reload函数

    void TIMER_reload2(TIMER_Handle timerHandle)
    {
    TIMER_Obj *timer = (TIMER_Obj *)timerHandle;


    // clear the bits
    timer->TCR |= TIMER_TCR_TRB_BITS;

    return;
    }

    重载后,如下

    uint32_t  time1=0;
    uint32_t  time2=0;

    。。。。。。。

    TIMER_reload2(myTimer0);
    time1= ReadCpuTimer0Counter();
    time2=TIMER_getCount(myTimer0);

    得到的time1、time2的值都是65535(16位),得不到4294967295(32位)?

    还有就是 ReadCpuTimer1Counter();和TIMER_getCount(myTimer0);的使用有什么区别吗