View Single Post
  #1   Spotlight this post!  
Unread 22-02-2004, 10:27
DanL DanL is offline
Crusty Mentor
FRC #0097
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Somerville, MA
Posts: 682
DanL is just really niceDanL is just really niceDanL is just really niceDanL is just really niceDanL is just really nice
Send a message via AIM to DanL
Re: Need interupts help, and another question...

If you're having problems with interrupts, Daniel Katanski of team 240 wrote an amazingly helpful whitepaper on the topic - I recommend you read the whole thing, as not only it explains in details how to use interrupts and timers, but it also gives some neat programming tricks here and there. I just began using interrupts the other day (after sitting down for a day with that whitepaper and pouring through each line of the default code), so I think other people on this board are going to be more helpful than me in terms of debugging. However, I do want to include this part from the whitepaper:

Quote:
When initializing a digital input interrupt there are 5 things that must be done, they are:
1. Set the port to be an input (as shown in the code above).
2. Set the interrupt on the pin to be a low priority interrupt.
3. Set the edge select (rising from 1 to 0, or falling 0 to 1, remember bit values versus voltages).
4. Clear the interrupt flag.
5. Enable interrupts.
I printed out a copy of that and taped it to the computer monitor. During my debugging stage, I kept on referring back to there to see what I was forgetting - as a beginer, I found that probably the most important part of the entire whitepaper. I would also add "Make sure you call ALL of the necessary initialization functions," but you said you already are doing that.

Although it'll take quite a bit of work to incorporate into your code if you built something off the default IFI code, something that you might also wish to check out is Kevin's heavily annotated interrupt and timer template code. Kevin - you did a great job with your comments on that one - they helped me a lot.
__________________
Dan L
Team 97 Mentor
Software Engineer, Vecna Technologies

Last edited by DanL : 22-02-2004 at 10:31.