External Interrupt in ARM MBED LPC1768 - MBED
External Interrupt in ARM MBED LPC1768 - MBED
Introduction
An interrupt is an event that occurs randomly in the flow of continuity. It is just like a call you have when you are busy with some
work and depending upon call priority you decide whether to attend or neglect it.
ARM MBED has interrupt feature on its GPIO pins. In ARM MBED board pins 5 to 30 can be used as an interrupt input, excepting
only pins 19 and 20.
We can set rising edge, falling edge, both edges, low level, and high level interrupt modes on GPIO pins of MBED board. It will
generate an interrupt when set event (modes) of interrupt occurs.
InterruptIn(pin)
disable_irq()
Ex.: event.disable_irq();
enable_irq()
Ex.: event.enable_irq();
mode (pull)
read (void)
Return:
Ex.: event.read();
Example
Let’s write a program which will generate an interrupt when rising edge detected on GPIO (here p16) pin. Here, switch input is used
to interrupt MBED. We will print ‘triggered’ on serial window when interrupt occured.
Interfacing Diagram
Program
// Flash an LED while waiting for events
#include "mbed.h"
void trigger() {
int main() {
while(1) {