Difference between revisions of "Exercise - Using Interrupts"

From Flowcode Help
Jump to navigationJump to search
Line 2: Line 2:
  
 
Interrupt are a way of grabbing the microcontroller's attention immediately.
 
Interrupt are a way of grabbing the microcontroller's attention immediately.
It is often connected to a large number of peripheral input devices - switches, sensors, memory, timers etc. There are two broad ways in which one of these devices can be serviced by the microcontroller.
+
It is often connected to a large number of peripheral input devices - switches, sensors, memory, timers etc. There are two broad ways in which one of these devices can be serviced by the microcontroller:
 +
 
 
One of these is 'polling' - each device is 'asked' in turn if it has data to transfer to the controller.
 
One of these is 'polling' - each device is 'asked' in turn if it has data to transfer to the controller.
 
The second is to allow the device to interrupt the task being carried out by the controller.
 
The second is to allow the device to interrupt the task being carried out by the controller.

Revision as of 15:21, 11 August 2013

<sidebar>Sidebar: What Is an Interrupt?</sidebar>

Interrupt are a way of grabbing the microcontroller's attention immediately. It is often connected to a large number of peripheral input devices - switches, sensors, memory, timers etc. There are two broad ways in which one of these devices can be serviced by the microcontroller:

One of these is 'polling' - each device is 'asked' in turn if it has data to transfer to the controller. The second is to allow the device to interrupt the task being carried out by the controller.

They are very widely used, both in microcontrollers and microprocessors. For example, the keyboard and mouse in your computer probably use interrupts to talk to the CPU.

Interrupts can also be used to save energy. In many battery-powered applications, the microcontroller is 'put to sleep' when inactive, and so requires little energy. An interrupt is used to 'awaken' the controller, and bring it back into operation, when needed.