Rev Author Line No. Line
4836 kakl 1 #include "main.h"
2  
3  
4 #define T1 PIN_D1 // charging
5 #define T2 PIN_D2 // discharging
6  
7 void main()
8 {
9  
10 setup_adc_ports(NO_ANALOGS|VSS_VDD);
11 setup_adc(ADC_CLOCK_DIV_2);
12 setup_spi(SPI_SS_DISABLED);
13 setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
14 setup_timer_1(T1_DISABLED);
15 setup_timer_2(T2_DISABLED,0,1);
16 setup_ccp1(CCP_OFF);
17 setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
18 setup_oscillator(OSC_8MHZ);
19  
20 output_high(T1);
4837 kakl 21 output_low(T2);
4836 kakl 22 delay_ms(1000);
23  
24 while(true)
25 {
26 output_low(T1); // charge
4837 kakl 27 delay_ms(2000);
4836 kakl 28 output_high(T1); // charge off
29 delay_ms(300);
4837 kakl 30 output_high(T2); // discharge
4836 kakl 31 delay_ms(200);
4837 kakl 32 output_low(T2); // discharge off
4836 kakl 33 delay_ms(300);
34 }
35  
36 }