Ejemplo n.º 1
0
void init_pic(void)
{
    // initialise port A
    LATA = PA_DefData;
    TRISA = PA_DefTRIS;
    // initialise port C
    LATC = PC_DefData;
    TRISC = PC_DefTRIS;
    APFCON0 = 0x0;

    //setup_timer_2 (T2_DIV_BY_16, 250, 10); //500 us overflow, 5.0 ms interrupt
    setup_comparator (NC_NC_NC_NC); // This device COMP currently not supported by the PICWizard
    setup_oscillator (OSC_8MHZ|OSC_PLL_ON) ;
    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_32|RTCC_8_bit);      //1.0 ms overflow

    setup_timer_4(T4_DISABLED,0,1);
    setup_timer_6(T6_DISABLED,0,1);
}
Ejemplo n.º 2
0
void setup_peripherals()
{

	setup_adc( ADC_CLOCK_INTERNAL );

	setup_adc_ports( sAN0 | sAN9 );

	set_adc_channel(0);

	setup_timer_0(T0_INTERNAL|T0_DIV_64);

	setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);

	setup_timer_3(T3_DISABLED | T3_DIV_BY_1);
   	setup_timer_4(T4_DISABLED,0,1);
   	setup_timer_5(T5_DISABLED | T5_DIV_BY_1);
   	setup_timer_6(T6_DISABLED,0,1);

	setup_wdt(WDT_OFF); 

}