' IR-pulse time saver.
' Made by Pekari 10.10.2008.
#picaxe 08m
setfreq m4
pause 1000
serout 1,N2400,(0)
pause 500
setfreq m8
main:
b1=0
b2=1
readadc 2,b0
if b0>99 then main
pulse:
b2=b2+1
readadc 2,b0
if b0<100 and b2<255 then pulse
write b1,b2
b1=b1+1
if b1>100 or b2=255 then show
b2=0
space:
b2=b2+1
readadc 2,b0
if b0>99 and b2<255 then space
write b1,b2
b1=b1+1
if b1>100 or b2=255 then show
goto pulse
show:
setfreq m4
serout 1,N2400,(254,128,"Length=",#b1," ")
pause 4000
for b3 = 0 to b1
read b3,b0
serout 1,N2400,(254,128,"Data=",#b3," = ",#b0," ")
pause 1000
next
goto main
Do you have better idea to save times? (Faster)I have no idea why WRITE is being used but that will make the code incredibly slow.
' IR-pulse time saver.
' Made by Pekari 10.10.2008.
#picaxe 08m
pause 1000
serout 1,N2400,(0)
pause 500
w0=1
b13=1
main:
pulsin 2,0,w1
if w1=0 then main
pulsin 2,1,w2
pulsin 2,0,w3
b0=b0-1
if b0>0 then main
counter:
pulsin 2,1,w4
pulsin 2,0,w4
b13=b13+1
if w4>0 then counter
if b1=0 then serout 1,N2400,(254,128,"Quantity=",#b13," ")
pause 2000
endif
serout 1,N2400,(254,128,"Pulse=",#b1," = ",#w1," ")
b1=b1+1
pause 1000
serout 1,N2400,(254,128,"Space=",#b1," = ",#w2," ")
b1=b1+1
pause 1000
if w1>0 and w2>0 and w3>0 then
serout 1,N2400,(254,128,"Same again ")
b0=b1/2
b0=b0+1
pause 500
else
serout 1,N2400,(254,128,"New code ")
w0=1
pause 500
endif
goto main
pulsout 0,902
pulsout 1,48
pulsout 0,64