Line 6: Line 6:
  
 
=The Registers=
 
=The Registers=
==General Interrupt Control Register (GICR)==
+
'''General Interrupt Control Register (GICR)'''
 
{| class="table table-condensed table-bordered"
 
{| class="table table-condensed table-bordered"
 
|-
 
|-
Line 14: Line 14:
 
|}
 
|}
  
==General Interrupt Flag Register(GIFR)==
+
'''MCU Control Register (MCUCR)'''
==MCU Control Register (MCUCR)==
+
 
{| class="table table-condensed table-bordered"
 
{| class="table table-condensed table-bordered"
 
|-
 
|-
Line 22: Line 21:
 
| SE||SM2|| SM1|| SM0||'''ISC11'''||'''ISC10'''|| '''ISC01'''||'''ISC00'''
 
| SE||SM2|| SM1|| SM0||'''ISC11'''||'''ISC10'''|| '''ISC01'''||'''ISC00'''
 
|}
 
|}
 
  
 
{| class="table table-condensed table-bordered"
 
{| class="table table-condensed table-bordered"
Line 36: Line 34:
 
|1||1||The rising edge of INT0 generates an interrupt request.
 
|1||1||The rising edge of INT0 generates an interrupt request.
 
|}
 
|}
 +
 +
'''General Interrupt Flag Register(GIFR)
 +
'''
 +
{| class="table table-condensed table-bordered"
 +
|-
 +
! 7!!6!!5!!4!!3!!2!!1!!0
 +
|-class="success"
 +
| '''INTF1'''||'''INTF0'''|| '''INTF2'''|| -|| -|| -|| -|| -
 +
|}
 +
  
  

Revision as of 15:35, 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

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.

General Interrupt Flag Register(GIFR)

7 6 5 4 3 2 1 0
INTF1 INTF0 INTF2 - - - - -


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