Interrupts with NRF24LE1
In our daily life we get distracted or interrupted by others many times. In that condition we suspend our ongoing work and pay attention to what others have to say. We only resume our previously suspended work after the completion of the interrupted task. The master which controls the processing of thoughts in us is our brain. The brain stops processing ongoing thoughts when we get interrupted and starts processing the other task. It resumes the previous ongoing processing when the task is complete. The controller works in a similar manner. Here, we will study interrupts associated with our NRF.
Fig. 1:Â Prototype of NRF24LE1 Interrupt Demonstration
We all know the task of interrupts in any controller. It tells the microcontroller to suspend its current execution of code, save the current state and process interrupt request. Controller processes interrupt request by jumping to Interrupt Service Routine (ISR) or Interrupt Handler. ISR is a function or procedure defined in the code which gets executed when interrupt occurs. Same is the case with NRF.


Project Source Code
###
//Program to
#include"reg24le1.h" // I/O header file for NRF24LE1#include// header file containing standard I/O functions #include"hal_delay.h" // header file containing delay functions#include"isrdef24le1.h" //header file containing Interrupt Service Routine definition for NRF24LE1Â// main codevoid main(){P0DIR = 0xf0; // make upper 4 bits of Port0 as inputP1DIR = 0; Â // set Port1 as outputP1 = 0x00; // make all pins of Port1 lowIEN0 = 0x81; // enable interrupt from pinINTEXP = 0x08; // enable INT0while(1); // infinite loop, wait for interruptÂ}Â// Interrupt Service RoutineEXT_INT0_ISR(){P1 = 0xff; // make all pins of Port1 highdelay_ms(1000); // delay of 1 secondP1 = 0x00; // make all pins of Port1 Lowdelay_ms(1000); Â // delay of 1 second}###
Â
Circuit Diagrams
Project Video
Filed Under: Tutorials
Filed Under: Tutorials
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.