Bits different ways
Well there are two ways to play with the bits.
clear_bit( t1con, T1CKPS1 ); //prescaler rate 1:1
clear_bit( t1con, T1CKPS0 );
or
t1con.T1CKPS1 = 0;
t1con.T1CKPS1 = 0;
The fuses are different also.
#pragma DATA _CONFIG, _CP_OFF & _LVP_OFF & _BODEN_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_OFF & _INTOSC_OSC_NOCLKOUT
Bit it works like a top and generates clean code. Look at the .asm file.
ONE TRICK. To use the debugger you HAVE to have an:
void interrupt(void) {
}
even if their is nothing in it. Will DRIVE you NUTS
and won't work without it.
Of course, if you already had an interrupt procedure with some code in it, then there is no problem.
For an 18Fwhaterver, it sort of will look something like this:
#pragma DATA _CONFIG1H, _OSC_INTIO7_1H & _FCMEN_OFF_1H
#pragma DATA _CONFIG2L, _PWRT_ON_2L & _BOREN_OFF_2L
#pragma DATA _CONFIG2H, _WDT_OFF_2H & _WDTPS_32768_2H
#pragma DATA _CONFIG3H, _MCLRE_ON_3H & _PBADEN_OFF_3H
#pragma DATA _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVREN_ON_4L & _XINST_OFF_4L
#pragma DATA _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L
#pragma DATA _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
#pragma DATA _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L
#pragma DATA _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
#pragma DATA _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L
#pragma DATA _CONFIG7H, _EBTRB_OFF_7H
All you have to do is look in the include files for the correct target.
Oh and really you should put:
#include <system.h>
rather than the specific chip. That way when you change horses, that part is done.