he buscado un fichero donde me me dice que source es el pin para contar y porb es la salida
no me funciona
Chip Settings
chip 16F84A,4
config OSC=XT, PWRTE=ON
;DEFINICIONES
define GATE PORTA.0
define SOURCE PORTA.1
define out0 PORTA.2
define led PORTA.3
;Variables
Dim COUNTREG As byte
Dim SAMPLE As byte
Dim LATCH As byte
Dir PORTA.0 In
Dir PORTA.1 in
Dir PORTA.2 Out
Dir PORTA.3 Out
dir PORTB out
COUNTREG = 0
out0 = 0
SAMPLE = 0
LATCH = 0
Set PORTA.3 On
wait 1 s
Set PORTA.3 Off
wait 1 s
main:
PORTB = COUNTREG
if COUNTREG=10 then
out0 = 1
wait 1 ms
COUNTREG = 0
out0 = 0
end if
if GATE=1 then
SAMPLE = SOURCE
if LATCH=SAMPLE then
goto main
end if
if LATCH=0 then
LATCH = 1
COUNTREG = COUNTREG+1
goto main
end if
if LATCH=1 then
LATCH = 0
goto main
end if
end if
goto main
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
he buscado un fichero donde me me dice que source es el pin para contar y porb es la salida
no me funciona
Chip Settings
chip 16F84A,4
config OSC=XT, PWRTE=ON
;DEFINICIONES
define GATE PORTA.0
define SOURCE PORTA.1
define out0 PORTA.2
define led PORTA.3
;Variables
Dim COUNTREG As byte
Dim SAMPLE As byte
Dim LATCH As byte
Dir PORTA.0 In
Dir PORTA.1 in
Dir PORTA.2 Out
Dir PORTA.3 Out
dir PORTB out
COUNTREG = 0
out0 = 0
SAMPLE = 0
LATCH = 0
Set PORTA.3 On
wait 1 s
Set PORTA.3 Off
wait 1 s
main:
PORTB = COUNTREG
if COUNTREG=10 then
out0 = 1
wait 1 ms
COUNTREG = 0
out0 = 0
end if
if GATE=1 then
SAMPLE = SOURCE
if LATCH=SAMPLE then
goto main
end if
if LATCH=0 then
LATCH = 1
COUNTREG = COUNTREG+1
goto main
end if
if LATCH=1 then
LATCH = 0
goto main
end if
end if
goto main
See https://sourceforge.net/p/gcbasic/discussion/new_forum/