Re: IF ....THEN.... problems
You've got a redundancy in your code (maybe on purpose),
First you activate the timer = 1 flag, and in the next line of code you put an " IF timer = 1..."
Also the second IF THEN ELSE is inside the first IF THEN, try separating them.
Try using indent in your coding to see in a better way your routine operation
this is your code...commented
Code:
begin:
pause 100
IF timer = 1 AND relay = 1 THEN
pause 500
timer = 0 'turn off timer'
PAUSE 1000
portb.1 = 0
timer = 1 'turn on timer' '--turned timer = 1
IF timer = 1 AND relay = 1 THEN '--inside first loop? move it out. Timer already turned 1 on previous line, so is always true for that part
pause 500
timer = 0 'turn off timer'
pause 1000
portb.1 = 1
pause 1000
timer = 1 'turn on timer'
ENDIF
ENDIF
Last edited by El_AMPo; - 21st February 2011 at 15:31.
"If at first doesn't work, kicking it wont help either"
Bookmarks