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.

eQEP模块测速问题



在 eQEP模块中 QCTMR  和 QCPRD 分别是什么东西,为什么在demo中 时间差是从 QCPRDLAT取得,请问 可以从QCTMRLAT 中取么,参考文档该部分写得不是很清楚  



  • QCTMR是捕获时钟寄存器(the capture timer),QCPRD捕获周期寄存器(the capture period register)。你说的DEMO是指哪个DEMO?参考文档又是哪一篇呢?
  • if(EQep1Regs.QEPSTS.bit.UPEVNT==1) // Unit position event
    {
    if(EQep1Regs.QEPSTS.bit.COEF==0) // No Capture overflow
    temp1=(unsigned long)EQep1Regs.QCPRDLAT; // temp1 = t2-t1
    else // Capture overflow, saturate the result
    temp1=0xFFFF;

    //p->Speed_pr = _IQdiv(p->SpeedScaler,temp1); // p->Speed_pr = p->SpeedScaler/temp1
    p->Speed_pr = temp1;
    Tmp1=p->Speed_pr;

    //if (Tmp1>_IQ(1))
    // p->Speed_pr = _IQ(1);
    //else
    // p->Speed_pr = Tmp1;

    // Convert p->Speed_pr to RPM
    if (p->DirectionQep==0) // Reverse direction = negative
    p->SpeedRpm_pr = -p->Speed_pr; // Q0 = Q0*GLOBAL_Q => _IQXmpy(), X = GLOBAL_Q
    else // Forward direction = positive
    p->SpeedRpm_pr = p->Speed_pr; // Q0 = Q0*GLOBAL_Q => _IQXmpy(), X = GLOBAL_Q


    EQep1Regs.QEPSTS.all=0x88; // Clear Unit position event flag
    // Clear overflow error flag
    }


    参考文档 是 TMS320x2833x, 2823x Enhanced Quadrature Encoder Pulse (eQEP) Module Reference Guid
  • 可以看一下数据手册:5 eQEP Edge Capture Unit
    这个寄存器是由Unit position event发生来锁存数据的,该章节最末的表格中∆T配置或读取信息的相关寄存器就是Capture Period Latch (QCPRDLAT)