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.

用定时器写us延时函数,不懂其中的计算过程,求助

一直以来对定时计数器就搞不清楚,想这次彻底搞懂,主要是不懂怎么计算,下面这段程序while中不知道是干嘛的,求助!


void Delay_us(unsigned int k)
{
    T1CNTL=0;
    T1CNTH=0;
    T1CC0L = 32;
    T1CC0H = 0x00;
    T1CTL = 0x02; //模,从0x0000到T1CC0反复计数。
    while(k)
    {
        while(!(T1CNTL >= 25));
        k--;
    }
    T1CTL = 0x00;  
}