#include ".\main.h"
//#include <LCD.C>
#define LED PIN_C6 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5
//#define LCD_TYPE 1
//#include <lcd.c>
void main()
{
unsigned int setpoint;
unsigned int napeti;
unsigned int plneni=0;
/* lcd_init();
lcd_putc("\fReady...\n");
while (TRUE) {
k=kbd_getc();
if(k!=0)
if(k=='*')
lcd_putc('\f');
else
lcd_putc(k);
}
*/
setup_adc_ports(sAN0|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_32);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DIV_BY_1,255,1);
setup_ccp1(CCP_PWM);
setup_ccp2(CCP_PWM);
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
setup_oscillator(OSC_8MHZ);
set_pwm1_duty(0);
set_pwm2_duty(0);
// lcd_init();
setpoint = 60;
while(true)
{
set_adc_channel(1);
delay_us(100);
napeti = read_adc();
if (napeti <= setpoint)
{
if (plneni < 150) plneni++;
}
else
{
if (plneni > 0) plneni--;
}
set_pwm1_duty(plneni);
set_pwm2_duty(plneni);
output_low(LED);
delay_ms(100);
output_high(LED);
delay_ms(100);
}
}