3.2 Interrupt on Pin Change

In main() code, ei() enables global interrupts.

__interrupt(vector) specifies btnInt() as the interrupt function. Port interrupt vectors are of the form PORTx_Port_vect_num (see iom4809.h.) To ensure only the PF6 change triggers an interrupt, the interrupt flag is checked. Then the LED is toggled, and the interrupt flag is cleared. Writing a '1' to a flag's bit location will clear the flag.