Merhaba arkadaşlar jal'a yeni başladım.Pic16F876A kullanıyorum.Butona basıyorum motor için çıkış veriyor.Ama motor çalışırken 1 adet lede ise flip flop yaptırmak istiyorum nasıl yapabilirim?
Programını korsan yardımlar gelebilir.
include 16f876_4
include jlib
include jpic876A
include comp
ADCON1 = 0b000000111
disable_a_d_functions
disable_comp
pin_b0_direction = output -- M.YON1 21
pin_b1_direction = output -- M.YON2 22
pin_b2_direction = output -- M.YON1 PWM 23
pin_b3_direction = output -- M.YON2 PWM 24
pin_b4_direction = output -- FLASHER 25
pin_b5_direction = input -- SW1 26
pin_b6_direction = input -- SW2 27
pin_c0_direction = input -- AÇ BUTONU 11
pin_c1_direction = input -- KAPA BUTONU 12
pin_c2_direction = input -- STOP BUTONU 13
pin_c3_direction = input -- ARKA FOTOSEL 14
pin_c4_direction = input -- ON.FOTOSEL 15
forever loop
-- Stop Butonu Başlangıç
if pin_c2 == high then
pin_b0 = low
pin_b1 = low
end if
-- Stop Butonu Bitiş
-- Aç Butonu Başlangıç
if (pin_c0 == high) & (pin_b0 == low) then
pin_b0 = high
pin_b1 = low
end if
-- Aç Butonu Bitiş
-- Kapa Butonu Başlangıç
if (pin_c1 == high) & (pin_b1 == low) then
pin_b0 = low
pin_b1 = high
end if
-- kapa Butonu Bitiş
if (pin_c0 == high) & (pin_b4 == high) then
pin_b4 = high
delay_1s
pin_b4 = low
delay_1s
end if
end loop
include 16f876_4
include jlib
include jpic876A
include comp
ADCON1 = 0b000000111
disable_a_d_functions
disable_comp
pin_b0_direction = output -- M.YON1 21
pin_b1_direction = output -- M.YON2 22
pin_b2_direction = output -- M.YON1 PWM 23
pin_b3_direction = output -- M.YON2 PWM 24
pin_b4_direction = output -- FLASHER 25
pin_b5_direction = input -- SW1 26
pin_b6_direction = input -- SW2 27
pin_c0_direction = input -- AÇ BUTONU 11
pin_c1_direction = input -- KAPA BUTONU 12
pin_c2_direction = input -- STOP BUTONU 13
pin_c3_direction = input -- ARKA FOTOSEL 14
pin_c4_direction = input -- ON.FOTOSEL 15
var byte sayac = 0
var byte led_start = 0
forever loop
-- Stop Butonu Başlangıç
if pin_c2 == high then
pin_b0 = low
pin_b1 = low
end if
-- Stop Butonu Bitiş
-- Aç Butonu Başlangıç
if (pin_c0 == high) & (pin_b0 == low) then
pin_b0 = high
pin_b1 = low
led_start = 1
end if
-- Aç Butonu Bitiş
-- Kapa Butonu Başlangıç
if (pin_c1 == high) & (pin_b1 == low) then
pin_b0 = low
pin_b1 = high
led_start = 0
end if
-- kapa Butonu Bitiş
if led_start == 1 then
sayac = sayac + 1
if sayac > 20 then sayac = 0 end if
delay_50ms
if sayac < 10 then
pin_b4 = low
else
pin_b4 = high
end if
else
led_start = 0
pin_b4 = low
en if
end loop
include 16f876_4
include jlib
include jpic876A
include comp
ADCON1 = 0b000000111
disable_a_d_functions
disable_comp
pin_b0_direction = output -- M.YON1 21
pin_b1_direction = output -- M.YON2 22
pin_b2_direction = output -- M.YON1 PWM 23
pin_b3_direction = output -- M.YON2 PWM 24
pin_b4_direction = output -- FLASHER 25
pin_b5_direction = input -- SW1 26
pin_b6_direction = input -- SW2 27
pin_c0_direction = input -- AÇ BUTONU 11
pin_c1_direction = input -- KAPA BUTONU 12
pin_c2_direction = input -- STOP BUTONU 13
pin_c3_direction = input -- ARKA FOTOSEL 14
pin_c4_direction = input -- ON.FOTOSEL 15
var byte sayac = 0
var bit led_start = false
forever loop
-- Stop Butonu Başlangıç
if pin_c2 == high then
pin_b0 = low
pin_b1 = low
end if
-- Stop Butonu Bitiş
-- Aç Butonu Başlangıç
if (pin_c0 == high) & (pin_b0 == low) then
pin_b0 = high
pin_b1 = low
led_start = true
end if
-- Aç Butonu Bitiş
-- Kapa Butonu Başlangıç
if (pin_c1 == high) & (pin_b1 == low) then
pin_b0 = low
pin_b1 = high
led_start = false
end if
-- kapa Butonu Bitiş
if led_start == true then
delay_50ms
pin_b4 = !pin_b4
else
pin_b4 = false
end if
end loop
Jalv2 de çalışıyor jalda da çalışması gerekli. Jalv2 kullanmanızı tavsiye ediyorum..