Datasheet
PICkitâ„¢ 3 Debug Express Lessons
© 2009 Microchip Technology Inc. DS41370C-page 53
FIGURE 3-44: LESSON 8 INTERRUPT SFRS
In the Lesson 8 source code, all the statements to change the rotation direction are in
the INT0 switch interrupt function, and the statements to rotate the LED display are in
the TMR0 interrupt function. All that remains in the main program is a while() loop
that updates the PORTD register with LED_Display. This statement could have also
been placed in the TMR0 interrupt function, but is left in the main program to illustrate
how the main program runs continuously and interacts with the interrupts.
Single Priority Interrupts
If only a single level of interrupts were used (RCON bit IPEN = 0), then it is only
necessary to define the interrupt vector at 0x0008, and a single Interrupt Service
Routine function with #pragma interrupt. All priority bit settings are ignored. The
function of the INTCON bits GIEH and GIEL become GIE and PEIE, respectively, with
the following functions:
3.8.3 Build and Run the Lesson 8 Code with PICkit 3 Debug Express
Build and program the Lesson 8 project, then Run the application in the debugger.
Turning the demo board potentiometer will affect the rotation speed of the LEDs. The
switch may be pressed to reverse the rotation. Use breakpoints to explore the
interrupting functions.
INTCONbits.GIE INTCONbits.PEIE Interrupt Functions
00No Interrupts; all interrupts disabled.
01No Interrupts; all interrupts disabled.
10Only interrupts enabled in INTCONx
enabled.
All PIEx interrupts remain disabled.
11All interrupts, including those enabled in
PIEx registers, are enabled.