TI中文支持网
TI专业的中文技术问题搜集分享网站

F28335-qep测位置困惑

我现在手上有个电机(带有编码器)可以正常转动,我把它的qep的信号输出A、B信号外接出来,连接到dsp的eqep1A,eqep1B的引脚上面,然后运行 HVPM_Sensorless_2833x的pmsm的程序,但是qep的位置寄存器没有计数,qep程序没有启动,测不出机械转角和电气转角。下面是qep的程序,请TI人解答一下

#define QEP_MACRO(m,v)                   \
                        \
/* Check the rotational direction */               \
     v.DirectionQep = (*eQEP[m]).QEPSTS.bit.QDF;            \
                        \
/* Check the position counter for EQEP1 */              \
     v.RawTheta = (*eQEP[m]).QPOSCNT + v.CalibratedAngle;          \
                            \
     if (v.RawTheta < 0)                  \
       v.RawTheta = v.RawTheta + (*eQEP[m]).QPOSMAX;           \
     else if (v.RawTheta > (*eQEP[m]).QPOSMAX)             \
       v.RawTheta = v.RawTheta – (*eQEP[m]).QPOSMAX;           \
                              \
/* Compute the mechanical angle */                \
 v.MechTheta= v.MechScaler*v.RawTheta;              \
/* Compute the electrical angle  */                \
    v.ElecTheta = (v.PolePairs*v.MechTheta) -floor(v.PolePairs*v.MechTheta); /* Q24 = Q0*Q24 */ \
                           \
/* Check an index occurrence*/                 \
     if ((*eQEP[m]).QFLG.bit.IEL == 1)                  \
     {                        \
      v.IndexSyncFlag = 0x00F0;                \
        v.QepCountIndex = (*eQEP[m]).QPOSILAT;             \
     (*eQEP[m]).QCLR.bit.IEL = 1; /* Clear interrupt flag */        \
     }                       \
                        \
/* Check unit Time out-event for speed calculation: */           \
/* Unit Timer is configured for 100Hz in INIT function*/          \
 if((*eQEP[m]).QFLG.bit.UTO == 1)               \
    {                       \
       /***** Low Speed Calculation   ****/            \
     if(((*eQEP[m]).QEPSTS.bit.COEF || (*eQEP[m]).QEPSTS.bit.CDEF))       \
    { /* Capture Counter overflowed, direction change occurred ,hence do no compute speed*/       \
     (*eQEP[m]).QEPSTS.all = 0x000C;              \
     }                      \
     else if((*eQEP[m]).QCPRDLAT!=0xffff)             \
      /* Compute lowspeed using capture counter value*/         \
      v.QepPeriod = (*eQEP[m]).QCPRDLAT;             \
    }                                                                                           \

#endif // __F2833X_QEP_H__

ZENGZHEN XING:

回复 喝可乐的马甲:

我是在有qep的level中实验的,确实没有起作用,仁兄你也用过TI的pmsm的程序吗

我现在手上有个电机(带有编码器)可以正常转动,我把它的qep的信号输出A、B信号外接出来,连接到dsp的eqep1A,eqep1B的引脚上面,然后运行 HVPM_Sensorless_2833x的pmsm的程序,但是qep的位置寄存器没有计数,qep程序没有启动,测不出机械转角和电气转角。下面是qep的程序,请TI人解答一下

#define QEP_MACRO(m,v)                   \
                        \
/* Check the rotational direction */               \
     v.DirectionQep = (*eQEP[m]).QEPSTS.bit.QDF;            \
                        \
/* Check the position counter for EQEP1 */              \
     v.RawTheta = (*eQEP[m]).QPOSCNT + v.CalibratedAngle;          \
                            \
     if (v.RawTheta < 0)                  \
       v.RawTheta = v.RawTheta + (*eQEP[m]).QPOSMAX;           \
     else if (v.RawTheta > (*eQEP[m]).QPOSMAX)             \
       v.RawTheta = v.RawTheta – (*eQEP[m]).QPOSMAX;           \
                              \
