help with Interrupts

Basically i learned that the PIC18 we are using has digital interrupts, how do we use them. Because so far i understand that when the digital interrupt is triggered it stops the main program and goes to address it. Where in the program or how do we specify that which interrupt should result in what procedure. If some canhelp me here it will be great

The function that is called in response to an interrupt is specified in “user_routines_fast.c”. If there is some interest, I could whip-up some example code that uses interrupts and timers.

-Kevin

For good general pointers on how to use interrupts, see IFI’s white paper titled Using Polled or Interrupt-driven Timers at: http://www.innovationfirst.com/firstrobotics/white_papers.htm

It does not specifically address using the external interrupt pins (labeled INTERRUPTS on your EDU RC), but the principles for using external or internal (i.e. timer) interrupts are the same.

For more information on configuring your INTERRUPTS pins for use with interrupt-driven code, read the Microchip PIC18FXX20 Data Sheet. General interrupt information is on pages 87-102. Note that by checking ifi_aliases.h you can find out the mapping of the microcontroller pins (RB2-RB7) to the INTERRUPTS pins. Specific information on these pins and their interrupts is on pages 106-108 of the data sheet.

As a final note, remember that all interrupts that you use MUST be low priority. If you try to make any interrupts high priority then you will see the PROGRAM STATE LED blinking red.

Hey guys thnx a lot for your help, and i will love to see somw examples Kevin.

When else can the PROGRAM STATE LED turn red? I get it sometimes when not doing anything with timers or interrupts, and haven’t yet figured out why.

Stack overflow for example?

Thanks,
Bill Bennett

If too much current is given or too high of a voltage? Couldn’t tell but it was flashing red. :slight_smile:

Invalid code did it once, sent an empty program to eduRC.

Accessing an invalid ptr and making reference to it.

Those are the only three I’ve gotten.

Thanks,
Ryan Waliany