I'm using an interrupt to wake the microcontroller once the value has been reached. I see that in the Capture/Compare Control Register there is a Capture Overflow bit. I can't seem to find an example of checking for this bit once the value has been reached. One example interrupt looked like:
#pragma vector = TIMERA0_VECTOR
__interrupt void CCR0_ISR(void) {
if (++i == 120) {
P1OUT ^= RLY1;
i=0;
}
} // CCR0_ISR
But this doesn't check the value of the bit. So how do i check to see if the timer has overflowed?
Best Answer
Not sure exactly which series MSP you're using so you'll have to look up the specifics. But the basic premise should apply across the board I think.
The following example is from the file
msp430g2xx1_ta_03.c
in the code snippets that can be downloaded from the TI Wiki:The key is checking the
TAIV
register to see what caused the interrupt. Take a look at page 416 of the CC430 Family User's Guide:Now the code example is looking for a value of
10
in theTAIV
register and the User Guide indicates that0x0E
is the overflow. So, again, check your specific chip's documentation. But theTAIV
register is what will tell you what the cause of the interrupt is.