/* Compute the mechanical angle */                \
 v.MechTheta= v.MechScaler*v.RawTheta;              \
/* Compute the electrical angle  */                \
    v.ElecTheta = (v.PolePairs*v.MechTheta) -floor(v.PolePairs*v.MechTheta); /* Q24 = Q0*Q24 */ \
                           \
/* Check an index occurrence*/                 \
     if ((*eQEP[m]).QFLG.bit.IEL == 1)                  \
     {                        \
      v.IndexSyncFlag = 0x00F0;                \
        v.QepCountIndex = (*eQEP[m]).QPOSILAT;             \
     (*eQEP[m]).QCLR.bit.IEL = 1; /* Clear interrupt flag */        \
     }                       \
                        \
/* Check unit Time out-event for speed calculation: */           \
/* Unit Timer is configured for 100Hz in INIT function*/          \
 if((*eQEP[m]).QFLG.bit.UTO == 1)               \
    {                       \
       /***** Low Speed Calculation   ****/            \
     if(((*eQEP[m]).QEPSTS.bit.COEF || (*eQEP[m]).QEPSTS.bit.CDEF))       \
    { /* Capture Counter overflowed, direction change occurred ,hence do no compute speed*/       \
     (*eQEP[m]).QEPSTS.all = 0x000C;              \
     }                      \
     else if((*eQEP[m]).QCPRDLAT!=0xffff)             \
      /* Compute lowspeed using capture counter value*/         \
      v.QepPeriod = (*eQEP[m]).QCPRDLAT;             \
    }                                                                                           \

#endif // __F2833X_QEP_H__

喝可乐的马甲:

回复 ZENGZHEN XING:

用过的。

你查一下QEP模块的寄存器配置是否正确?转动编码器时,看看计数值是否增加或减小?

我现在手上有个电机(带有编码器)可以正常转动,我把它的qep的信号输出A、B信号外接出来,连接到dsp的eqep1A,eqep1B的引脚上面,然后运行 HVPM_Sensorless_2833x的pmsm的程序,但是qep的位置寄存器没有计数,qep程序没有启动,测不出机械转角和电气转角。下面是qep的程序,请TI人解答一下

#define QEP_MACRO(m,v)                   \
                        \
/* Check the rotational direction */               \
     v.DirectionQep = (*eQEP[m]).QEPSTS.bit.QDF;            \
                        \
/* Check the position counter for EQEP1 */              \
     v.RawTheta = (*eQEP[m]).QPOSCNT + v.CalibratedAngle;          \
                            \
     if (v.RawTheta < 0)                  \
       v.RawTheta = v.RawTheta + (*eQEP[m]).QPOSMAX;           \
     else if (v.RawTheta > (*eQEP[m]).QPOSMAX)             \
       v.RawTheta = v.RawTheta – (*eQEP[m]).QPOSMAX;           \
                              \
/* Compute the mechanical angle */                \
 v.MechTheta= v.MechScaler*v.RawTheta;              \
/* Compute the electrical angle  */                \
    v.ElecTheta = (v.PolePairs*v.MechTheta) -floor(v.PolePairs*v.MechTheta); /* Q24 = Q0*Q24 */ \
                           \
/* Check an index occurrence*/                 \
     if ((*eQEP[m]).QFLG.bit.IEL == 1)                  \
     {                        \
      v.IndexSyncFlag = 0x00F0;                \
        v.QepCountIndex = (*eQEP[m]).QPOSILAT;             \
     (*eQEP[m]).QCLR.bit.IEL = 1; /* Clear interrupt flag */        \
     }                       \
                        \
