Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

How to select pins for PWM through Timer A in Up Mode on MSP430G2553

$
0
0

Hi,

I modified the sample program "msp430g2xx3_ta_16.c" to try to use Timer A in Up Mode PWM on all P1 pins (I have changed the code to set all P1 bits more as an experiment, don't ask what I am trying to do :) ). If you run it you get the output on P1.2 and P1.6  ( P1.2 = 0x04 and P1.6 = 0x40 ) but not the other pins on the MSP430G2553.

#include <msp430.h>

int main(void) {   WDTCTL = WDTPW + WDTHOLD;               // Stop WDT  
P1DIR |= 0xFF;                           
P1SEL |= 0xFF;                           
CCR0 = 512-1;                             // PWM Period  
CCTL1 = OUTMOD_7;                         // CCR1 reset/set  
CCR1 = 384;                               // CCR1 PWM duty cycle  
TACTL = TASSEL_2 + MC_1;                  // SMCLK, up mode

  _BIS_SR(CPUOFF);                          // Enter LPM0
}

 

How would I have known from the datasheet ( http://www.ti.com/lit/ds/symlink/msp430g2553.pdf )?

Is it possible to get Timer A PWM on other pins as well? How would I modify the sample?

Thank you!!


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>