View Single Post
  #1   Spotlight this post!  
Unread 02-12-2003, 02:01
JimWright949's Avatar
JimWright949 JimWright949 is offline
The Owen Day of Seattle
AKA: Jim Wright
FRC #4542 (Titanium Talons)
Team Role: Mentor
 
Join Date: Sep 2003
Rookie Year: 2003
Location: Redmond, WA
Posts: 94
JimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to beholdJimWright949 is a splendid one to behold
Hints for the Edu Interrupts

Hello all,

Since I'm a mentor I will not give you the answer as to how to get your interrupts running. However here is some usefull information:

1) In the Microchip library there is a function called OpenPORTB, find out what is does and put it in your initialization code.

2) When you are calling interrupts you need to "save the context", there is a note about this in the PIC18F8520 datasheet on the Microchip site. However this is for people writing assembler, and the C code will not need this.

3) You may not want to code a printf line into an interrupt. It is generally a bad idea in the embedded programming world. To test if the interrupt is working have it add 1 to a global variable. Put this line in your main.c outside the main function (line 23):
int global_counter;

Put the printf in the main:
printf("Counter=%d\n",global_counter);

Put this line in your user_routines_fast.c outside any functions (line 60):
extern int global_counter;

Put this code in the InterruptHandlerLow () function:
global_counter++;

When you run your program and close and open the Interrupts the count will increase.

-Jim Wright