Dear forum members,
I am using MSP430F1611 in my project. I am trying to generate a PWM using TimerB7 on Port pin P4.5/TB5. My code is as follows:
void ConfigTimerBCompare (void)
{
P4SEL |= 0x20; // P4.5 - Select as TB5 functionality
P4DIR |= 0x20; // P4.5 - Select compare as output
TBCTL = MC_0 | TBCLR; // Stop Timer
TBCCTL5 = 0x00; // CAP = 0 - Compare mode
TBCCR0 = (1024 - 1); // PWM Period/2
TBCCTL5 = OUTMOD_7; // CCR5 Set/Reset
TBCCR5 = 0x00; // CCR5 PWM duty cycle
TBCTL = CNTL_0; // 16 bit format
TBCCR5 = 38; //Initial duty cycle
TBCCTL5 = CCIE; // CCR5 interrupt enabled
TBCTL = TBSSEL_1 | ID_2 | MC_3; // Clock source=ACLK, Divide by 4, Start timer in up-down mode
}
The ISR for TimerB is as:
void ISR_TimerB (void) INTERRUPT[TIMERB1_VECTOR]
{
P1OUT ^= BIT0; // Toggle P1.0 using XOR for testing
TBCCR5 = g_DACCount; //main loop updates the DAC count
TBCCTL5 = CCIE; // CCR5 interrupt enabled
}
The ISR works fine as I have added a port pin toggle code for testing but no output is seen on P4.5/TB5. Please clarify the problem in code.
Thanks in advance.