View Single Post
  #3   Spotlight this post!  
Unread 25-01-2008, 23:43
Jake M Jake M is offline
void* Jake;
FRC #1178 (DURT)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Missouri
Posts: 118
Jake M has a spectacular aura aboutJake M has a spectacular aura about
Re: This darn Gear Tooth Sensor

The core of the interrupts, in IFI's default code is the InterruptHandlerLow() routine, which can be found in user_routines_fast.c. IFI's set things up so that when an interrupt is triggered, that function is automatically called. Within it, IFI setup a skeleton of if statements to demonstrate how to check which interrupt was triggered and how to handle it.

If you can't quite understand their skeleton (which I don't expect you to, don't worry) pull up the PIC Controller Manual (Kevin.org has it) and do a search for all the variables used in the function (such as INTCON3bits.INT2IF). They're actually software registers and the manual describes what they all do and how to use them. They might also be in the manual for the IFI Default Code, but I'm not sure.

Basically, each of the if statements corresponds to a different interrupt. Inside the statement you can either put a small section of your own code to process the interrupt (increment a counter of how many times it has triggered, perhaps), or you can call a separate function to do the same thing.

I believe you also need to enable the interrupt from User_Initialization() in user_routines.c. Look for something about interrupts in there.

Keep your progress posted here.
__________________
Code:
void function(void)
 {
  function();
 }

Last edited by Jake M : 25-01-2008 at 23:49.