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.
使用PM_Sensorless例程时遇到一个疑问,PWM_MACRO中一段程序如下:
Tmp = (int32)p->PeriodMax*(int32)p->MfuncPeriod; // Q15 = Q0*Q15
MPeriod = (int16)(Tmp>>16) + (int16)(p->PeriodMax>>1); // Q0 = (Q15->Q0)/2 + (Q0/2)
EvaRegs.T1PR = MPeriod;
// Compute the compare 1 (Q0) from the PWM 1&2 duty cycle ratio (Q15)
Tmp = (int32)MPeriod*(int32)p->MfuncC1; // Q15 = Q0*Q15
EvaRegs.CMPR1 = (int16)(Tmp>>16) + (int16)(MPeriod>>1); // Q0 = (Q15->Q0)/2 + (Q0/2)
中CMPR1比较器值为什么等于MPeriod*MfuncC1/2+MPeriod/2,而不是MPeriod*MfuncC1?