0,0 → 1,36 |
#include "main.h" |
|
|
#define T1 PIN_D1 // charging |
#define T2 PIN_D2 // discharging |
|
void main() |
{ |
|
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
setup_adc(ADC_CLOCK_DIV_2); |
setup_spi(SPI_SS_DISABLED); |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
setup_timer_1(T1_DISABLED); |
setup_timer_2(T2_DISABLED,0,1); |
setup_ccp1(CCP_OFF); |
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
setup_oscillator(OSC_8MHZ); |
|
output_high(T1); |
output_high(T2); |
delay_ms(1000); |
|
while(true) |
{ |
output_low(T1); // charge |
delay_ms(1000); |
output_high(T1); // charge off |
delay_ms(300); |
output_low(T2); // discharge |
delay_ms(200); |
output_high(T2); // discharge off |
delay_ms(300); |
} |
|
} |