Datasheet
Chapter 4.
21
Timers
// Set up timer
// 7.3728 MHz * 16xPLL /Fosc/4 / 256 prescaler / 57600 counter
// timer should fire twice per second. Since the LED
// will toggle once per interrupt, the LED should come on
// once per second for a half second.
TMR2 = 0; // Clear timer 2
PR2 = 57600; // Timer 2 counter to 576000
T2CON = 0x8030; // Fosc/4, 1:256 prescale, start TMR2
if ( IFS0bits.T2IF )
{
IFS0bits.T2IF = 0;
LATD ^= 0x0002;
}