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
interrupt vector table
, but I'm unsure of how to use it at this point. @wallyk Sorry, that was a typo – krb686P1IV
register). You're mixing old style (.sect
/.word
) and new style (.intvec
) ways of declaring interrupt vectors. You also got the old style wrong, it should be.word buttonISR
. – Ross Ridge.intvec...
because I'm assuming that does the same thing as the.sect/.word
portion – krb686