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

MSP430F5529: MSP430F5520 PWM with Timer B

$
0
0

Part Number: MSP430F5529

Need some help with Timer B for PWM on MSP-EXP430F5529 LaunchPad.  I've setup PWM with Timer A, with output to P1.2 with no issues.  When I try to set the same thing up for Timer B P3.5 I don't get any PWM signal.  Below are the codes for both the Timer A and Timer B.  the data sheet for the MSP430F5529 shows the CCR5 for the time block.  I'm sure I'm missing something but not sure what.  Any help/suggestions would be appreciated.

#include <msp430f5529.h>

int main(void) {
    WDTCTL = WDTPW + WDTHOLD;           //Disable the Watchdog timer for our convenience.
    P1DIR |= BIT2;                      //Set pin 1.2 to the output direction.
    P1SEL |= BIT2;                      //Select pin 1.2 as our PWM output.
    TA0CCR0 = 7000;                     //Set the period in the Timer A0 Capture/Compare 0 register to 7000 us.
    TA0CCTL1 = OUTMOD_7;                //TACCR1 reset/set mode
    TA0CCR1 = 350;                      //The period in microseconds that the power is ON. It translates to a 5% duty cycle.
    TA0CTL = TASSEL_2 + MC_1;           //TASSEL_2 selects SMCLK as the clock source, and MC_1 tells it to count up to the value in TA0CCR0.
//    __bis_SR_register(LPM0_bits);   //Switch to low power mode 0.
}
#include <msp430f5529.h>

int main(void) {
    WDTCTL = WDTPW + WDTHOLD;           //Disable the Watchdog timer for our convenience.
    P3DIR |= BIT5;                      //Set pin 3.5 to the output direction.
    P3SEL |= BIT5;                      //Select pin 3.5 as our PWM output.
    TB0CCR0 = 7000;                     //Set the period in the Timer B0 Capture/Compare 0 register to 7000 us.
    TB0CCTL1 = OUTMOD_7;                //TBCCR1 reset/set mode
    TB0CCR5 = 350;                      //The period in microseconds that the power is ON. It translates to a 5% duty cycle.
    TB0CTL = TBSSEL_2 + MC_1;           //TBSSEL_2 selects SMCLK as the clock source, and MC_1 tells it to count up to the value in TB0CCR0.
//    __bis_SR_register(LPM0_bits);   //Switch to low power mode 0.
}


Viewing all articles
Browse latest Browse all 262198

Trending Articles



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