Hi Chris,
I would like to know where to find a listing where the $31 came from? is there a chart or a rule for generating this number?
That would be in the datsheet for the particullar PIC...

On the 18F4550 (and I suspect most other PICs) setting T1CON to $31 means it's setup to run TMR1 with a prescaler of 1:8. Since you don't have a DEFINE OSC xx in your code I'm assuming it's 4MHz which means an instruction cycle of 1us. Since you're letting the timer free run (you don't reload it in the interrupt service routine) it'll overflow and trip an interrupt every 2^16*8*1us=0.524288 seconds or around 2Hz.

The reason the program compiled but "didn't run" is because setting T1CON to $00, $10, $20 or $30 does set the prescaler but it does NOT actually turn the timer ON. If the timer isn't turned ON it won't run and no interrupts will get tripped. Please note that in Darrels examples he has a special subroutine which he GOSUBs to actually start the timer - you don't - so if you don't set bit 0 of T1CON the timer won't run and interrupts won't fire.

/Henrik.