Hello,
I have a problem with Timer1 on MSP430F2122 - it doesn't start. I have no idea where is the bug. I wrote simple example to check it, but still nothing. Code below. I am using IAR 4.11.
#include "msp430x21x2.h"
unsigned char mark = 0;
void main(void)
{
P1SEL = 0x00; // I/O Config
P2SEL = 0x00; // I/O Config
P3SEL = 0x00; // I/O Config
P1DIR |= 0xFF; // All pins outputs
P2DIR |= 0xFF; // All pins outputs
P3DIR |= 0xFF; // All pins outputs
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1OUT |= 0xFF; // All pins high
P2OUT |= 0xFF; // All pins high
P3OUT |= 0xFF; // All pins high
TA1CCR0 = 0x00CD; // interrupt every 50ms
TA1CTL = TASSEL_1 + ID_3 + TAIE + MC_1; // UPmode, div=8, timer int en, 32768Hz
_BIS_SR(GIE); // Enable interrupts
while(1)
{
if (mark) {P2OUT ^= BIT6; mark =0;}
} // end of while loop
} // end of main loop
#pragma vector=TIMER1_A1_VECTOR
__interrupt void Timer_A1 (void)
{
TA1CTL &= ~TAIFG; // Clear timer interrupt flag
P1OUT ^= BIT7;
mark = 1;
}