Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Setting up a Timer1A ISR for MSP-EXP430G2.

$
0
0
Hi,


I recently got a MSP-EXP430G4 launch pad to interface with an RFID DLP-7970ABP booster board.


The booster board comes with code to read RFID tags that I want to transfer into an interrupt so I can switch the board into an LPM mode.


The RFID components are using TIMER0 which I want to avoid messing with to not break the RFID code.

TIMER1 however is just blinking an LED with a CCR [Capture Compare Registers].

The CCR code used to do this shown below

void
McuHeartbeat(void)
{
    TA1CTL |= TACLR;                            // Clear the Timer
    TA1CTL |= TASSEL_1 + TAIE;                    // ACLK, Div 8, Interrupt Enable, Timer Stop

    TA1R = 0x0000;
    TA1CCTL0 |= CCIE;                            // Compare interrupt enable

    TA1CCR0 = 3*500;                            // 500 ms Timer
    TA1CTL |= MC_1;                                // Start counter in up mode
}

#pragma vector=TIMER1_A0_VECTOR
__interrupt void
TimerA1Handler(void)
{
    TA1CTL &= ~(MC0 + MC1);    //stops the counter

    P1OUT ^= BIT0;

    McuHeartbeat();    // Restart the counter
}

I'm trying to setup a new Timer ISR to parse the code, but my configuration doesn't appear to be triggering the new interrupt (only the original Heartbeat configuration) is triggering it.


I also didn't know if I have to use a different interrupt vector when working with CCRs after CCR0.

Any suggestions would be greatly appreciated.

//Setup TIMERA
    //Timer A3 Control
    TA1CTL |= TACLR;                            // Clear the Timer
    TA1CTL |= TASSEL_1 + TAIE;                    // ACLK, Div 8, Interrupt Enable, Timer Stop

    //Setup TIMER Register
    TA1R = 0x0000;

    //Enable CCIFG Interupts
    TA1CCTL0 |= CCIE;
    TA1CCTL1 |= CCIE;

    //Sets the RFID Chip Counter to ping every 2 seconds.
    TA1CCR1 = 3*2000;

    TA1CTL |= MC_1;                                //Start timer in Up Mode

####################################################

// Timer A1 interrupt service routine
#pragma vector=TIMER1_A1_VECTOR
__interrupt void Timer_A(void)
{
    //Stop the counter
    TA1CTL &= ~(MC0 + MC1);


    //Timer Interrupt Handler
    switch(TAIV) {
    case TA1IV_TACCR1:
        Nfc_FindTag();
        McuDelayMillisecond(1000);
        TA1CCR1 = 3*2000;
        break;

    case TA1IV_TACCR2:
        break;

    case TA1IV_TAIFG:
        //Toggle Heartbeat LED
        P1OUT ^= BIT0;
        // Restart the counter
        McuHeartbeat();
        break;

    default:
        break;
    }

    TA1CTL |= MC_1;
}


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>