Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Hints for the Edu Interrupts (http://www.chiefdelphi.com/forums/showthread.php?t=22885)

JimWright949 02-12-2003 02:01

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


All times are GMT -5. The time now is 00:16.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi