I want to make timer. When time is 0 sec, timer give log 1 on some port.
I probe many mode, but nothing is good. I use 7 segment display.
This is shematic
http://www.elecfree.com/electronic/w...lock-timer.gif
Can some body help me to do this.
I taste this : "If time=0 then porta.0 = 0" but not working
Code:
include "modedefs.bas"
trisb=0
cmcon=7
i var byte
j var byte
Number var word
Time var word
a var byte
b var byte
c var byte
d var byte
time = 40
goto Begin
Digit:
lookup i,[63,6,91,79,102,109,125,7,127,111],j
return
Begin:
number=time
d=number/1000
broj=broj-d*1000
c=number/100
broj=number-c*100
b=broj/10
a= number-b*10
i=a
gosub Digiti
low porta.4
portb=j
high porta.1
pause 1
i=b
gosub digit
low porta.1
portb=j
high porta.2
pause 1
i=c
gosub digit
low porta.2
portb=j
high porta.3
pause 1
i=d
gosub digit
low porta.3
portb=j
high porta.4
pause 1
if porta.5 = 0 then
time = time - 1
else
time = time + 10
endif
goto begin
end
Bookmarks