Thanks for your quick response. I wroted a scheme, but it is hand drawing for now, I hope it will be ok.
In the mean time, I found a way to get this work, but there is another problem again.
This is code:
TRISA = $FF 'Postavi sve pinove porta A kao ulazne
TRISB = $00 'Postavi sve pinove porta B kao izlazne
B0 var byte
i var byte
symbol t1 = porta.1
symbol tajmer = portb.0
symbol rele = porta.0
begin:
pause 100 'vrlo bitna pauza'
while tajmer = 1 and rele = 1
goto petlja
petlja:
i = 0
for i = 1 to 2
If i = 1 then
pause 300
goto petlja1
endif
if i = 2 then
pause 300
goto petlja2
endif
next i
petlja1:
PAUSE 500
tajmer = 0 'iskljuci tajmer'
portb.1 = 0 'ukljuci crvenu diodu veliku'
pause 3000 'pauza 3 sekunde'
petlja2:
tajmer = 1
portb.2 = 0 'ukljuci diodu zelenu'
portb.1 = 1 'iskljuci crvenu diodu'
pause 200
wend 'vrlo bitna pauza'
IF tajmer = 1 AND rele = 1
portb.3 = 0
portb.1 = 1
portb.2 = 1
ENDIF
B0 = 0
button t1,0,255,0,B0,1,ukljucenje 'ako je taster pritisnut idi na ukljucenje'
goto begin
ukljucenje:
tajmer = 1
goto begin
End
The commented is in Serbian so don`t look at it.
The code do following: after press a pushbutton t1, tajmer is on and it works until it turn off, but only a timer. Its transistor is still on and have to be off and again on to reset. Now transistor for timer is off, some leds are on, pause 3 seconds, then on again transistor and timer, after a while timer goes off, and continuo for the begining again.
The problem now is how to continue to cycle after wend and not to go from begin what this program do ? Becouse program after wend go from the begining again, not considering this IF...AND....Then after wend. I need this, and maybe more examining loops before going to begin again. Maybe this FOR cycle is not good?
Kind regards.
Bookmarks