+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2019
    Posts
    1

    Default PWM calculated?, not table

    I have seen several posts about PWM in order to make a one phase inverter, and most use a long values table calculated to get the sine wave, but what if it calculates the duty value each time?


    I have a graph where can be seen some details, but I don't see the way to attach it. There I see I will have to compensate about 1/7 of cicle time due to the calculation time.
    -----------------
    counter=0
    loop:
    duty=sine[(counter/100)] ' to compesate decimal handle in above lines PWM
    pin,duty,1 PWM pin,duty,cycle at 11,718 Hz
    counter=counter+ n ' 127 cicles n=1, n= 127/195= 0.65 -> 65
    if counter= 19500 then counter=0
    goto loop
    -----------------
    So, What do you think about it?
    Thank you in advance for your answer
    L.J.

  2. #2
    Join Date
    Sep 2009
    Posts
    770

    Default Re: PWM calculated?, not table

    I would use table.
    It is simpler and quicker, than calculating. And once you have one table, you can use same table for 3 phase.
    If you want to have less data points for some reason, use linear interpolation to get approximate values between data points.
    Melanie wrote post about that. You can get sine value with 2 decimal places, using simple table and linear interpolation.

Similar Threads

  1. Replies: 1
    Last Post: - 4th March 2013, 21:57
  2. Help with look up table
    By isaac in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th April 2012, 00:13
  3. 16 X 16 Table
    By CrazyCooter in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 30th November 2006, 08:23
  4. PIC 18F452 Table Pointer/ Table Read
    By sougata in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 14th March 2006, 03:07
  5. Writing to a table.
    By Rhatidbwoy in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 24th December 2005, 16:20

Members who have read this thread : 10

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts