Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

generate two PWM signal with only 2 CCR ( CCR0 & CCR1)

Not open for further replies.


Advanced Member level 2
Jul 5, 2009
Reaction score
Trophy points
Activity points
please i need help, i have an msp430 mmicrocontroller, that have only two CCR ( CCR0 & CCR1), i wish to output two PWM signal with same frequence but without the same duty cycle, is this possible ? and how can i do this ?

If it has two CCRs then it should be able to generate two PWMs. They will definitely have the same frequency (because it's the same clock that runs them). The duty cycle is set by writing a value to the CCR. Check the datasheet for the appropriate registers for setting it up. Also, see forums.


Here's a fairly nice tutorial with code to setup both PWM channels for output simultaneously:

•Timer / PWM (Updated 2/22/08)
◦Timer B is used to generate pulse-width modulated waveforms.
◦In the project files, Timer B output TB2 is used to output a PWM waveform which appears on pin P4.2. The duty cycle of this waveform is controlled by writing to the global variable D0.
◦In the project files, Timer B output TA3 is used to output a PWM waveform which appears on pin P4.3. The duty cycle of this waveform is controlled by writing to the global variable D1.
◦See the PWM tutorial for additional information on using the timer as a pulse-width modulator.
◦The project files were updated on 2/22/08 to reflect the above changes, fixing a bug that occured when the timer A duty cycle was set to zero. You can download the new project files, paste your existing code into the main.c file, and move your PWM output connections to pins P4.2 and P4.3, and your code should work.

The tutorial appears answer your question and demonstrate it with sample code as well.

Hope this info helps in your endeavors.

ok but the poblem is that i want that this two PWM will drive two N-MOSFET, so i need a deand time between this two signal :(

So, code accordingly.

The PWM waveform parameters are not written in stone, you can modify them during runtime.

---------- Post added at 10:23 ---------- Previous post was at 10:10 ----------

If you actually drew a timing diagram of the two pulse chains in relationship to one another, I should be able to make recommendation as to the required code.

i have only one timer (timer A), so i like to output two signal PWM with frequency 1 khz and with two different duty cycle with dead time, for 60% and 40% duty cycle, i used the MSP430F2011IPW microcontroller

I also have the same question about PWM output in MSP430. I have a MSP430F169, and i need output nine channels of PWM wave. Can I do it ?
Now I can have eight channels not nine channels. First, in TIMER A, TACCR0 for period, TACCR1 for one duty cycle, and TACCR2 for another duty cycle. Second, in TIMER B, TBCCR0 value for period, TBCCR1~TBCCR6 value for six duty-cycle. So now finally I got eight channels PWM by MSP430F169. Is there possible to output nine channels by MSP430F169?

If you want the same frequency in all PWM channels you can set one timer to that freq. and then just compare each Duty Cycle to that timer and then set the corresponding PIN, and do the same with each channel, and the when the timer overflow you need to set all channels to 0 and start over.

Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to