İki uçlu kablo çıkışı ile dört adet butonla çalışan devre, 12F675
mikro kontrol ile çalışmaktadır. Buton-1 yanan ledleri söndürür.
Buton-2 iki adet Ledi, Buton-3 ikinci Ledi, Buton-4 ise birinci Ledi
yakar. Görüldüğü gibi 4 adet butona bağlı iki adet tel bağlantısı
ile devredeki Ledlerin çalışması böyle olmaktadır.
Aşağıdaki linkten bas hex dosyaların bulunduğu RAR dosyasını
indirebilirsiniz.
DEFINE LOADER_USED 1
'define osccal_1k 1
define osc 4
'@ DEVICE pic12F675,XT_OSC,mclr_off
@ DEVICE pic12f675,INTRC_OSC_NOCLKOUT, mclr_off
Define ADC_BITS 8 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
adval var byte
ANSEL = 0100 ' Set AN2 analog, rest digital
trisio=001111
gpio =001111
OPTION_REG.7 = 0
OSCCAL = 3432
'high gpio.4
'pause 3000
'low gpio.4
loop:
'PAUSE 50 ' PAUSE 250mS
ADCIN 2, adval ' Read channel 2 to adval
'if gpio.2=0 then
select case adval
case IS < 50
high gpio.4
low gpio.5
case IS < 70
high gpio.5
low gpio.4
case IS < 90
high gpio.4
high gpio.5
case IS < 110
low gpio.4
low gpio.5
pause 500
end select
Goto Ana
End
Hiç yorum yok:
Yorum Gönder
Yorum yazın