6 HPWM signal generation with PIC18F4431


Closed Thread
Results 1 to 23 of 23

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: 6 HPWM signal generation with PIC18F4431

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    How about:
    Code:
    'PWM U phase calculation
    uduty=((sin(t)+128)*4)  
          
    'PWM V phase calculation
    vduty=((sin(t+85)+128)*4)
        
     'PWM W phase calculation
    wduty=((sin(t+170)+128)*4
    Attachment 5180

    It's true that you can't mutliply by 0.5 but you can divide by 2. You can also use the ** operator to multiply by units of 1/65536 so instead of doing x=y*0.72 you do x=y**47186 (where 47186 comes from 65536*0.72)

    /Henrik.
    Thanks a lot for your tips
    Just a question : what simulator are you using ? (because my ISIS Proteus gives me very weird results):



    It's your code with angle phase offsets...
    Last edited by pxidr84; - 19th February 2011 at 13:02.

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


    Did you find this post helpful? Yes | No

    Default Re: 6 HPWM signal generation with PIC18F4431

    Hi,
    I'm not using a simulator, I just sent the values to the PC and plotted them with EXCEL. Here's the exact code I used to test with:
    Code:
    DEFINE LOADER_USED 1
    DEFINE OSC 20
    DEFINE HSER_BAUD 19200
     
    i VAR BYTE
    T VAR BYTE
    uDuty VAR WORD
    vDuty VAR WORD
    wDuty VAR WORD
     
    Main:
    For i = 0 to 2   'Make three periods
      T=0
        
       for T=0 to 255
       ' PWM U phase calculation
       uduty=((sin(t)+128)*4)  
          
       ' PWM V phase calculation
       vduty=((sin(t+85)+128)*4)
        
       ' PWM W phase calculation
       wduty=((sin(t+170)+128)*4)
       
       HSEROUT [DEC uDUTY, ",", dec vDUTY, ",", dec wDUTY, 13]
      next
    NEXT
    WereDone:
    Goto WereDone
    Try removing C3, C6 and C8 to start with.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: 6 HPWM signal generation with PIC18F4431

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    I'm not using a simulator, I just sent the values to the PC and plotted them with EXCEL. Here's the exact code I used to test with:
    Code:
    DEFINE LOADER_USED 1
    DEFINE OSC 20
    DEFINE HSER_BAUD 19200
     
    i VAR BYTE
    T VAR BYTE
    uDuty VAR WORD
    vDuty VAR WORD
    wDuty VAR WORD
     
    Main:
    For i = 0 to 2   'Make three periods
      T=0
        
       for T=0 to 255
       ' PWM U phase calculation
       uduty=((sin(t)+128)*4)  
          
       ' PWM V phase calculation
       vduty=((sin(t+85)+128)*4)
        
       ' PWM W phase calculation
       wduty=((sin(t+170)+128)*4)
       
       HSEROUT [DEC uDUTY, ",", dec vDUTY, ",", dec wDUTY, 13]
      next
    NEXT
    WereDone:
    Goto WereDone
    Try removing C3, C6 and C8 to start with.
    In reality, I think that my RC filter in Proteus is bad.

    If I watch the raw PWM outputs, it seems perfectly good (with correct phase angles and duty cycles). However, in extreme duty (like 0 or 1023), the PWM "jumps" (like before, I think it's a sim issue, I will try the PIC in the real life with an oscilloscope).

    In other words, my code is working quite well now, thanks for the "**", I didn't know this operator before, until now.

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


    Did you find this post helpful? Yes | No

    Default Re: 6 HPWM signal generation with PIC18F4431

    Hi,
    Like I said in an earlier post, I think it is the dead-time insertion that makes the waveform "jump" at the extreme ends. Do try it with real hardware and let us know how it goes. Just remember that if you low-pass filter the PWM to watch it on a scope might not see any artifacts introduced by the deadtime insertion - if indeed that is what's causing it. So make sure you watch the "raw" PWM signals as well in order to see if it behaves as in the simulator.

    As a simple test, try removing the deadtime insertion from the code and see if it still looks strange in the simulator.

    /Henrik.

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: 6 HPWM signal generation with PIC18F4431

    Quote Originally Posted by HenrikOlsson View Post
    Hi,
    Like I said in an earlier post, I think it is the dead-time insertion that makes the waveform "jump" at the extreme ends. Do try it with real hardware and let us know how it goes. Just remember that if you low-pass filter the PWM to watch it on a scope might not see any artifacts introduced by the deadtime insertion - if indeed that is what's causing it. So make sure you watch the "raw" PWM signals as well in order to see if it behaves as in the simulator.

    As a simple test, try removing the deadtime insertion from the code and see if it still looks strange in the simulator.

    /Henrik.
    Yes, of course I've readed your post above. I've modified the code (add +3 to the end of each line), now the PWM signal doesn't "jump" anymore.
    However, if I remove the deadtime or even modify it, the jumpy PWM remains.

    Now signals are better, but sine are not perfect for the highest frequencies, I think that my low-pass filter hasn't good R and C values (1k and 1000nF).


  6. #6
    senertek's Avatar
    senertek Guest


    Did you find this post helpful? Yes | No

    Default Re: 6 HPWM signal generation with PIC18F4431

    hi ,
    I have already developped many ac inverters range 0.75 kw to 915 kw..with . I seen this thread ..it s very good..to see picbasic projects in this field....
    Designing one 3 phase ac inverter is not easy project...you must know many kind of points about high voltage igbt , drivers , dcbus topologys ,emc ,emi , multi tasking etc...(it take many years)
    If you want , I can help for your project..
    I can try your codes with my high voltage kits , igbt driver modules ...and inform you ..codes works or not...

    savas

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: 6 HPWM signal generation with PIC18F4431

    Quote Originally Posted by senertek View Post
    hi ,
    I have already developped many ac inverters range 0.75 kw to 915 kw..with . I seen this thread ..it s very good..to see picbasic projects in this field....
    Designing one 3 phase ac inverter is not easy project...you must know many kind of points about high voltage igbt , drivers , dcbus topologys ,emc ,emi , multi tasking etc...(it take many years)
    If you want , I can help for your project..
    I can try your codes with my high voltage kits , igbt driver modules ...and inform you ..codes works or not...

    savas
    Thanks.

    Well, I'm doing studies in electrical engineering, so I've a litte knowledge about this.
    I'm using an intelligent IGBT module from STMicroelectronics, the STGIPS20K60 (datasheet : http://www.st.com/internet/com/TECHN...CD00244265.pdf).

    No drivers needed (they're integrated), just optocouplers.

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