I have a question about TAR (Timer_A counter) values.
Attached at the bottom is my sample code. I used MSP430F1232 and Iar EW IDE.
When I stop with breakpoints at "case 10:" sentence and see the TAR values multiple times,
I obtain TAR values like "4354, 10969, 51058". They looks some random values.
On the other hand, when I stop with breakpoints at "if(cnt > 7) { _NOP() }", I see the
{1, 1, 1, 1, 1, 0, 0 ....} in the array tar[ ]. They seems correct (meaning set zero by overflow).
I use ACLK (external crystal of 32768Hz) as a clock source. When I use external crystal,
is it correct that the TAR countup is not stopped while I stop the software with breakpoints
causing the difference shown above?
I have been using MSP430 for over 1 years now, but did not notice this kind of feature.
=====================
#include <msp430x12x2.h>
unsigned int tar[10];
int cnt = 0;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
P1DIR |= 0x01;
TACTL = TASSEL_1 + MC_2 + TAIE;
_BIS_SR(LPM3_bits + GIE); // Enter LPM3 w/ interrupt
}
#pragma vector=TIMERA1_VECTOR
__interrupt void Timer_A(void)
{
switch( TAIV )
{
case 2: break;
case 4: break;
case 10: P1OUT ^= 0x01;
tar[cnt++] = TAR;
if(cnt > 7) {
_NOP();
}
_NOP();
break;
}
}