sinusoidal PWM


Closed Thread
Results 1 to 40 of 84

Thread: sinusoidal PWM

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Location
    New Hampshire, USA
    Posts
    107


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Check into Don Lancaster's Magic Sinewaves here: http://www.tinaja.com/
    I did it with a basic stamp BS1 several years ago when I was a newby, it is quite simple and works great.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Hi,
    Attached is an Excel spreadsheet showing an examle of a 72 steps/cycle SIN table with an 8bit dutycycle. You can modify it for any number of steps and resolution you see fit or you may want to create one half cycle and then have your code invert it for the second half and so on - it's up to you.

    To get three phases there's no need to have three tables, you use three pointers 120° appart indexing the same table. So, with the table in the attached .xls you start at steps 0, 24 and 48 respectively.

    /Henrik.

    EDIT: Crap, can't attach the .xls here. Send me a PM with your email adress and I'll send it to you.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    EDIT: Crap, can't attach the .xls here. Send me a PM with your email adress and I'll send it to you.
    Add ".txt" to the extension...
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Ahh, OK, should've thought about that.
    So, here it is - remove the .txt extenstion and open with Excel or compatible.

    /Henrik.
    Attached Files Attached Files

  5. #5
    Join Date
    Oct 2011
    Posts
    52


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Quote Originally Posted by HenrikOlsson View Post
    Ahh, OK, should've thought about that.
    So, here it is - remove the .txt extenstion and open with Excel or compatible.

    /Henrik.
    thankx HenrikOlsson when I download your Excel fileI didn't able to open it please can you help me how to take it so I can open it. thankx

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Hello sangaboy,
    1) Download the file then rename it SIN-table.xls (or whatever ending with .xls) then open it with EXCEL 2003 - or compatible software. I just tried that here and it works fine. If you don't have Excel 2003 perhaps you can find a free viewer or converter online.

    2) The first code snippet you posted is a setup section of DT-Ints which are a set of files making interrupts with PBP a whole lot easier. The second code snippet sets up TMR1 to operate in a specific way and then preloads it with 65534 (which seems a bit strange) but that's what you get when you just copy code. You really need to start a bit further back here. Before taking on a project a like a 3-phase inverter you need to understand the basics of PIC and PBP - at least. How the timers work, how interrupts work and so on.


    Read up on the DT-Ints routines, there are several threads on this forum. Read up on how TMR1 operates, there's a lot of info in the datasheet and a bit of searching here will give a lot, I mean a LOT, of usefull information and examples. Start small otherwise you'll never learn how it works.

    If you get stuck ask specific questions regarding the particular task at hand and tell us what the actual problem is and what you've tried, post the code and so on.

    I really don't want to sound like a smart-ass but if you can't figure out the formula to create a SIN-lookup table then designing and programming a 3-phase inverter drive is going to quite a challange.

  7. #7
    Join Date
    Oct 2011
    Posts
    52


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Hii! to all
    I read DT-Ints routines from ttp://darreltaylor.com/DT_INTS-14/order.html here are some problems I faced any one can help me.
    (1)the difference between PBP AND ASM interrupt handler is not clear to me.
    (2) what the effects of ResetFlag on this code definition.

    INT_LIST macro ; IntSource, Label, Type, ResetFlag?

    Thankx

  8. #8
    Join Date
    Oct 2011
    Posts
    52


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Thankx again HenrikOlsson here are some things which I dont understand I ask for the help from any one
    (1) ask for the help again which formula should I use to generate this sine look up table I need some detail on it thankx.

    (2) and how this portion of code work , what is function, and how to get values of TMR1L AND TMR1H
    ASM

    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler TMR1_INT, _sine, ASM, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM

    T1CON = 000001 ; Prescaler = 8, TMR1ON
    TMR1L = 255
    TMR1H = 254
    @ INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts

Members who have read this thread : 1

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