Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
External Interrupt Example2 for megaRF STK600 Documentation

Introduction

This simple example shows how to use the External Interrupt Driver for nested external interrupt

Main files:

Interrupt Driver

The interrupt driver can be found here.

Device Info

AVR MEGARF device can be used.

Setup

External interrupt INT0 pin is enabled and user defined another external interrupt source(example INT1) is also enabled.SW1 and SW2 are the switches connected to the interrupt pins

Description of the example

switch SW1 is pressed, due to pull-up the interrupt INT0 will be triggered only when SW1 is released and LED1 blinks for some time. During the time while LED1 is glowing, a switch action on another SW2 will trigger INT1 and hence the LED2 blinks for a moment and goes off. This is because, inside the ISR of INT0, the I-bit is set so that all other interrupts are activated. So even when the CPU is inside the INT0 routine it senses the interrupt INT1 and jumps to the ISR of INT1 and executes the routine and then jumps back to ISR of INT0.

Compilation Info

This software was written for the GNU GCC and IAR for AVR. Other compilers may or may not work.

Contact Information

For further information, visit Microchip.