Code to invert PWM output?

I need to generate a 100Hz sinewave with a 16F628 using LUT and PWM output.

A simultaneous 180 degree inverted copy is also required to drive the other half of a push-pull power stage.

Once the original sinewave has been generated, what is the preferred coding method for causing its anti-phase replicate appear at another out port?

Thank you,

Bill

Reply to
Bill
Loading thread data ...

I'm not familiar with the 16F628 and its PWM output, but the obvious solution seems to be to use two LUT pointers to obtain the values to be output at each step, one pointer traversing from the beginning to the end of the LUT and the other from the end to the beginning.

--
========================================================================
          Michael Kesti            |  "And like, one and one don't make
                                   |   two, one and one make one."
          mkesti@gv.net            |          - The Who, Bargain
Reply to
Michael R. Kesti

There's only one PWM module in the 16F628, so you can't do it that way. What's wrong with connecting a CMOS inverter (eg. 1/6 74HC04) to the CCP1 pin?

Best regards, Spehro Pefhany

--
"it's the network..."                          "The Journey is the reward"
speff@interlog.com             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com
Reply to
Spehro Pefhany

I am presuming, from your stated requirements, that you will be using the push-pull stage followed by a low-passs filter and will be sending the PWM at a much higher frequency (but correct me if I presume wrongly).

When driving a push-pull power stage it is important for the integrity of the power supply that both halves are guaranteed never to be on simultaneously. I tend to use three gates from two microcontroller outputs to achive provide this guarantee. However, from Spehro's post I gather that the 16F628 has only one PWM output. You would do well to invert the single output with an inversion gate then follow on with three NAND gates that are configured to prevent both outputs being on together.

--
********************************************************************
Paul E. Bennett ....................
Forth based HIDECS Consultancy .....
Mob: +44 (0)7811-639972 .........NOW AVAILABLE:- HIDECS COURSE......
Tel: +44 (0)1235-811095 .... see http://www.feabhas.com for details.
Going Forth Safely ..... EBA. www.electric-boat-association.org.uk..
********************************************************************
Reply to
Paul E. Bennett

The output routed to another input that triggers an edge triggered interupt?

Cheers

Klaus

Reply to
Klaus Vestergaard Kragelund

Hi Bill,

do you need a dead band in between 1 PWM and the other?? ie in a 1/2 bridge configuration??

you will need external logic to do this or use the new PIC 16F684, it has a complementary PWM generator, can drive a full H or 1/2 H bridge no probs....

if you need more information drop me an email,

Dave

Reply to
David Powell

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.