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.

TMS320F28027: Non-sine table PWM code

Part Number: TMS320F28027
Other Parts Discussed in Thread: C2000WARE

I am looking for a sinusoidal PWM generation code that doesn't use a sine look-up table.

I need to vary the output frequency from 0 to 2000Hz with a carrier frequency of 20KHz.

  • Keith,

    I think the best way to implement this on F28027 is with the IQ math library. The _IQsin() function takes 46 cycles which seems modest with a 20 kHz ISR, even if you are running on a 40 MHz version of the device. There really isn't any example code for exactly this, however you may find the small F28027 example in C2000Ware useful as it shows how the use of _IQsin in a for() loop. Assuming the default C2000Ware installation path, you should find it at:
    C:\ti\c2000\C2000Ware_1_00_03_00\libraries\math\IQmath\c28\examples

    Your code would have to manipulate a software counter in your 20 kHz ISR to get the index value before calling _IQsin(). The counter increment would be different for each frequency. In principle it's straightforward but unfortunately I don't think we have a similar example.

    Regards,

    Richard