Saturday, July 29, 2006

Button Interrupts

I'm going to use the same button macro code I used in the polling example to take a pin 1 low representing the button press. I can connect that pin to external interrupt 0 using the following statement:

// Tell the Pin Function Select Register
// that EINT0 is on pin 1
PINSEL0 = PINSEL0 | (3 << 2);

If you put this code in the previous main before the while loop and then single step you can see Pin 1 in the Pin Connect Block being changed from GPIO Port 0.1 to EINT0.

0 Comments:

Post a Comment

<< Home