EmbeddedRelated.com
Forums

TimerA or TimerB 2 square waves with 180 degree out of phase.

Started by Kris De Vos October 19, 2002
> By using either timerA or timerB in msp430f449 how do you generate two square waves 180 degree out of phase with each other.

Interesting,

My first reaction would be to synchronize 2 compare channels and trigger the output units, one to set bit
the other to clear bit, or opposite toggle mode.... ?
(add an inverter externally ......:-)

Beginning Microcontrollers with the MSP430

Last time I did a PWM drive I used an external MOSFET driver chip which had
complementary non-overlapping outputs. That way you only need one polarity
of output.

What exactly do you want to use these 2 outputs for?

Ray
Thanks for the early responses.

Well, I believe the way that Ray is recommending is a nice way to do.

>>What exactly do you want to use these 2 outputs for?

I like to drive the piezo buzzer with each output. I thought that it might
make the piezo buzzer sound louder?

I had this question in my mind anyway, is there a technique to use the PWM
and to have to square waves 180 degree out of phase of each other?

Thanks,
John.
>... is there a technique to use the PWM
>and to have to square waves 180 degree out of phase of each other?

The simplest solution would be an external inverter.

R.W.
> I like to drive the piezo buzzer with each output. I thought that it might
> make the piezo buzzer sound louder?

It will ..

If your MSP430 is at 3 Volts DC, and you're toggling the piezo's pins 180 degrees out of phase, you're
creating twice the peak-to-peak amount of voltage on it - ie. 6 Volts pp.

Cheers
Kris
Wouldn't the simplest solution be two compare channels, one Toggle/Set and
one Toggle/Reset?

And yep, that does give a full-wave drive across the piezo and increase
output. Although MSP outputs are pretty wimpy.

Bruce
That would have been my reaction too. Use the output units like Bruce says.
I've never actually had the need to synchronize several output units in PWM, so I'd be
rather curious to see how you end up tackling that one. The compare module should
allow you 1-23 to do that

If you want more "beep" out of a piezo (providing it's capacitive), I once drove annunciation sounds
out of a single I/O line into a 4001 CMOS with 2 NORs set up as inverter. Tie the "beep" I/O line onto the first
inverter, and connect the inverter's output to the second with the piezo between in and out of 2nd inverter.
Use a second I/O line to turn a TC7660 or similar on/off (voltage doubler), two 0.1 uF caps and 2 Shottky diodes
(like BAT54) is fine, as the piezo uses very lttle current (depend freq)

Tie the 6 Volt output of the doubler onto the 4001's Vcc, and voila, you've got 12 Volts pp out of your
piezo - a LOT louder.
To save current, turn on the TC7660 (or similar) only when you need annunciation from the piezo.

If you're not sure how to connect it, send me an Email and I'll paste the schematic into a DOC file.
Works fine, was used in a 100K production run back in 1995.

Cheers
Kris
As long as we're brainstorming it's worth reminding I guess that any design
with a MAX-type RS232 driver in it has a free +/-10v piezo drive too.

Bruce
Ouch :-)

You got a good point there Bruce.....
The scenario I described before is really just that isn't it ?
Switched capacitor pump, and inverting the outputs......
The 3 Volt version of eg. a Sipex 232 style I/F will give +6/-6 Volts, and
the logic input's ones and zeroes become +/- 6 Volts.

I don't even know what these beasties are worth today..
Back then it was the cheapest and lowest current solution. It had to drive
a little piezo that was sealed by Ultrasonic welding into a small case (handheld
RF device).

If you don't use H/W handshaking, there's a TX and RX channel free on a standard
2 in / 2 out device.
Good thinking # 99 !!!!!!
:-)
Thanks all, for all the good ideas that I did receive also. I am going to
try the RS232 driver chip made by maxim to drive the piezo. Ofcourse there
is another way and that is to drive the piezo with a coil and a transistor.
This way you only turn the piezo on and off by turning the transistor on and
off.

Thanks,
John.