In the peoject,we can find the document which is named as f281xpwm.c.
There is a function which is used for updating the PWM.The problem confused me.
Why is the p->PeriodMax amplified to Q15?
At the begining of the function,the p->PeriodMax is amplified to Q15.The Tmp is reduced to Q0.In my opinion,The EvaRegs.T1PR=p->PeriodMax.
It is not necessary to amply p->PeriodMax.The p->PeriodMax can make a assignment to The EvaRegs.T1PR directly.As a result,it can improve the efficiency.
The code like this:
void F281X_EV1_PWM_Update(PWMGEN *p)
{
int16 MPeriod;
int32 Tmp;
// Compute the timer period (Q0) from the period modulation input (Q15)
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;
....
}