External Interrupts
External Interrupts
Performs
ISR
HOLD
I need Service
EINT0
EINT1
Normal
EINT2 LPC 1768
Operation
EINT3
Performs
ISR
Completed
RESUME
EINT0
EINT1 Performs Normal
EINT2 LPC 1768
Operation
EINT3
External Port Pin Functions Associated PINSEL Register
Interrupt Pin
EINT0 P2.10 0-GPIO, 1-EINT0, 2-NMI 20,21 bits of PINSEL4
EINT1 P2.11 0-GPIO, 1-EINT1, 2-I2STX_CLK 22,23 bits of PINSEL4
EINT2 P2.12 0-GPIO, 1-EINT2, 2-I2STX_WS 24,25 bits of PINSEL4
EINT3 P2.13 0-GPIO, 1-EINT3, 2-I2STX SDA 26,27 bits of PINSEL4
EINT Registers
Register Description
PINSELx To configure the pins as External Interrupts
EXTINT External Interrupt Flag Register contains interrupt flags for EINT0,EINT1,
EINT2 & EINT3.
EXTMODE External Interrupt Mode register(Level/Edge Triggered)
EXTPOLAR External Interrupt Polarity(Falling/Rising Edge, Active Low/High)
EXTINT
Bits 31:4 Bit 3 Bit 2 Bit 1 Bit 0
RESERVED EINT3 EINT2 EINT1 EINT0
EINTx:
• Bits will be set whenever the interrupt is detected on the particular
interrupt pin.
• If the interrupts are enabled then the control goes to ISR.
• Writing one to specific bit will clear the corresponding interrupt.
EXTMODE
Bits 31:4 Bit 3 Bit 2 Bit 1 Bit 0
RESERVED EXTMODE3 EXTMODE2 EXTMODE1 EXTMODE0
EXTMODEx:
• This bits is used to select whether the EINTx pin is level or edge
Triggered
• 0: EINTx is Level Triggered.
• 1: EINTx is Edge Triggered.
EXTPOLAR
Bits 31:4 Bit 3 Bit 2 Bit 1 Bit 0
RESERVED EXTPOLAR3 EXTPOLAR2 EXTPOLAR1 EXTPOLAR0
EXTPOLARx:
• This bits is used to select polarity (LOW/HIGH, FALLING/RISING) of the
EINTx interrupt depending on the EXTMODE register.
• 0: EINTx is Active Low or Falling Edge (depending on EXTMODEx).
• 1: EINTx is Active High or Rising Edge (depending on EXTMODEx).
Steps to Configure Interrupts
1. Configure the pins as external interrupts in PINSELx register.
2. Clear any pending interrupts in EXTINT.
3. Configure the EINTx as Edge/Level triggered in EXTMODE register.
4. Select the polarity (Falling/Rising Edge, Active Low/High) of the
interrupt in EXTPOLAR register.
5. Finally enable the interrupts by calling NVIC_EnableIRQ() with IRQ number.