View Single Post
  #5   Spotlight this post!  
Unread 11-01-2004, 22:27
Jay Lundy Jay Lundy is offline
Programmer/Driver 2001-2004
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Berkeley, CA
Posts: 320
Jay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to all
Re: When would I use an interrupt?

When you have something like a button you probably won't need to use an interrupt. Well it actually depends on how often the button is checked in normal operation. If the button is checked at 40 Hz (loop time for the FIRST default code, based on the radio baud rate), then you won't need an interrupt (in fact an interrupt might make it harder to deal with because you have to worry about key bounce).

But if you have some critical sensor that updates at 10 kHz and you want to catch every update with a polling frequency of 40 Hz, you would need an interrupt.

No matter where the code is, as soon as an interrupt happens it jumps to the appropriate memory location (depending on whether it's high priority or low priority). The only exception is if another interrupt of equal or higher priority is currently being processed.