jal ile güzel bir örnek

Başlatan salihtolu, 16 Kasım 2008, 15:05:43

salihtolu

arkadaşlar buyrun buyrun  buradan lütfen
dedenizden  hadi bakalım calışın şimdi  görüşürüz


P - Kodu:
include 16f84_4
include jlib
pin_a0_direction = input
pin_a1_direction = input
pin_a2_direction = input
pin_a3_direction = input
pin_a4_direction = input
pin_b0_direction = output
pin_b1_direction = output
pin_b2_direction = output
pin_b3_direction = output
pin_b4_direction = output
pin_b5_direction = output
pin_b6_direction = output
pin_b7_direction = output
pin_b0 = low -- pin a1?in başlangıç değeri
pin_b1 = low
pin_b2 = low
pin_b3 = low
pin_b4 = low
pin_b5 = low
pin_b6 = low
pin_b7 = low
procedure flasor is  -- bu satırdaki komutlar b3,e flaşör yaptırır
  pin_b3 = high
  delay_200ms
  pin_b3 = low
  delay_100ms
  end procedure
forever loop
 flasor
if pin_a0 == high then
pin_b1 = high
delay_200ms
else   -- else başka aksi takdirde yani burada a0,ra basılı değilse anlamında
pin_b1 = low
end if
if pin_a1 == high then -- burası b0,ı cıkış yapar
pin_b0 = high
end if
 
if pin_a2 == high then -- 5 volt gelince b0 eksi digerleri artı olur
pin_b0 = low
pin_b1 = high
pin_b2 = high
pin_b3 = high
pin_b4 = high
pin_b5 = high
pin_b6 = high
pin_b7 = high
end if
if pin_a3 == high then -- a3 artı olunca b7 eksi olur
pin_b7 = low
end if
 
 if pin_a4 == high then -- a4 artı olunca b6 artı digerleri eksi b7 de flaşör
pin_b0 = low
pin_b1 = low
pin_b2 = low
pin_b3 = low
pin_b4 = low
pin_b5 = low
pin_b6 = high
delay_200ms
pin_b6 = low
pin_b7 = low
delay_200ms
pin_b7 = high
delay_200ms
pin_b7 = low
end if
end loop


code tag kullanın..

muhittin_kaplan

Alıntı Yaparkadaşlar buyrun buyrun buradan lütfen
dedenizden hadi bakalım calışın şimdi görüşürüz
Çok İlginç Bir Yazım Özellikle "Dedenizden" :)

prof_81

komutları biraz uzun buldum.
pinleri tek tek tanımlamışsınız oysaki portları giriş çıkış yaparken

port_a_direction = all_input -- porta hepsi giriş
port_b_direction = all_output yazabilirsin -- portb hepsi çıkış

pinleri tek tek low yazacagına port_b = 0 yazabilirsin

ayrıca

"if pin_a2 == high then -- 5 volt gelince b0 eksi digerleri artı olur

pin_b0 = low
pin_b1 = high
pin_b2 = high
pin_b3 = high
pin_b4 = high
pin_b5 = high
pin_b6 = high
pin_b7 = high
end if "

bu kısmı

"if pin_a2 == high then
port_b = 0b11111110
end if"

şeklinde oluşturabilirsin