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.

CCS/TMS320F28335: Issues with HRPWM math operations/update

Part Number: TMS320F28335


Tool/software: Code Composer Studio

Hello,

I ran into some challenges when I was trying to update CMPAHR register through epwm ISR earlier. Anytime I try to run this subroutine:

__interrupt void  epwm_isr(void)
{
  EPwm4Regs.CMPA.half.CMPA = int(dutycalc*EPwm4Regs.TBPRD);  //ERROR 1
  EPwm4Regs.CMPA.half.CMPAHR = (modf(dutycalc*EPwm4Regs.TBPRD)*MEP_ScaleFactor+1.5)<<8; //WARNING 2 AND ERROR 3
  EPwm4Regs.ETCLR.bit.INT = 1;       // Clear INT SEQ1 bit
  PieCtrlRegs.PIEACK.all = PIEACK_GROUP3;   // Acknowledge interrupt to PIE
  return;
}

I get the following error messages:

1. error: expected an expression

2. warning: function "modf" declared implicitly

3. error: expression must have integral type

I got the first 2 lines from the HRPWM user guide. I have tried including <cstdlib> and <cmath>....... it didn't work. I feel this is a small problem but I have been unable to find a solution.

I'd appreciate any pointers. + I am using ccs6

Thanks.

David.