Embedded Systems Lab 18ECL66: Demonstrate The Use of An External Interrupt To Toggle An LED On/Off

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

EMBEDDED SYSTEMS LAB

18ECL66
PART B
Title
Demonstrate the use of an external interrupt to toggle an LED On/Off

Mr. Aravind R
Assistant Professor
Dept. of ECE
GSSSIETW, Mysuru
Aim: To toggle an LED through the external interrupt in ARM Cortex M3
Microcontroller (LPC 1768).

Objectives:
• To configure & use LPC 1768 eternal interrupt EINT3.
• To interface LED & control it through interrupt.
Introduction:
• An interrupt is an event that alters the sequence in which the
processor executes instructions.
• Types:
• Internal Interrupts- are triggered by a software instruction and operate
similarly to a jump or branch instruction
• External Interrupts- is caused by an external hardware module.

LPC1768 has 4 external interrupt pins EINT0/1/2/3.

In this experiment, EINT3 is configured to toggle LED on/off.


Block diagram:
ARM Cortex M3 Evaluation Board

External interrupt module


LPC 1768
 
Switch LED

Circuit Diagram:

LPC1768

P2.13

P2.12
Algorithm:

• Identify the port address of External interrupt (EINT3) from the schematic diagram.

• Configure the pins P2.13 to function as external interrupts in PINSEL register.

• Clear previous interrupts if any in EINT3.

• Configure the EINT3 as Edge/level triggered in EXTMODE register.

• Select the polarity (falling/rising edge, Active low/high) of interrupt in EXPOLAR


register.

• Enable the interrupts by calling NVIC_EnableIRQ() with IRQ number.


31 30 29 28 2726 25 24 23 22 2120 19 18 17 16 15 14 13 12 11 10 8 9 7654 3210

0 1 0 0 =4

PINSEL4 = 0X04000000

this value id used to configure PINSEL4 register to


operate as External Interrupt.
External Interrupt Flag Register - EXTINT
31 30 29 28 2726 25 24 23 22 2120 19 18 17 16 15 14 13 12 11 10 8 9 7654 3210

1000 =8

Therefore

EXTINT = 0X00000008
External Interrupt Mode Register - EXTMODE

31 30 29 28 2726 25 24 23 22 2120 19 18 17 16 15 14 13 12 11 10 8 9 7654 3210

Therefore 1000 =8

EXTMODE = 0X00000008
External Interrupt Polarity Register - EXTPOLAR
31 30 29 28 2726 25 24 23 22 2120 19 18 17 16 15 14 13 12 11 10 8 9 7654 3210

0000 =0

Therefore

EXTPOLAR = 0X00000000
PINSEL4 = 0X04000000
EXTINT = 0X00000008
EXTMODE = 0X00000008
EXTPOLAR = 0X00000000

P2.12 – For LED- bit 25 & 24 made 0


PINSEL4 = 0xFCFFFFFF
Result and Discussion:
• LED interfacing is successful and controlled (ON /OFF) through the
switch button action that act as external interrupt.
 
Conclusion:
• External interrupt program is compiled and hex file created
successfully in Keil microvision 4 software.
• Hex file is dumped to ARM Cortex M3 (LPC 1768) evaluation board
using Flash magic.
• Successfully toggled LED through external interrupt.
Thank You

You might also like