1 minute 30 seconds


Closed Thread
Results 1 to 7 of 7
  1. #1

    Default 1 minute 30 seconds

    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

    [HTML]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[/HTML]

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default 1 minute 30 seconds = 90 seconds

    Code:
    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
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Code:
    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

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Using HoursChanged or DaysChanged, sure can.
    <br>
    DT

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    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

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Can you do it? Yes.

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

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Can you do it? Yes.

    Can you do it with that code? NO.
    <br>
    Ok Darrel.
    Last edited by Leonardo; - 28th November 2008 at 15:58.

Similar Threads

  1. Thermo 7 segments - little problem
    By fratello in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 27th July 2013, 07:31
  2. RS485 bus - starting probem
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th January 2010, 13:35
  3. 32 bit square root
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 6th May 2009, 03:37
  4. one line led light make image
    By bioul in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 12:19
  5. HSERIN doesn´t work
    By wurm in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th July 2007, 14:23

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts