Button Interrupt + Low-Power Mode
Configures P1.1 as input with pull-up and falling-edge interrupt, then puts the CPU to sleep in LPM4 with GIE set. Each button press is a falling edge: the ISR wakes the CPU, toggles the LED on P1.0, clears P1IFG and returns to sleep.
What to watch as you step
- P1REN=1 with P1OUT=1 selects the internal pull-up: the pin idles at 1, pressed reads 0
- P1IES=1 makes the interrupt fire on the falling edge (the press, not the release)
- bis #GIE+LPM4, sr enables interrupts and stops the CPU in a single instruction
- The ISR must clear P1IFG; otherwise the interrupt would re-fire forever