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

F28035 中的QEP正交编码电路的工作原理是什么?

如题。 谢谢

rookiecalf:

百度一下正交编码器的原理即可

如题。 谢谢

liang feng1:

回复 rookiecalf:

百度上的太杂乱了,而且不专业,并且没有针对性。所以我才来了这里。

如题。 谢谢

liang feng1:

回复 mangui zhang:

请问下面两个if判断语句里面是什么意思 啊?

解释里面说一个位置到达事件,还有一个是时间到达事件。 但是还是不太理解。

if(EQep1Regs.QFLG.bit.UTO==1) // If unit timeout (one 100Hz period) { /** Differentiator **/ // The following lines calculate position = (x2-x1)/4000 (position in 1 revolution) pos16bval=(unsigned int)EQep1Regs.QPOSLAT; // Latched POSCNT value tmp = (long)((long)pos16bval*(long)p->mech_scaler); // Q0*Q26 = Q26 tmp &= 0x03FFF000; tmp = (int)(tmp>>11); // Q26 -> Q15 tmp &= 0x7FFF; newp=_IQ15toIQ(tmp); oldp=p->oldpos;

if (p->DirectionQep==0) // POSCNT is counting down { if (newp>oldp) Tmp1 = – (_IQ(1) – newp + oldp); // x2-x1 should be negative else Tmp1 = newp -oldp; } else if (p->DirectionQep==1) // POSCNT is counting up { if (newp<oldp) Tmp1 = _IQ(1) + newp – oldp; else Tmp1 = newp – oldp; // x2-x1 should be positive }

if (Tmp1>_IQ(1)) p->Speed_fr = _IQ(1); else if (Tmp1<_IQ(-1)) p->Speed_fr = _IQ(-1); else p->Speed_fr = Tmp1;

// Update the electrical angle p->oldpos = newp; // Change motor speed from pu value to rpm value (Q15 -> Q0) // Q0 = Q0*GLOBAL_Q => _IQXmpy(), X = GLOBAL_Q p->SpeedRpm_fr = _IQmpy(p->BaseRpm,p->Speed_fr); //======================================= EQep1Regs.QCLR.bit.UTO=1; // Clear interrupt flag }

//**** Low-speed computation using QEP capture counter ****// 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 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 = -_IQmpy(p->BaseRpm,p->Speed_pr); // Q0 = Q0*GLOBAL_Q => _IQXmpy(), X = GLOBAL_Q else // Forward direction = positive p->SpeedRpm_pr = _IQmpy(p->BaseRpm,p->Speed_pr); // Q0 = Q0*GLOBAL_Q => _IQXmpy(), X = GLOBAL_Q

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

如题。 谢谢

Martin Yu:

回复 liang feng1:

这两段代码都是用来计算速度的,上面的是应用于高速,利用计算每10ms时间段里面QEP接收到几个脉冲信号的原理,因此利用了UT单位时间事件;下面部分是用在低速时的,利用计算QEP接收到的两个相邻信号之间的时间间隔来计算速度,因此用了UP单位位置事件。具体的原理解释可以在SPRUFK8文档上第25~26页找到。

如题。 谢谢

chincise Ji:

回复 Martin Yu:

请问何时判为高速,何时算做低速呢?

如题。 谢谢

Jason Wu4:

回复 chincise Ji:

这个根据具体情况设定,如上10ms内至少一次脉冲以上的速度为高速,否则即为低速

赞(0)
未经允许不得转载:TI中文支持网 » F28035 中的QEP正交编码电路的工作原理是什么?
分享到: 更多 (0)