hii,
i have used msp430f5335 with 4 mhz external oscillator using timer B. i am getting pwm but not worth of correct frequency. it is always showing (10^3) less than actual value(using tektronix tds 2024c dso )
for ex :
i wanted to get 5*(10^5) hz , but it is showing 5*(10^2) hz
i have written like this
#include "declare.h"
void gen_pwm()
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= BIT0;
P4DIR |= BIT1;
P4SEL |= BIT1 ;
InitClocks();
TB0CTL =TBSSEL_1+ MC_1 +ID_3 ;
TB0EX0 =TBIDEX_7;
// TB0CTL |=TBCLR;
TB0CCR0 =1000;
TB0CCTL1 = OUTMOD_7;
TB0CCR1 = 250;
TB0CTL |=TBCLR;
while(1);
}
i have written different function for clock generation. clock is working fine.