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.

TM4C123GH6PM QEI



QEI的内部定时器重装载值是怎么配置的??

  • void QEIConfigure (uint32_t ui32Base, uint32_t ui32Config, uint32_t ui32MaxPosition)

    应该是这句吧,和QEI有关的库函数本来就没几个,带参数的就更少了。

  • 我觉得应该不是那个,我把它设为0也能计数脉冲,而且它的解释是重置位置捕捉应该与方向有关...

  • 找到了,是这个函数,他的函数原型如下:

    QEIVelocityConfigure(uint32_t ui32Base, uint32_t ui32PreDiv,
                         uint32_t ui32Period)
    {
        //
        // Check the arguments.
        //
        ASSERT((ui32Base == QEI0_BASE) || (ui32Base == QEI1_BASE));
        ASSERT(!(ui32PreDiv & ~(QEI_CTL_VELDIV_M)));
        ASSERT(ui32Period != 0);
    
        //
        // Set the velocity predivider.
        //
        HWREG(ui32Base + QEI_O_CTL) = ((HWREG(ui32Base + QEI_O_CTL) &
                                        ~(QEI_CTL_VELDIV_M)) | ui32PreDiv);
    
        //
        // Set the timer period.
        //
        HWREG(ui32Base + QEI_O_LOAD) = ui32Period - 1;
    }