Using Pause and TMR0


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

    Default Using Pause and TMR0

    Hi,

    I have a little question ?

    Did Pause affect the work for TMR0.

    I have for Example one Timer that when I Push a Button Displays Hours,Minutes and Seconds.
    I have a Interrupt Routine all work fines.

    Interrupt:

    .............

    If Button Press Then Display :-)

    Display:
    High Led_LCD
    Lcdout $fe,$80," Time "
    Lcdout $fe,$C0,DEC2 Hour[2],":",DEC2 Minute[2],":",DEC2 Seconds[2]
    Pause 5000 ''''''''''''''''Display for 5 Seconds
    Low Led_LCD

    .............
    Did this 5 Seconds affect my TMR0 Interrupt,and I have next Time -5 Second in My Time Display!?

    When yes what I can do to not affect My TMR0 Timer.

    Thanks a lot!

    Regards Pesti

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Did this 5 Seconds affect my TMR0 Interrupt,and I have next Time -5 Second in My Time Display!?
    If you're using ON INTERRUPT, then yes. The PAUSE 5000 will definitely affect how long it will
    take before your interrupt is serviced. It won't affect TMR0 counting. Only the time before
    your interrupt gets serviced.

    When yes what I can do to not affect My TMR0 Timer.
    Use assembler interrupts. Look for Darrel Taylors' interrupt routines here.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Thank You Bruce !

    Regards Pesti.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Hi,

    I Found another Way.

    When I use for Example this:
    Display:
    Lcdout ..........................
    Pause 5000
    LCDout..........................
    Pause 4000
    Resume
    ------------------------------------------------------------------------
    Seconds = Seconds + 9 ' Add 9 Seconds to Seconds Variable
    Then I add in My Second Variable the Seconds that I have Lost with my pause statment.
    Is This a good Idea?

    Regards Pesti

  5. #5


    Did you find this post helpful? Yes | No

    Default

    I add a new Code line:

    Timer:
    TMR0IF = 0 '''''''''''''''''''''''''''''''''''''''''''''Clear Timer 0 Interrupt
    TMR0H = $0B
    TMR0L = $DB
    Second[2] = Second[2] + 1

    I add next Line
    If Second[2] > 60 Then Second[2] = Second[2] - 60 : Minute[2] = Minute[2] + 1

    If Second[2] = 60 Then Minute[2] = Minute[2] + 1 :Second[2] = 0
    If Minute[2] >= 60 Then Hour[2] = Hour[2] + 1 :Minute[2] = 0
    If Hour[2] >= 24 Then Hour[2] = 0

    Regards Pesti

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Pesti,

    If it works for your application, then go for it...;o}

    I can't see where it would hurt. Remember, however, that you have a time period that's not
    accounted for during each LCDOUT sequence. If this missing time isn't a problem, then just
    go with what you have.

    If timing is critical, you could always find out how long each LCDOUT takes, and factor this
    into your PAUSE time using PAUSEUS.

    See this thread for details http://www.picbasic.co.uk/forum/showthread.php?t=365
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. Delayed output 10 secs
    By lilimike in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 14th October 2011, 06:28
  2. Simple program - Strange problem!
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 19th December 2009, 22:52
  3. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  4. TMR0 interrupt and HSERIN
    By boban in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd September 2008, 11:48
  5. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10

Members who have read this thread : 0

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