/* Check unit Time out-event for speed calculation: */           \
/* Unit Timer is configured for 100Hz in INIT function*/          \
 if((*eQEP[m]).QFLG.bit.UTO == 1)               \
    {                       \
       /***** Low Speed Calculation   ****/            \
     if(((*eQEP[m]).QEPSTS.bit.COEF || (*eQEP[m]).QEPSTS.bit.CDEF))       \
    { /* Capture Counter overflowed, direction change occurred ,hence do no compute speed*/       \
     (*eQEP[m]).QEPSTS.all = 0x000C;              \
     }                      \
     else if((*eQEP[m]).QCPRDLAT!=0xffff)             \
      /* Compute lowspeed using capture counter value*/         \
      v.QepPeriod = (*eQEP[m]).QCPRDLAT;             \
    }                                                                                           \

#endif // __F2833X_QEP_H__

ZENGZHEN XING:

回复 喝可乐的马甲:

请仁兄分享一下使用心得,我现在是直接调用他的QEP_MACRO,同时我给上ABZ三路信号,管脚上有信号输入,信号正常,但是我的位置计数器没有起到作用,我感觉是我的配置理解的不够,请仁兄指点一下,谢谢

我现在手上有个电机(带有编码器)可以正常转动,我把它的qep的信号输出A、B信号外接出来,连接到dsp的eqep1A,eqep1B的引脚上面,然后运行 HVPM_Sensorless_2833x的pmsm的程序,但是qep的位置寄存器没有计数,qep程序没有启动,测不出机械转角和电气转角。下面是qep的程序,请TI人解答一下

#define QEP_MACRO(m,v)                   \
                        \
/* Check the rotational direction */               \
     v.DirectionQep = (*eQEP[m]).QEPSTS.bit.QDF;            \
                        \
/* Check the position counter for EQEP1 */              \
     v.RawTheta = (*eQEP[m]).QPOSCNT + v.CalibratedAngle;          \
                            \
     if (v.RawTheta < 0)                  \
       v.RawTheta = v.RawTheta + (*eQEP[m]).QPOSMAX;           \
     else if (v.RawTheta > (*eQEP[m]).QPOSMAX)             \
       v.RawTheta = v.RawTheta – (*eQEP[m]).QPOSMAX;           \
                              \
/* Compute the mechanical angle */                \
 v.MechTheta= v.MechScaler*v.RawTheta;              \
/* Compute the electrical angle  */                \
    v.ElecTheta = (v.PolePairs*v.MechTheta) -floor(v.PolePairs*v.MechTheta); /* Q24 = Q0*Q24 */ \
                           \
/* Check an index occurrence*/                 \
     if ((*eQEP[m]).QFLG.bit.IEL == 1)                  \
     {                        \
      v.IndexSyncFlag = 0x00F0;                \
        v.QepCountIndex = (*eQEP[m]).QPOSILAT;             \
     (*eQEP[m]).QCLR.bit.IEL = 1; /* Clear interrupt flag */        \
     }                       \
                        \
/* Check unit Time out-event for speed calculation: */           \
/* Unit Timer is configured for 100Hz in INIT function*/          \
 if((*eQEP[m]).QFLG.bit.UTO == 1)               \
    {                       \
       /***** Low Speed Calculation   ****/            \
     if(((*eQEP[m]).QEPSTS.bit.COEF || (*eQEP[m]).QEPSTS.bit.CDEF))       \
    { /* Capture Counter overflowed, direction change occurred ,hence do no compute speed*/       \
     (*eQEP[m]).QEPSTS.all = 0x000C;              \
     }                      \
     else if((*eQEP[m]).QCPRDLAT!=0xffff)             \
      /* Compute lowspeed using capture counter value*/         \
      v.QepPeriod = (*eQEP[m]).QCPRDLAT;             \
    }                                                                                           \

#endif // __F2833X_QEP_H__

喝可乐的马甲:

回复 ZENGZHEN XING:

你仔细检查一下QEP模块的寄存器配置是不是正确的。

或者你把QEP模块的寄存器截图发上来看看。

我现在手上有个电机(带有编码器)可以正常转动,我把它的qep的信号输出A、B信号外接出来,连接到dsp的eqep1A,eqep1B的引脚上面,然后运行 HVPM_Sensorless_2833x的pmsm的程序,但是qep的位置寄存器没有计数,qep程序没有启动,测不出机械转角和电气转角。下面是qep的程序,请TI人解答一下

#define QEP_MACRO(m,v)                   \
                        \
/* Check the rotational direction */               \
     v.DirectionQep = (*eQEP[m]).QEPSTS.bit.QDF;            \
                        \
/* Check the position counter for EQEP1 */              \
     v.RawTheta = (*eQEP[m]).QPOSCNT + v.CalibratedAngle;          \
                            \
     if (v.RawTheta < 0)                  \
       v.RawTheta = v.RawTheta + (*eQEP[m]).QPOSMAX;           \
     else if (v.RawTheta > (*eQEP[m]).QPOSMAX)             \
       v.RawTheta = v.RawTheta – (*eQEP[m]).QPOSMAX;           \
                              \
/* Compute the mechanical angle */                \
 v.MechTheta= v.MechScaler*v.RawTheta;              \
/* Compute the electrical angle  */                \
    v.ElecTheta = (v.PolePairs*v.MechTheta) -floor(v.PolePairs*v.MechTheta); /* Q24 = Q0*Q24 */ \
                           \
/* Check an index occurrence*/                 \
     if ((*eQEP[m]).QFLG.bit.IEL == 1)                  \
     {                        \
      v.IndexSyncFlag = 0x00F0;                \
        v.QepCountIndex = (*eQEP[m]).QPOSILAT;             \
     (*eQEP[m]).QCLR.bit.IEL = 1; /* Clear interrupt flag */        \
     }                       \
                        \
/* Check unit Time out-event for speed calculation: */           \
/* Unit Timer is configured for 100Hz in INIT function*/          \
 if((*eQEP[m]).QFLG.bit.UTO == 1)               \
    {                       \
       /***** Low Speed Calculation   ****/            \
     if(((*eQEP[m]).QEPSTS.bit.COEF || (*eQEP[m]).QEPSTS.bit.CDEF))       \
    { /* Capture Counter overflowed, direction change occurred ,hence do no compute speed*/       \
     (*eQEP[m]).QEPSTS.all = 0x000C;              \
     }                      \
     else if((*eQEP[m]).QCPRDLAT!=0xffff)             \
      /* Compute lowspeed using capture counter value*/         \
      v.QepPeriod = (*eQEP[m]).QCPRDLAT;             \
    }                                                                                           \

#endif // __F2833X_QEP_H__

ZENGZHEN XING:

回复 喝可乐的马甲:

我现在想从最初时的功能来调,先让qep产生一个unit time interrupt,后面的程序先不加,下面是我关于实现uto中断的初始化程序:请帮忙看一下:十分感谢

{这是初始化的程序

EQep1Regs.QEPCTL.bit.QPEN=1; //使能计数器 EQep1Regs.QEPCTL.bit.UTE=1; //使能EQEP的定时器 EQep1Regs.QUTMR=0; //EQep1Regs.QUPRD=1500000; //周期值 EQep1Regs.QCLR.bit.UTO=1; //清除定时中断标志位 EQep1Regs.QFRC.bit.UTO=1; EQep1Regs.QEINT.bit.UTO=1; //使能定时器的中断

}

这是主中断的程序:

interrupt void EQEP_UTO_INT(void)

{if (EQep1Regs.QFLG.bit.UTO==1){

EQep1Regs.QCLR.bit.UTO=1;

Interrupt_Count1++;

}

PieCtrlRegs.PIEACK.all = PIEACK_GROUP5;

EQep1Regs.QCLR.bit.UTO=1;

}

