HI
I am using MSP430f149 for a frequency measurement application. I am using XT2 (8Mhz) crystal no XT1 crystal. I am configured timer A for interrupt for generating a square wave but no interrupt is generated. This is my program listing for square wave generation But no outputs on P4 port. I do know whether i configured the crystal and timer correctly. Any suggestions..
#include <msp430x14x.h>
#include <signal.h>
#include <io.h>
int i = 0;
int x;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog
P4DIR |= 0xff;
BCSCTL1 &= ~XT2OFF; // XT2= HF XTAL switch master clock to XT2IN
do
{
IFG1 &= ~OFIFG; // Clear OSCFault flag
for ( x = 0xFF; x > 0; x--); // Time for flag to set
}
while ((IFG1 & OFIFG)); // OSCFault flag still set?
BCSCTL2 |= SELM_2+SELS; // MCLK= XT2 (safe) & SMCLK = XT2 as well
TACTL = TASSEL_2+TACLR+MC_2+TBIE; // Timer init using SMCLK, Clear counter and set timer to continous mode
TACCR0 = 0x07ff;
TACCTL0 = CCIE; // Enables CCR
for(;;)
{
_BIS_SR(LPM0_bits + GIE); // Enter LPM0 w/interrupt so CPU sleep and wait till 1s
}
}
interrupt (TIMERA0_VECTOR) ISRTimerA0 (void)
{
P4OUT ^= 0xff; // Toggle P4.0
LPM0_EXIT;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Thanks you
arungk