麻烦老师们解释一下下面这段程序:void F281X_EV1_QEP_NO_INDEX_Calc(QEP *p){int32 Tmp;// Check the rotational directionp->DirectionQep = 0x4000&EvaRegs.GPTCONA.all;p->DirectionQep = p->DirectionQep>>14;// Check the timer 2 counter for QE
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/17 22:17:46
麻烦老师们解释一下下面这段程序:void F281X_EV1_QEP_NO_INDEX_Calc(QEP *p){int32 Tmp;// Check the rotational directionp->DirectionQep = 0x4000&EvaRegs.GPTCONA.all;p->DirectionQep = p->DirectionQep>>14;// Check the timer 2 counter for QE
麻烦老师们解释一下下面这段程序:
void F281X_EV1_QEP_NO_INDEX_Calc(QEP *p)
{
int32 Tmp;
// Check the rotational direction
p->DirectionQep = 0x4000&EvaRegs.GPTCONA.all;
p->DirectionQep = p->DirectionQep>>14;
// Check the timer 2 counter for QEP
p->RawTheta = EvaRegs.T2CNT;
// Compute the mechanical angle in Q15
Tmp = __qmpy32by16(p->MechScaler,p->RawTheta,31); // Q15 = Q30*Q0
p->MechTheta = (int16)(Tmp); // Q15 -> Q15
p->MechTheta &= 0x7FFF; // Wrap around 0x07FFF
// Compute the electrical angle in Q15
p->ElecTheta = p->PolePairs*p->MechTheta; // Q0*Q15 = Q15
p->ElecTheta &= 0x7FFF;
}
本人刚学DSP,求解释光电编码器QEP程序,
麻烦老师们解释一下下面这段程序:void F281X_EV1_QEP_NO_INDEX_Calc(QEP *p){int32 Tmp;// Check the rotational directionp->DirectionQep = 0x4000&EvaRegs.GPTCONA.all;p->DirectionQep = p->DirectionQep>>14;// Check the timer 2 counter for QE
(QEP无效F281X_EV1_QEP_NO_INDEX_Calc * p)
{
int32 Tmp;
/ /支票的旋转方向
p - > DirectionQep = 0x4000&EvaRegs.GPTCONA.all;
DirectionQep p - > > > = p - > DirectionQep 14;
/ /检查柜台办理QEP定时器2
p - > RawTheta = EvaRegs.T2CNT;
/ /计算力学角度在Q15
__qmpy32by16 Tmp = >(p - p - >,RawTheta MechScaler、31);/ / Q15 Q0 = Q30 *
MechTheta p - > =(int16)(Tmp);/ / Q15 Q15 - >
p - > MechTheta & = 0x7FFF 0x07FFF;/ /包裹
/ /计算电子角度在Q15
ElecTheta p - > > = p - p - > MechTheta PolePairs * * Q15;/ / Q0 = Q15
p - > ElecTheta & = 0x7FFF;