' Termostat AD atalakito hasznalataval
'Processor 12f675  inter oszcilator 4MHz
'GPIO.0 - SENZOR bemenet
'GPIO.1 - Potenciometer bemenet
'GPIO.2 - Kimenet

program Farmventilacio
 
 dim senzor as word    'senzor 16 bites eredmeny
 dim potme  as word    'potmeter eredmenye 16bit
 dim potme_1 as word
 dim potme_2 as word
 main:
  
   GPIO = 0
   CMCON = 7
   TRISIO = 3
   ANSEL =3
   ADCON0.VCFG = 0
  loop:
     senzor =ADC_read(ANS0)
     potme = ADC_read(ANS1)
     potme_1 = ADC_read(ANS1) + 2
     potme_2 = ADC_read(ANS1) + 4
     if senzor < potme then
     GPIO = 0
     else
     if senzor > potme then
     GPIO = 4
     else
     if senzor >= potme_1 then
     GPIO = 12
     else
     if senzor >= potme_2  then
     GPIO = 28
     end if
    end if
   end if
  end if
     
     if senzor < potme_2  then
     GPIO = 12
    end if
     if senzor < potme_1 then
     GPIO = 4
    end if
     if senzor < potme then
     GPIO = 0
    end if
   goto loop
 end.