现在的情况是:Interrupt_Count1的值是1;只进一次中断,寄存器QUTMR一直在计数,QEPCTL的值0x000A,QEINT的值为0x0800;QFLG的值0x0801说明有中断标志再置位,我想不明白每次计数值会达到周期值,但是就是不发生中断,该使能的也使能啦,该清中断的也清中断了,请帮忙分析一下,谢谢

我现在手上有个电机(带有编码器)可以正常转动,我把它的qep的信号输出A、B信号外接出来,连接到dsp的eqep1A,eqep1B的引脚上面,然后运行 HVPM_Sensorless_2833x的pmsm的程序,但是qep的位置寄存器没有计数,qep程序没有启动,测不出机械转角和电气转角。下面是qep的程序,请TI人解答一下

#define QEP_MACRO(m,v)                   \
                        \
/* Check the rotational direction */               \
     v.DirectionQep = (*eQEP[m]).QEPSTS.bit.QDF;            \
                        \
/* Check the position counter for EQEP1 */              \
     v.RawTheta = (*eQEP[m]).QPOSCNT + v.CalibratedAngle;          \
                            \
     if (v.RawTheta < 0)                  \
       v.RawTheta = v.RawTheta + (*eQEP[m]).QPOSMAX;           \
     else if (v.RawTheta > (*eQEP[m]).QPOSMAX)             \
       v.RawTheta = v.RawTheta – (*eQEP[m]).QPOSMAX;           \
                              \
/* Compute the mechanical angle */                \
 v.MechTheta= v.MechScaler*v.RawTheta;              \
/* Compute the electrical angle  */                \
    v.ElecTheta = (v.PolePairs*v.MechTheta) -floor(v.PolePairs*v.MechTheta); /* Q24 = Q0*Q24 */ \
                           \
/* Check an index occurrence*/                 \
     if ((*eQEP[m]).QFLG.bit.IEL == 1)                  \
     {                        \
      v.IndexSyncFlag = 0x00F0;                \
        v.QepCountIndex = (*eQEP[m]).QPOSILAT;             \
     (*eQEP[m]).QCLR.bit.IEL = 1; /* Clear interrupt flag */        \
     }                       \
                        \
/* Check unit Time out-event for speed calculation: */           \
/* Unit Timer is configured for 100Hz in INIT function*/          \
 if((*eQEP[m]).QFLG.bit.UTO == 1)               \
    {                       \
       /***** Low Speed Calculation   ****/            \
     if(((*eQEP[m]).QEPSTS.bit.COEF || (*eQEP[m]).QEPSTS.bit.CDEF))       \
    { /* Capture Counter overflowed, direction change occurred ,hence do no compute speed*/       \
     (*eQEP[m]).QEPSTS.all = 0x000C;              \
     }                      \
     else if((*eQEP[m]).QCPRDLAT!=0xffff)             \
      /* Compute lowspeed using capture counter value*/         \
      v.QepPeriod = (*eQEP[m]).QCPRDLAT;             \
    }                                                                                           \

#endif // __F2833X_QEP_H__

喝可乐的马甲:

回复 ZENGZHEN XING:

你可以先试一下Controlsuite里面的两个QEP例程

C:\ti\controlSUITE\device_support\f2833x\v140\DSP2833x_examples_ccsv5\eqep_pos_speed

C:\ti\controlSUITE\device_support\f2833x\v140\DSP2833x_examples_ccsv5\eqep_freqcal

我现在手上有个电机(带有编码器)可以正常转动,我把它的qep的信号输出A、B信号外接出来,连接到dsp的eqep1A,eqep1B的引脚上面,然后运行 HVPM_Sensorless_2833x的pmsm的程序,但是qep的位置寄存器没有计数,qep程序没有启动,测不出机械转角和电气转角。下面是qep的程序,请TI人解答一下

#define QEP_MACRO(m,v)                   \
                        \
/* Check the rotational direction */               \
     v.DirectionQep = (*eQEP[m]).QEPSTS.bit.QDF;            \
                        \
/* Check the position counter for EQEP1 */              \
     v.RawTheta = (*eQEP[m]).QPOSCNT + v.CalibratedAngle;          \
                            \
     if (v.RawTheta < 0)                  \
       v.RawTheta = v.RawTheta + (*eQEP[m]).QPOSMAX;           \
     else if (v.RawTheta > (*eQEP[m]).QPOSMAX)             \
       v.RawTheta = v.RawTheta – (*eQEP[m]).QPOSMAX;           \
                              \
/* Compute the mechanical angle */                \
 v.MechTheta= v.MechScaler*v.RawTheta;              \
/* Compute the electrical angle  */                \
    v.ElecTheta = (v.PolePairs*v.MechTheta) -floor(v.PolePairs*v.MechTheta); /* Q24 = Q0*Q24 */ \
                           \
/* Check an index occurrence*/                 \
     if ((*eQEP[m]).QFLG.bit.IEL == 1)                  \
     {                        \
      v.IndexSyncFlag = 0x00F0;                \
        v.QepCountIndex = (*eQEP[m]).QPOSILAT;             \
     (*eQEP[m]).QCLR.bit.IEL = 1; /* Clear interrupt flag */        \
     }                       \
                        \
/* Check unit Time out-event for speed calculation: */           \
/* Unit Timer is configured for 100Hz in INIT function*/          \
 if((*eQEP[m]).QFLG.bit.UTO == 1)               \
    {                       \
       /***** Low Speed Calculation   ****/            \
     if(((*eQEP[m]).QEPSTS.bit.COEF || (*eQEP[m]).QEPSTS.bit.CDEF))       \
    { /* Capture Counter overflowed, direction change occurred ,hence do no compute speed*/       \
     (*eQEP[m]).QEPSTS.all = 0x000C;              \
     }                      \
     else if((*eQEP[m]).QCPRDLAT!=0xffff)             \
      /* Compute lowspeed using capture counter value*/         \
      v.QepPeriod = (*eQEP[m]).QCPRDLAT;             \
    }                                                                                           \

#endif // __F2833X_QEP_H__

jixin gan:

回复 喝可乐的马甲:

请问TI官方给出了DSP C2000系列对矩阵运算的测试程序吗

我现在手上有个电机(带有编码器)可以正常转动,我把它的qep的信号输出A、B信号外接出来,连接到dsp的eqep1A,eqep1B的引脚上面,然后运行 HVPM_Sensorless_2833x的pmsm的程序,但是qep的位置寄存器没有计数,qep程序没有启动,测不出机械转角和电气转角。下面是qep的程序,请TI人解答一下

#define QEP_MACRO(m,v)                   \
                        \
/* Check the rotational direction */               \
     v.DirectionQep = (*eQEP[m]).QEPSTS.bit.QDF;            \
                        \
/* Check the position counter for EQEP1 */              \
     v.RawTheta = (*eQEP[m]).QPOSCNT + v.CalibratedAngle;          \
                            \
     if (v.RawTheta < 0)                  \
       v.RawTheta = v.RawTheta + (*eQEP[m]).QPOSMAX;           \
     else if (v.RawTheta > (*eQEP[m]).QPOSMAX)             \
       v.RawTheta = v.RawTheta – (*eQEP[m]).QPOSMAX;           \
                              \
/* Compute the mechanical angle */                \
 v.MechTheta= v.MechScaler*v.RawTheta;              \
/* Compute the electrical angle  */                \
    v.ElecTheta = (v.PolePairs*v.MechTheta) -floor(v.PolePairs*v.MechTheta); /* Q24 = Q0*Q24 */ \
                           \
/* Check an index occurrence*/                 \
     if ((*eQEP[m]).QFLG.bit.IEL == 1)                  \
     {                        \
      v.IndexSyncFlag = 0x00F0;                \
        v.QepCountIndex = (*eQEP[m]).QPOSILAT;             \
     (*eQEP[m]).QCLR.bit.IEL = 1; /* Clear interrupt flag */        \
     }                       \
                        \
