PIC İLE UFAK BİR DEVRE YARDIM EDERMİSİNİZ

Hayır.bende denemesını yaptım gayet guzel calısıyordu.deneme semanı buraya koyarsan bakalım.sanırım bı yanlıslık var.Butonları pullup yaptınmı.
 
yok sen nasıl bağlıyorsun Devreni Buraya Koyarmısın ?
 
' PİC16F84A İÇİN
' BUTONLAR PORTA 0 VE 1 DE BAĞLI
' LED PORTB 0 DA BAĞLI
b1 var byte
b2 var byte

trisa = 255
trisb = 0
b1 = 0
b2 = 0
portb = 0

basla:
if b1 = 0 then
if porta.0 = 1 then
b1 = 1
toggle portb.0
endif
endif
if porta.0 = 0 then
b1 = 0
endif
if b2 = 0 then
if porta.1 = 1 then
b2 = 1
toggle portb.0
endif
endif
if porta.1 = 0 then
b2 = 0
endif
goto basla
END


bu kodları dene
 
jal dili ile yazdımğım program işini görür vaviyen anahtar gibi çalışıyor


include 16f628 -- target PICmicro

pragma target clock 20_000_000 -- oscillator frequency

pragma target OSC HS -- HS crystal or resonator
pragma target WDT disabled -- no watchdog
pragma target LVP disabled -- no Low Voltage Programming
pragma target MCLR external -- reset externally


enable_digital_io()


alias led is pin_A0
alias buton1 is pin_A1
alias buton2 is pin_A2
var bit p1=off
var bit p2=off
pin_A0_direction = output
pin_A1_direction = input
pin_A2_direction = input
--
forever loop
if buton1 & (!p1) & (!led) then p1=on led=on
elsif buton1 & (!p1) & led then p1=on led=off
end if

if buton2 & (!p2) & (!led) then p2=on led=on
elsif buton2 & (!p2) & led then p2=on led=off
end if

if (!buton1) then p1=off
end if

if (!buton2) then p2=off
end if



end loop
 

Forum istatistikleri

Konular
128,822
Mesajlar
920,773
Kullanıcılar
450,911
Son üye
fatih41311

Yeni konular

Geri
Üst