|
3 sensörlü LM35 Sıcaklık Kontrol Devresi Üç adet LM35'in sensör olarak kullanıldığı bu devrede 3 farklı noktanın sıcaklığını ölçmek ve bu ölçülen sıcaklıklara göre fan ve ısıtıcı çıkışlarını aktif etmek mümkündür. Dört adet buton ile istenilen sensörden istenilen sıcaklık için bir set değeri ayarlanması mümkündür. Devre Şeması ve Baskılı Devre Şemaları Proteus 6.2 sp4 ile hazırlanmıştır. www.labcenter.co.uk adlı web sitesinde bu programın demosunu indirebilirsiniz. Bu demo ile şemaları açıp inceleyebilirsiniz. @ __config _CP_OFF & _DEBUG_OFF & _LVP_OFF & _BODEN_ON & _MCLR_OFF & _PWRTE_ON & _WDT_ON & _INTRC_IO & _CCP1_RB3 @ messg "Config word yazıldı" include "defvar.h" menu var byte menumain con 0 menuselectsensor con 1 butongecikmesi con 250 secilisensor var byte curtemp var byte settemp var byte ctn var byte ctn_1 var byte ctn_2 var byte ctn_3 var byte ctn_4 var byte ctn_5 var byte gosub ilk read 0,secilisensor if secilisensor >=4 then secilisensor=1 endif read 1,settemp menu=0 loop: pause 200 select case menu case menumain lcdout $fe,1,"Temprature Controller S",#secilisensor gosub gettemp lcdout $fe,$c0,"T=",#curtemp,$fe,$c6,"S=",#settemp,$fe,$cd,"R=",#role," F=" gosub checkrelayfan gosub menumainbutons goto loop case menuselectsensor lcdout $fe,1,"sensor secimi" lcdout $fe,$c0,"secili sensor=",#secilisensor gosub menuselectbutons end select goto loop menuselectbutons: if sw1==0 then pause butongecikmesi menu=menumain endif mm4: if sw2==0 then pause butongecikmesi if sw2==0 then goto mm4 secilisensor=1 write 0,secilisensor endif mm5: if sw3==0 then pause butongecikmesi if sw3==0 then goto mm5 secilisensor=2 write 0,secilisensor endif mm6: if sw4==0 then pause butongecikmesi if sw4==0 then goto mm6 secilisensor=3 write 0,secilisensor endif return checkrelayfan: if settemp== curtemp then hpwm 1,0,5000 lcdout "0" role=0 else if settemp>curtemp then hpwm 1,0,5000 lcdout "0" role=1 else if (curtemp-settemp) > 40 then hpwm 1,255,5000 lcdout "255" else lcdout #(5*(curtemp-settemp)) hpwm 1,5*(curtemp-settemp),5000 endif role=0 endif endif return gettemp: select case secilisensor case 1 adcin sensor1,gectemp case 2 adcin sensor2,gectemp case 3 adcin sensor3,gectemp end select gectemp=(gectemp>>1) ctn_5=ctn_4 ctn_4=ctn_3 ctn_3=ctn_2 ctn_2=ctn_1 ctn_1=ctn ctn=gectemp.LOWBYTE curtemp=(ctn + ctn_1)/2 curtemp=(curtemp + ctn_2)/2 curtemp=(curtemp + ctn_2)/2 curtemp=(curtemp + ctn_3)/2 curtemp=(curtemp + ctn_4)/2 curtemp=(curtemp + ctn_5)/2 return ilk: data @0,2,30 TRISA = %11111111 TRISB = %00000000 ADCON1 = $84 '%10000100 AN2 and AN4 digital, AN0, AN1 and AN3 analog OSCTUNE = 0 'Ayarlanan frekansta çalış OSCCON = $70 '%01110000 '8 MHz OSC '$60 '%01100000 '4 MHz OSC OPTION_REG = $80 '$55 '%01010101 Set TMR0 configuration and enable PORTB pullups INTCON = $00 '$A0 '%10100000 Enable TMR0 interrupts CCP1CON=0 fan=0 role=0 ctn_5=0 ctn_4=0 ctn_3=0 ctn_2=0 ctn_1=0 ctn=0 pause 500 return menumainbutons: mm1: if sw1==0 then pause butongecikmesi if sw1==0 then goto mm1 menu=menuselectsensor endif mm2: if sw2==0 then pause butongecikmesi if sw2==0 then goto mm2 settemp=settemp+1 if settemp>=100 then settemp=99 endif write 1,settemp endif mm3: if sw3==0 then pause butongecikmesi if sw3==0 then goto mm3 settemp=settemp-1 if settemp < 1 then settemp=1 endif write 1,settemp endif return end |
|
Bu web sitesi ile ilgili soru veya görüşlerinizi
mustafapatan@gmail.comadresine gönderin.
|