/* Check unit Time out-event for speed calculation: */           \
/* Unit Timer is configured for 100Hz in INIT function*/          \
 if((*eQEP[m]).QFLG.bit.UTO == 1)               \
    {                       \
       /***** Low Speed Calculation   ****/            \
     if(((*eQEP[m]).QEPSTS.bit.COEF || (*eQEP[m]).QEPSTS.bit.CDEF))       \
    { /* Capture Counter overflowed, direction change occurred ,hence do no compute speed*/       \
     (*eQEP[m]).QEPSTS.all = 0x000C;              \
     }                      \
     else if((*eQEP[m]).QCPRDLAT!=0xffff)             \
      /* Compute lowspeed using capture counter value*/         \
      v.QepPeriod = (*eQEP[m]).QCPRDLAT;             \
    }                                                                                           \

#endif // __F2833X_QEP_H__

jun gao1:

回复 ZENGZHEN XING:

请问找到原因没有,我也遇到这个问题了

我现在手上有个电机(带有编码器)可以正常转动,我把它的qep的信号输出A、B信号外接出来,连接到dsp的eqep1A,eqep1B的引脚上面,然后运行 HVPM_Sensorless_2833x的pmsm的程序,但是qep的位置寄存器没有计数,qep程序没有启动,测不出机械转角和电气转角。下面是qep的程序,请TI人解答一下

#define QEP_MACRO(m,v)                   \
                        \
/* Check the rotational direction */               \
     v.DirectionQep = (*eQEP[m]).QEPSTS.bit.QDF;            \
                        \
/* Check the position counter for EQEP1 */              \
     v.RawTheta = (*eQEP[m]).QPOSCNT + v.CalibratedAngle;          \
                            \
     if (v.RawTheta < 0)                  \
       v.RawTheta = v.RawTheta + (*eQEP[m]).QPOSMAX;           \
     else if (v.RawTheta > (*eQEP[m]).QPOSMAX)             \
       v.RawTheta = v.RawTheta – (*eQEP[m]).QPOSMAX;           \
                              \
/* Compute the mechanical angle */                \
 v.MechTheta= v.MechScaler*v.RawTheta;              \
/* Compute the electrical angle  */                \
    v.ElecTheta = (v.PolePairs*v.MechTheta) -floor(v.PolePairs*v.MechTheta); /* Q24 = Q0*Q24 */ \
                           \
/* Check an index occurrence*/                 \
     if ((*eQEP[m]).QFLG.bit.IEL == 1)                  \
     {                        \
      v.IndexSyncFlag = 0x00F0;                \
        v.QepCountIndex = (*eQEP[m]).QPOSILAT;             \
     (*eQEP[m]).QCLR.bit.IEL = 1; /* Clear interrupt flag */        \
     }                       \
                        \
/* Check unit Time out-event for speed calculation: */           \
/* Unit Timer is configured for 100Hz in INIT function*/          \
 if((*eQEP[m]).QFLG.bit.UTO == 1)               \
    {                       \
       /***** Low Speed Calculation   ****/            \
     if(((*eQEP[m]).QEPSTS.bit.COEF || (*eQEP[m]).QEPSTS.bit.CDEF))       \
    { /* Capture Counter overflowed, direction change occurred ,hence do no compute speed*/       \
     (*eQEP[m]).QEPSTS.all = 0x000C;              \
     }                      \
     else if((*eQEP[m]).QCPRDLAT!=0xffff)             \
      /* Compute lowspeed using capture counter value*/         \
      v.QepPeriod = (*eQEP[m]).QCPRDLAT;             \
    }                                                                                           \

#endif // __F2833X_QEP_H__

lezhen shi:

回复 jun gao1:

我用28335的例程也出现了这个问题,而我用28035的时候是没问题的。

赞(0)
未经允许不得转载:TI中文支持网 » F28335-qep测位置困惑
分享到: 更多 (0)