This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430G2333: Can I get two independent PWM outputs plus a timer form this chip?

Part Number: MSP430G2333


I am fairly new to MSP430's but have I have programmed a state machine and a whole lot of functions into this chip so far without any problems so far.

I am using Timer0 to generate a 1ms timer tick through an interrupt, which is used for a whole lot of timing events in the main() - no issues and it works nicely.

The only thing in this project now is to generate two PWM's - one to port P2.0 and the other to port P2.1. They can both have a have a period of 1ms. The CPU clock is 1MHz.

I just need to vary the duty cycles on each of these outputs independently. Reading the datasheet, I think this is possible.

How can I generate the two PWM outputs without messing up Timer0? Can I use the second timer to generate the two independent PWM duty cycles? If so, how should the registers be set up? Any suggestions much appreciated!



  • As a general statement, you can do this, as long as the periods are the same. Keep your CCR0 interrupt and set CCR1 and CCR2 appropriately. You can independently have interrupts for CCR1 and CCR2, though this isn't usually required for simple PWM.

    You'll notice I said CCR1 (TA1.1=P2.1) and CCR2, (TA1.2=P2.4), not CCR0 (TA1.0=P2.0). CCR0 isn't useful for "real" PWM since the On and Off triggers are the same. [Ref User Guide (SLAU144J) Sec]

  • Hi Bruce, THANKS so much for this. I think this steers me in the right direction. I'll give it a try over the next couple of days. If it all goes well, I'll owe you a beer!



  • Your post helped me sold the problem. Because my PCBA was only in the proto stage, I could swap P2.0 with P2.4 (with some microsurgery on 0.2mm tracks). And voila! It all works beautifully. I used Timer0 for a 1ms timer tick, and TA1CCR1 and TA1CCR2 for the independent PWMs. A re-spin was required anyway, so it is easy to swap the tracks.

    After I got this going the rest of the coding to vary the duty cycles dynamically was a piece of cake. The firmware part of the project is complete. The USer Guide SLAU144J was extremely useful. Thanks, Bruce.