SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
By tbriseb
#79787
Hi there,

I am doing a project where I plan on using a timer to make a PWM output. What I am wondering is if there is a way to get a second complimentary out as well. This is being used to drive a full H-Bridge circuit and as such I need one PWM driving one side while a complimentary version drives the other side.

I can feed the PWM out to an unsed input pin setup for interrupt, then simple use another output pin and drive an inverted signal out, but this could in essence affect the precision of the RTC (but not likely). I am just wondering if there is a better way to do this or not. Any ideas?

Thanks
Todd
By OldCow
#79789
Yes, as long as the Timer has 3 or more c/c. But TimerB is better if you have a choice. You may want to use the break-before-make feature.
By tbriseb
#79798
Hi OldCow,
Thanks for the quick reply on this.
I am using TimerB. So are you saying that (without looking at the docs becasue they aren't here) I can lets say setup my first c/c (lets say TBCCR1) with a value of 100 and also set TBCCR2 with 100 as well. Then it's simply a matter of setting up TBCCTL1 for OUTMOD_7 (which gives me a PWM result) and setup TBCCTL2 with one of the other settings (not certain which one yet) and this will provide complimentary out version of the other PWM.

If this is the case, then that's awesome. Can you confirm if I'm on the right track?

Thanks again
Todd
By OldCow
#79800
Yes, that is correct.

To drive a H bridge, it is important to use break-before-make. This is in the Users Manual too.
By tbriseb
#79827
Thanks for he info. I'll give it a try and see what I come out with.
For driving my H-Bridge I will be using an integrated H-Bridge that only requires two PWM signals that are complimentary to each other. So I don't think I need to worry abotu break before make issues. If PWMa is more than 50% the motor travels in one direction and if the PWMa is less than 50% it travels in the opposite direction.

Thanks again
Todd
By OldCow
#79831
I thought you were using the term PWM loosely to mean a square wave with adjustable frequency. Now I realize that you really mean Pulse Width Modulation. I am very curious about how this motor works. Do you mind giving me an URL or pointer about this?
By tbriseb
#79834
Hey OldCow,

You are right, it's the real PWM that I am refering to, although I don't really need to make any pulse width adjustments on the fly, other than a solid greater than 50% and less than 50% with it's compliment.

Here's the URL for the device that I am looking at to drive a motor: http://focus.ti.com/docs/prod/folders/p ... v8402.html

Let me know what you think.

Todd
By OldCow
#79866
Todd,

Thanks for the URL.

I am not familiar with motor drives. I read the data sheet of the chip and the user manual of the evaluation board, but cannot tell if this chip is for DC motor or stepping motor. And I am not sure about how to drive the control signals.

For DC motor, my understanding is, you only need one H bridge (per motor). You turn one side of the bridge on with PWM to control the power level, and and turn off the other side of the bridge (with 0% PWM). Which side on and which side off determines which direction the motor turns.

For stepping motor, my understanding is, you use one H bridges for each winding of the motor (thus you need two H bridges per motor). You normally turn on one side of one H at a time (and turn off all other three sides). You step through the four sides and the motor follows those steps. In addition, you can also use complementary PWM to turn on one of the two sides of both H. This is called micro-stepping and you can make the stepping motor to go to a fraction of a full step.

As I said, my knowledge about this is very limited and could be totally incorrect.

-- OCY
By tbriseb
#79871
Hi OldCow,

You pretty much have the DC motor and stepper motor figured out. The way this device works (as it has allot of complexities inside the device) is that you use PWM_A and B for output A and B for one motor. C and D are used ofr a second motor. You deliver a PWM siganl to both A and B (has the complimentary PWM signal). In order to give the motor direction, make the PWM signal less than 50% to get one direction or make the other PWM greater than 50% to get the other direction. The thing to keep in mind is that both PWM signals need to be the same, in other words one has to be the exact compliment of the other.

Thanks again
Todd