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.

F28035 fixed point multiplication

Other Parts Discussed in Thread: CONTROLSUITE

Hello all,

I have a basic question in embedded programming, hoping to get educated from the forum :)

I am using F28035 microcontroller and I have few calculations to be made in my code. This is how I am doing and please let me know if it is not the efficient way of doing.

Uint16 PWM_TIMER_TBPRD;
Uint16 PhaseLossResolution;

Uint16 SixtyDegUS;
Uint16 OneTwentyDegUS;

Uint16 RefPulseWidth;

void main(void)

{

//Initialize

PWM_TIMER_TBPRD = 1249;
    PhaseLossResolution = 350;

SixtyDegUS = 2777;    OneTwentyDegUS = 5555;

for(;;)

{   CalcVarFreq(); 

RefPulseWidth = 8333; //I get this value from eCAP module

      }}

void CalcVarFreq()
{
SixtyDegUS = 0.3333*RefPulseWidth;           
    OneTwentyDegUS = 0.6666*RefPulseWidth;       
    PWM_TIMER_TBPRD = (0.15625*RefPulseWidth);
    PhaseLossResolution = 0.04*RefPulseWidth;
}

Thanks in advance

Sandhya

  • Hi Sandhya,

    F28035 being a Fixed point controller and hence '*' for multiplication operation would be in-efficient if compared to IQMath. You can try using IQMath library for multiplication operation. You would be amazed with the CPU clock cycles consumed! Use Clock Profile option in CCS for comparing the results.

    Here's the user guide for the same: C:\ti\controlSUITE\libs\math\IQmath\v160\doc

    Regards,
    Gautam