Interrupt question

searched saw the white papers on interrupts for dummies, yet i still dont quite understand how to implement them. so far i have downloaded the kevin frc code for interrupts and transfered my code into the program. our banner sensors are hooked up to rc_dig_in01 02 and 03. is that all i need to do or am i missing something?

Disclaimer: I’ve never actually gotten them working, so you might not want to trust me… :wink:

Two things which you have to do with Kevin’s code to make it actually do something:

  • Put some implementation in the interrupt handler (in user_routines_fast.c). Actually, Kevin has been extremely helpful by having a function call for each interrupt in there already. Just go into interrupts.c and find the appropriate handler for the one you want. (Read the comments if it is unclear. He does and excellent job with those. :D)
  • Turn them on! This is actually two things, (1) make sure you call the interrupt initializers you want in user_initialization (in user_routines.c) and (2) actually enable the interrupt in the initializing function. Read the comments at the bottom of the initializing routine to see how.

Kashi,

Have you tried reading this? It gives side by side examples on how to implement something (in this case, a timer) both with and without interrupts.

Please give it a try and repost here if you are still confused.

Mike