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.
halo,
i am using the msp430g2452 and i download the source code from ti website.
it has tutorial for creating pwm for port 1.2.
then i notice at the data sheet msp430x2xx family (page 368)
show how to create pwm using taccr2. So i try to modify the source code as follow:
//
// MSP430G2xx2
// -----------------
// /|\| XIN|-
// | | |
// --|RST XOUT|-
// | |
// | P1.4/TA1|--> CCR2 - 75% PWM
//
#include <msp430g2452.h>
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0x10; // P1.4 output
P1SEL |= 0x10; // P1.4 options
CCR0 = 512-1; // PWM Period
CCTL2 = OUTMOD_7; // CCR2 reset/set
CCR2 = 384; // CCR2 PWM duty cycle
TACTL = TASSEL_2 + MC_3; // SMCLK, up/down mode
_BIS_SR(CPUOFF); // Enter LPM0
}
the highlight one is the code i changed.
i get output but frequency same as DCO ( frequency cant be modfied using ccro),
and duty cycle is 50 percent regardless the ccr2 value given.
so my question is does msp430g2452 has 2 pwm?
and if it does how can i modify the frequency and duty cycle of second pwm?
halo guys,
i solved the problem,
thank you all for viewing.
P1SEL2 |= 0x10 is need to activate the function TA0.2;
datasheet SLAS722E page.42.
Thank a lot!!!
I have similar problem and it make me little crazy.
Yours post really save my mind!)
That is the beauty of learning programming by using "sample code". You can easily make the CPU go crazy -- and yourself too!
**Attention** This is a public forum