Hi,
This is a basic doubt about TIMERA0_VECTOR. When does to control enter the TIMERA0_VECTOR. Is it when the CCIFG is set or when the TAIFG is set? Or is there any other way where one can define which of them to be used to execute TIMERA0 ISR.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
This is a basic doubt about TIMERA0_VECTOR. When does to control enter the TIMERA0_VECTOR. Is it when the CCIFG is set or when the TAIFG is set? Or is there any other way where one can define which of them to be used to execute TIMERA0 ISR.
#include "msp430f2491.h"
void main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
P1DIR = 0x00;
P1SEL = BIT1;
P1IE = BIT7;
P1IES = BIT7;
P4DIR = 0xFF;
P4SEL = 0x00;
P4OUT = 0X00;
// Capture either edge of CCI0B , synchronized , interrupts enabled
TACCTL0 = CM_3 | CCIS_1 | SCS | CAP | CCIE;
// Start timer: ACLK , no prescale , continuous mode , no ints , clear
TACTL = TASSEL_1 | ID_0 | MC_2 | TACLR;
__enable_interrupt();
__bis_SR_register(LPM0 + GIE);
for (;;) { // Loop forever with interrupts
__low_power_mode_3 (); // Only ACLK continues to run
}
}
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void)
{
P4OUT = 0X0F; // just to avoid confusion because of the ISR turn on the lower nibble led's
//static unsigned int lastvalue =0;
// P4OUT = lastvalue++;
}
#pragma vector = PORT1_VECTOR
__interrupt void PORT1_VECTOR_ISR()
{
P4OUT ^=(7<<0) ;
P1IFG = 0X00;
}
In the above program , actually I want to use CCIFG0 from the main function for generating the interrupt on capture. I am using a switch at TA0 (P1.1) and linking it with CCI0B at TACCTL0. The port 1 interrupt is working (when I press the switch P1.7 the led's at port 4 glows) in the above program but the timerA0_interrupt ISR is not being executed when I press the switch. Please let me know if anything is wrong in the code.
Bhanu Prakash said:And in this program it seems the TAIFG by an overflow is generating TIMERA0_VECTOR . Can anyone tell me the difference please....
That example triggers TIMERA0_VECTOR when the CCIFG bit of TACCTL0 is set (same as the previous example). You can tell by the fact that CCIE in TACCTL0 is set, whereas the TAIE bit of TACTL is not set.
Also, if TAIE was set the MCU would try to execute the TIMERA1_VECTOR, not the TIMERA0_VECTOR. That would be bad news as no ISR is defined for TIMERA1_VECTOR. As Leo already said in his answer, TIMERA0_VECTOR is only triggered by CCIFG being set in TACCTL0. All other interrupt flags for that timer module trigger TIMERA1_VECTOR instead.
**Attention** This is a public forum