View Single Post
  #12   Spotlight this post!  
Unread 28-09-2003, 22:09
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Interrupts are used when input signals can change state at random times, and you have to respond to that signal immediately.

a so so example is the keyboard on your PC. The processor has no way to anticipate when you will push a key, so that would be an interrupt

whenever you hit one, the code would stop whatever it was doing, go see what key you pressed, put that in a que or buffer somewhere, then go back to its regularly scheduled program

(thats not a really good example because the speed at which we type is extreemly slow to a processor, so it has plenty of time to go see what key you pressed, but you get the general idea)

on a bot something like a shaft encoder that puts out a pulse on each revolution - that could be an interrupt

or important things that need immediate attention, like a kill switch.

But if you want to know what an interrupt REALLY is

back when I was in engineering school, if you were walking down the hall talking to a friend and a girl walked by, that was an interrupt (we would stop talking for a second to activate the track and scan function)

and when she was gone you execute the return-from-interrupt instruction

(ah, those were the days! )