krb686
krb686

Reputation: 1806

MSP430 - Assembly ISR doesn't get run

Trying to write an ISR in assembly for when a button gets pressed on my MSP430. I've followed some instructions around the web, but I'm having trouble "linking" the ISR to the button press.

Specifically, I'm trying to get a button attached to port P1.1 to run my ISR.

Steps I've done

1) Enable the interrupt for P1.1 P1IE |= BIT1;

2) Selected H->L transition: P1IES |= BIT1;

3) Cleared flag register: P1IFG &= ~BIT1;

4) Enabled global interrupts: __enable_interrupt();

Still though, I think I'm missing something. I don't understand how to tell the program to run my ISR, and unfortunately I have not found any guidelines on the web that are very clear about this part. Here is my ISR in assembly:

    .cdecls C,LIST,"msp430.h"
    .sect ".text:_isr"

buttonISR:      push R4
                mov.w #1000, R4
loop:           dec.w R4
                jnz loop
                reti


    .sect BUTTON_ISR
    .word buttonISR
    .end

Upvotes: 0

Views: 1384

Answers (1)

krb686
krb686

Reputation: 1806

Okay I figured it out. Apparently the interrupt vector table is a hard-coded memory space. From the datasheet, I found that the interrupt vector for port 1 was 0xFFDE, which translates to INT47, thus I changed the bottom part of my assembly program to:

.sect ".int47"
.word buttonISR
.end

And now it works beautifully!

Upvotes: 1

Related Questions