Interrupts are not unique to C. I’ll do my best to put my 2 cent explanation. Interrupts are really a capability of microprocessor and not a language construct. They are not like pointers or other “C” things.
The PICs in the new RCs allow interrupts, which is to say that the new processors support interrupts.
So, what is an interrupt?
A typical microprocessor crunkes and chugs away on a piece of code in a sequential manner. Step 1, 2, 3,…,N on and on dilengently following the sequence of N steps that a programmer has laid out.
This straightforward execution model works fine in a very simple environment. However, let’s say you are running a program on a computer with a mouse. An N-step program is running and suddenly the user clicks the mouse at Step 3 of the sequence. The user has to wait until the end of the Nth step before his mouse click is processed by the computer if the processor doesn’t have interrupts.
Now, fortunately, most modern computers use interrupt processors. So, the mouse click intiates and interrupt. The processor stops at Step 3 temporarily stores is “state” in a temporary array. The processor jumps to a section of code to handle the “mouse interrupt”. When its done, the processor reloads state and continues with Step 3 of ther original program.
So, interrupts are exactly that. When you program an interrupt, the processor halts it’s current execution whenever the interrupt becomes true. Usually an interrupt is a high or low bit on a particular pin of the processor.
Now, where might you wanna use interrupts with FIRST robotics? One idea might be if you have a “bummer switch” that tells you when your robot hits a wall. You could tie this switch to one of the interrupts. When you bump into something, the processor could then run a special “I’ve bummped into the wall” piece of code.
That seems like a lot of trouble, right? Why not just check the switch at the top of the normal 17ms control loop? Well, in the case of the “bummer switch” an interrupt may not be necessary, but it illustrates the idea.
Interrupts are very important to real-time programming when waiting 17 ms to respond to an event may be an eternity. This capability is especially true for autonomous mode operations.
I hope this explanation is helpful. Maybe some computer science folks can correct/elaborate furhter.