Interrupt Handling/Control - I2C

Most microcontrollers of the current age have elements called interrupts built into their architecture. These interrupts quite literally interrupt the current code execution, run some other section of code, then return to the original code execution. 


This event could be analogous to a fire alarm in a building. You could be working on your ECE 2564 project when all of the sudden a fire alarm goes off. You have to evacuate your building, wait for the fire department to inspect the building and then give the all clear sign - only then can you re-enter the building and resume work on your ECE 2564 project.

Microcontroller interrupts work the same way! 


For this project, we will be dealing specifically with hardware (or pin-change) interrupts. 

In code, for an interrupt to be acknowledged/executed we need to tell the system “HEY! This code here should ONLY be executed when THIS condition EXCLUSIVELY”. The function for this specific situation is called an Interrupt Handler.


Interrupt Handlers already have a pre-defined name/title which is determined in the DriverLibrary (and consequently the actual hardware memory-mapping itself). We will discuss how to find the Interrupt Handler’s name for I2C in Part 2.