Line 16: Line 16:
 
==General Interrupt Flag Register(GIFR)==
 
==General Interrupt Flag Register(GIFR)==
 
==MCU Control Register (MCUCR)==  
 
==MCU Control Register (MCUCR)==  
{| class="table table-bordered"
+
{| class="table table-condensed table-bordered"
 
|-
 
|-
! Header text !! Header text
+
! 7!!6!!5!!4!!3!!2!!1!!0
 
|-class="success"
 
|-class="success"
| Example || Example
+
| SE||SM2|| SM1|| SM0||'''ISC11'''||'''ISC10'''|| '''ISC01'''||'''ISC00'''
 +
|}
 +
 
 +
 
 +
{| class="table table-condensed table-bordered"
 +
|-
 +
!ISC01!!ISC00!!Description
 +
|-
 +
|0||0||The low level of INT0 generates an interrupt request.
 +
|-
 +
|0||1|| Any logical change on INT0 generates an interrupt request.
 +
|-class="success"
 +
|1|| 0|| The falling edge of INT0 generates an interrupt request.
 
|-
 
|-
| Example || Example
+
|1||1||The rising edge of INT0 generates an interrupt request.
 
|}
 
|}
 +
  
 
We will connect two switches to the two interrupt pins and show the status on a LCD. The connections are shown in the image below.
 
We will connect two switches to the two interrupt pins and show the status on a LCD. The connections are shown in the image below.

Revision as of 15:28, 19 March 2016

We have looked at the basics of AVR Interrupts, now let us go ahead and use the External Interrupts feature on the AVR MCUs.

Steps to configure the Interrupts:


The Registers

General Interrupt Control Register (GICR)

7 6 5 4 3 2 1 0
INT1 INT0 INT2 - - - IVSEL IVCE

General Interrupt Flag Register(GIFR)

MCU Control Register (MCUCR)

7 6 5 4 3 2 1 0
SE SM2 SM1 SM0 ISC11 ISC10 ISC01 ISC00


ISC01 ISC00 Description
0 0 The low level of INT0 generates an interrupt request.
0 1 Any logical change on INT0 generates an interrupt request.
1 0 The falling edge of INT0 generates an interrupt request.
1 1 The rising edge of INT0 generates an interrupt request.


We will connect two switches to the two interrupt pins and show the status on a LCD. The connections are shown in the image below.

Hook Up

The Code

Downloads