Quick n dirty HPWM out of phase


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Posts
    36

    Default Quick n dirty HPWM out of phase

    Assuming a PIC with at least 2 PWM channels, can someone suggest a quick way to output two PWMs exactly 180 degrees out of phase with each other?

    I can do it by turning alternating pins on and off but there's no CPU left to do anything else without messing up the waveform.

    Trying not to recreate the wheel...or maybe it's so obvious I can't see the answer.

    Thanks

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ChrisHelvey View Post
    Assuming a PIC with at least 2 PWM channels, can someone suggest a quick way to output two PWMs exactly 180 degrees out of phase with each other?

    I can do it by turning alternating pins on and off but there's no CPU left to do anything else without messing up the waveform.

    Trying not to recreate the wheel...or maybe it's so obvious I can't see the answer.

    Thanks
    Hardware ways, flip flop, inverter, transistor . . . since you do not want to burden PIC.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Use a PIC with an ECCP (ENHANCED CAPTURE/COMPARE/PWM MODULE)
    16F690 is one.

    Put it in Enhanced Half-Bridge mode.
    Outputs will be on P1A and P1B pins.
    <br>
    DT

  4. #4
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ChrisHelvey View Post
    Assuming a PIC with at least 2 PWM channels, can someone suggest a quick way to output two PWMs exactly 180 degrees out of phase with each other?
    How about a PIC with a Comparator. Feed the PWM into comparator and use the comparator output to give your out of phase signal.

    Advantages...

    No external components
    no software overhead other than setting up comparator

    Disadvantages...

    You lose one comparator and a few pins on your PIC
    Keith

    www.diyha.co.uk
    www.kat5.tv

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Thumbs up

    oooo, I Like it Keith.
    <br>
    DT

  6. #6
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    oooo, I Like it Keith.
    <br>

    Sadly I cant take the credit.

    The idea was originally suggested by Melanie but it stuck in my mind because I have an device that uses the HPWM to generate an IR carrier which I then gate with a transistor. Too late to change my existing design but I will use the comparator to do the gating in a later revision of the board.

    Not only does it save a transistor and a couple of resistors but has a better voltage swing as well!
    Keith

    www.diyha.co.uk
    www.kat5.tv

  7. #7
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Darn Melanie. She's just too smart for her own "Britches".

    Which is why I tend to envision her without them.

    Oh wait, I'd have done that anyways.

    At least you applied it to the right problem.
    <br>
    DT

  8. #8
    Join Date
    Jul 2006
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    That is a very elegant solution - just what I was looking for.
    Thanks, I will look in to this. The link to Melanie's post is very helpful. Since 0 Volts is "low voltage" it should work exactly the same - when the pulse goes low, the comparator output goes high.
    Brilliance is always in the simplicity...

Similar Threads

  1. 3 phase supply detector challenge
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 15th May 2009, 07:54
  2. VFD and HPWM
    By shawn in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th January 2009, 02:12
  3. HPWM of the port of two HPWM
    By ja2rqk in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th April 2007, 15:05
  4. sound command & music
    By trying in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th May 2006, 14:14
  5. 3 HPWM channels
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2006, 02:43

Members who have read this thread : 0

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