|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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 |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| My hints and guess on the Game in 2004! | Elgin Clock | Rumor Mill | 116 | 09-01-2004 13:30 |
| Problem with interrupts on the PIC | Mike Betts | Programming | 7 | 16-12-2003 21:26 |
| Interrupts on the EDU-RC? | Andrew | Programming | 3 | 13-11-2003 23:16 |
| Hints For Rookie Programmers | Noah | Programming | 30 | 20-02-2003 20:07 |
| Hints @ Kickoff Broadcast | Nate Smith | General Forum | 13 | 05-01-2002 10:14 |