First of all thank you for such a nice and detailed explanation.!! "Now you are free to chose which pin you want to use. Let's take TA1 (second timer module) and from this module we take CCR1 for setting our duty-cycle. We can now choose between P2.1 and P2.2 " As you mentioned above that any pin can be selected for pwm operation, i have used BOTH the pins as OUTPUT. The reason is, i want to drive 4 MOSFET in an interleaved synchronous buck regulator and i am using 2 half bridge IRS2003 MOSFET driver. The MOSFET Driver is designed for such type of application where only one pwm input is required if we SHORT both HIN and LIN inputI. I.e. The internal circuit will take care of the two MOSFET not being ON together. HIGH input TO HIN will output HIGH at HO HIGH input TO LIN will output LOW at LO with some dead time. NOW, PIN2.1 will be input to MOSFET DRIVER 1 and PIN2.2 will be input to MOSFET DRIVER 2, ensuring BOTH HIGH SIDE mosfet are ON simultaneously and BOTH LOW SIDE mosfet are OFF simulataneously thus ensuring interleaved synchronous buck operation. I have updated the pin configuration of the same code you have written. Can you please verify that my logic is correct and the code i have written should work....!!! #include "msp430g2553.h" void main( void ) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer BCSCTL1 = CALBC1_1MHZ; // Set DCO range DCOCTL = CALDCO_1MHZ; // Set DCO step and modulation P2DIR |= 0x06; // Set P2.1 and P2.2 as an output-direction P2SEL |= 0x06; // Set selection register 1 for timer-function P2SEL2 &= ~0x06; // Clear selection register 2 for timer-function (not needed, as it is 0 after startup) TA1CCTL1 = OUTMOD_7; // Reset/set TA1CCR0 = 20000; // Period TA1CCR1 = 1500; // Duty-cycle TA1CTL = (TASSEL_2 | MC_1); // SMCLK, timer in up-mode while( 1 ) // Endless-loop (main-program) { // Do nothing, hardware-based PWM } } Thank you in advance..!
↧