I am confused with the Timer_ISR representation.The below two are the examples of cc430f5137 included int he TI_explorer
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0x01; // P1.0 output
TA1CCTL0 = CCIE; // CCR0 interrupt enabled
TA1CCR0 = 50000;
TA1CTL = TASSEL_2 + MC_1 + TACLR; // SMCLK, upmode, clear TAR
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, enable interrupts
__no_operation(); // For debugger
}
// Timer A0 interrupt service routine
#pragma vector=TIMER1_A0_VECTOR
__interrupt void TIMER1_A0_ISR(void)
{
P1OUT ^= 0x01; // Toggle P1.0
}
In the above what does this line represent or used for TIMER1_A0. for what Timer1 is used and A0 is used.
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= 0x01; // P1.0 output
TA1CTL = TASSEL_2 + MC_2 + TACLR + TAIE; // SMCLK, contmode, clear TAR
// enable interrupt
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, enable interrupts
__no_operation(); // For debugger
}
// Timer_A3 Interrupt Vector (TAIV) handler
#pragma vector=TIMER1_A1_VECTOR
__interrupt void TIMER1_A1_ISR(void)
{
switch(__even_in_range(TA1IV,14))
{
case 0: break; // No interrupt
case 2: break; // CCR1 not used
case 4: break; // CCR2 not used
case 6: break; // reserved
case 8: break; // reserved
case 10: break; // reserved
case 12: break; // reserved
case 14: P1OUT ^= 0x01; // overflow
break;
default: break;
}
}
Here the what does thes lines represents or denotes.what is the use of them
1)Timer_A3 Interrupt Vector (TAIV) handler
2)TIMER1_A1_
As I am not sure of what will be correct to use instead of my timer_ISR lines shown below for my reuired code
1) #pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR(void)
2)#pragma vector=TIMER0_A0_VECTOR
__interrupt void Port_3(void)// P3SEL |= BIT2;
#include <msp430.h>
volatile int ccr_current=0,ccr_previous=0,y=0,freq1[3],freq=0,freq_needed=0;
//Timer Interrupt
#pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR(void)
{
//__bic_SR_register_on_exit(CPUOFF);//wakes up CPU from OFF
}
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Port_3(void)// P3SEL |= BIT2;
{
unsigned int ccr_current;
ccr_current = TA0CCR1;
if(ccr_current < ccr_previous) {
freq = 32768 / (ccr_current + 65536 - ccr_previous);
} else {
freq = 32768 / (ccr_current - ccr_previous);
}
ccr_previous = ccr_current;
y=y+1;
freq1[y]=freq;
//__bic_SR_register_on_exit(CPUOFF);//wakes up CPU from OFF
}
int main(void)
{
WDTCTL = WDTPW | WDTHOLD;
//TA0CCR0: Reference clock
TA0CTL = TASSEL_1;
TA0CCTL0 = CCIE; // interrupt enabled
TA0CCR0=32768;
TA0CTL |= MC_1;// set timer in up mode
TA0CTL |= MC0; // start timer
//TA0CCR1: It will read the input pulse signal
P3SEL |= BIT2; //it is connected to TA0CCR1A
TA0CCTL1|=CAP; //for capture mode
TA0CCTL1|=CM_1; //capture on rising edge
while(1)
{
if(y==2) //calculate freq if two rising edges were captured
{
freq_needed=freq1[1]+freq1[2];
//transmit freq_needed through UART to the terminal
y=0;
}
__bis_SR_register(CPUOFF + GIE);//makes CPU OFF and enables interrupts
}
}
can some one explain about the things.
Thanks.