User manual

Table Of Contents
PICDEM
TM
Lab Development Board User’s Guide
DS41369A-page 72 © 2009 Microchip Technology Inc.
EXAMPLE 4-4: TMR0_ISR CODE FOR LAB 3
2. Copy/paste the code in Example 4-5 into the Initialize() over the code
from the previous lab:
void interrupt TMR0_ISR(void)
{
//Check if Timer0 interrupt has occurred
if(T0IE&&T0IF)
{
//if so, clear the interrupt flag
T0IF = 0;
//Turn off Timer1 (stop counting)
TMR1ON = 0;
//Assign the upper 4-bits of the 16-bit
//result to PORTC to light the LEDs connected
//RC0,R1,RC2 and RC3
PORTC = TMR1H>>4;
TMR0 = 10;
//Clear the Timer1 register pair
TMR1L = 0;
TMR1H = 0;
//Turn Timer1 back to start counting again
TMR1ON = 1;
}
else PORTC = PORTC;
}