Created
February 4, 2013 16:17
-
-
Save rclabs/4707744 to your computer and use it in GitHub Desktop.
msp430 i/o and interrupts: led state track button press on launchpad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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