Skip to content

Instantly share code, notes, and snippets.

@rclabs
Created February 4, 2013 16:17
Show Gist options
  • Save rclabs/4707744 to your computer and use it in GitHub Desktop.
Save rclabs/4707744 to your computer and use it in GitHub Desktop.
msp430 i/o and interrupts: led state track button press on launchpad
#include <msp430.h>
#define interrupt(x) void __attribute__((interrupt (x)))
interrupt(PORT1_VECTOR) isr() {
P1OUT ^= BIT6 | BIT0; // toggle
P1IES ^= BIT3; // change edge
P1IFG = 0x00;
}
int main() {
WDTCTL = WDTPW + WDTHOLD;
P1DIR = BIT6 | BIT0;
P1OUT = BIT3;
P1REN = BIT3;
P1IES = BIT3;
P1IE = BIT3; // PIN1.3
P1IFG = 0x00;
__enable_interrupt();
for (;;) {}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment