ฝากรูป
/******************************************************************************/
/**** LPC2368 GPIO-0 Interrupt example by Musaho ****/
/******************************************************************************/
void Sensing_irq(void) __irq;
int main(void){
PINSEL1 = (3UL<<16);
//xxxx xxxx xxxx xx00 xxxx xxxx xxxx xxxx ,select to GPIO port P0.24
PINMODE1 = ~(3UL<<16);
// Resistor is pull up.
PCLKSEL1 = ~(3UL<<2);
//PCLK_GPIO=CCLK/4
FIO0DIR = ~(1UL<<24);
// Bit-24 is set to input.
IO0_INT_EN_F = (1UL<<24);
//bit-24 are set up for the Falling edge interrupt.
VICVectAddr17 = (unsigned)Sensing_irq;
VICVectPriority17 = 0x00000000;
//IENT3
VICIntEnable |= (1UL<<17);
// select IENT3 interrupt
while(1);
}
void Sensing_irq(void) __irq //Sensing interrupt P0.24
{
/****************************************************************/
/* Your Interrupt program is here */
/****************************************************************/
IO0_INT_CLR = (1UL<<24);
//clear the GPIO-0, P0.24 interrupt flag
VICVectAddr = 0x00000000;
// *Dummy Write to signal end of Interrupt.
return;
}