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.

sine wave - first 180 degrees only

Other Parts Discussed in Thread: TMS320F28069

My project is a switching power supply and I have to generate PWM signals. We are using TMS320F28069 in our design and to familiarise myself with the architecture, I was following the lab examples in C2000 teaching ROM (module 7, lab 7-9 which talks about generating a sine wave). It mentions presence of a sine look up table in ROM that I can use with IQMath library. This particular table of 512 items has sine values for full 360 degrees.

In my code, I only need to generate a 180 degree cycle, so could I just use the first 256 values? In theory it should work but I wonder if the distribution of values in this table are not linear so index0-index256 don’t necessarily represent the 180 degree swing.

Any thoughts on this please?

Thanks,

Samie

  • The sine table is linear; 512 values for 0...360 degree, step size is 360/512 degree. Just access the first 256 values.

     

  • Thanks for your reply.

    It turned out that I couldn't make full use of ALL 256 values. The sine wave I am trying to genrate is 400Hz. I am currently following the example in Lab7-9 in C2000 teaching ROM. It is my understanding that to make use of full 256 values of 180 degrees, I would need to feed in the next value for next PWM cycle every 4.88us (leading to 4.88us x 256 = 1.25 millisecond, which is the time for one half of sine wave, i.e. 0-180 degrees. The same is done for the other half but in opposite direction and an integration of these on an H-bridge would give a full sine wave.

    However, the problem is that to feed in duty cycle value for next PWM cycle value every 4.88us, I need the PWM block to be able to trigger any interrupt every 4.88us. This is not possible because my requirement is to have the PWM of frequency 50KHz, so ther interval between interrupts is 20us.

    So I ended up using only 1/4 of the table, i.e. first interrupt use sinetable[0], second interrupt use sinetable[4], third interrupt use sinetable[8] and so on until index reaches 256 at which point I start driving the PWM on the other FET pair. 

    If you have any comments on this, I would greatly appreciate.

    Thanks,

    Samie