PDA

View Full Version : 1 minute 30 seconds



Leonardo
- 28th November 2008, 14:55
Hello,
They can tell me how can I make a delay of 1 minute 30 seconds using this code. I have tried in various ways without any result.

Thank you


CLEAR
LED VAR GPIO.0
CMCON = 7
ANSEL = 0

Include "Elapsed.bas"

Gosub ResetTime ' Reset Time to 0d-00:00:00.00
Gosub StartTimer ' Start the Elapsed Timer

HIGH LED ; Start with LED on

Loop:
if MinutesChanged then
MinutesChanged = 0
if Minutes = 1 then LOW LED ; Turn off LED
endif
Goto Loop

Darrel Taylor
- 28th November 2008, 15:09
CLEAR
LED VAR GPIO.0
Delay VAR WORD

CMCON = 7
ANSEL = 0

Include "Elapsed.bas"
Gosub ResetTime ' Reset Time to 0d-00:00:00.00
Gosub StartTimer ' Start the Elapsed Timer

HIGH LED ; Start with LED on
SecondsChanged = 0
Delay = 90

Loop:
if Delay > 0 then
if SecondsChanged then
SecondsChanged = 0
Delay = Delay - 1
if Delay = 0 then LOW LED ; Turn off LED
endif
endif
Goto Loop

Leonardo
- 28th November 2008, 15:25
CLEAR
LED VAR GPIO.0
Delay VAR WORD

CMCON = 7
ANSEL = 0

Include "Elapsed.bas"
Gosub ResetTime ' Reset Time to 0d-00:00:00.00
Gosub StartTimer ' Start the Elapsed Timer

HIGH LED ; Start with LED on
SecondsChanged = 0
Delay = 90

Loop:
if Delay > 0 then
if SecondsChanged then
SecondsChanged = 0
Delay = Delay - 1
if Delay = 0 then LOW LED ; Turn off LED
endif
endif
Goto Loop

Hey Darrel,

The code can also be used for hours and days?.

Thanks

Darrel Taylor
- 28th November 2008, 15:35
Using HoursChanged or DaysChanged, sure can.
<br>

Leonardo
- 28th November 2008, 15:40
Using HoursChanged or DaysChanged, sure can.
<br>

Darrel,

Thanks for your answer, I have further questions, I would like for example using three buttons change the hours, minutes and seconds for the LED turns off once the time. With this code can I do?.

Thanks again

Darrel Taylor
- 28th November 2008, 15:47
Can you do it? Yes.

Can you do it with that code? NO.
<br>

Leonardo
- 28th November 2008, 15:51
Can you do it? Yes.

Can you do it with that code? NO.
<br>

Ok Darrel.