TMR0 stops working


Closed Thread
Results 1 to 26 of 26

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    shahidali55,

    Do you have an updated program?
    I tried to compile the program from post#1, but it has too many errors.

    It also has the pushbuttons on the same pins as the segments, and ASM opcodes in column 1.
    <br>
    DT

  2. #2
    Join Date
    Jun 2006
    Location
    Bangalore, India
    Posts
    136


    Did you find this post helpful? Yes | No

    Default

    Hello Darrel,
    As you suggested in post 2, the battery now charges from output from the 5v regulator (through a diode and a 2.2k resistor). The voltage at the PIC never rises above 4.6v. I tested this system with a 20v DC supply and the voltage at the pic pins is still at 4.63 volts (after 48 hours of running).

    I have attached a copy of the file with the required include (Instant interrupts) as a zip archive.
    The pushbuttons are not a concern now since the primary function of the device itself
    (i.e. keeping time) is not met.

    Is ASM opcodes in column 1 bad ?
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by shahidali55 View Post
    I have attached a copy of the file with the required include (Instant interrupts) as a zip archive.
    I don't understand why you've modified DT_INTS-14 like that. There's no need.
    I also don't like modified versions being posted on the Internet. Somebody will download it, it won't work, and then they'll blame me.

    Is ASM opcodes in column 1 bad ?
    Yes! Very BAD!
    ONLY Labels can go in the first column of ASM code.
    This applies to lines using the @ sign too. There must be a space after the @. (unless it's a label)

    With opcodes in column 1, the program won't compile. So that can't be the program you are currently running in the chip.

    DT

  4. #4
    Join Date
    Jun 2006
    Location
    Bangalore, India
    Posts
    136


    Did you find this post helpful? Yes | No

    Default

    Strange . . .
    Compiles fine for me.
    I have corrected the OPCODE in column 1 errors and attached another copy of the file.
    Sorry for modifying DT_INTS-14 , it it your work and i respect that. I modified it in my frustating attempts to correct the resetting and locking up of the chip.
    (still getting 3 warnings though)
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Question

    That is Strange! Wouldn't compile here the way it was before.

    I can't see anything in the program that would cause it to lock up.
    So I put together a breadboard to see what I could see.


    click image for larger version

    It's running on a 16F88 right now. Couldn't find my 628A.

    I'll see if it makes it past 7:14 first.
    Then set the time, and let it run.
    Hopefully I can find that 628A by then.

    I'll let you know if it locks up.

    DT

  6. #6
    Join Date
    Jun 2006
    Location
    Bangalore, India
    Posts
    136


    Did you find this post helpful? Yes | No

    Question

    Thanks DT.
    That is one really neat breadboard.
    Did you notice the hourly on screen animation?


    Just after the two LOOKUP statements there is a tricky piece of code that used to blink the colon:-
    ;if bres_hi<8 then
    ; Segments.7=0
    ;else
    ;Segments.7=1
    ;endif

    It is there in the code posted in #1.
    The code in post #18 has this part commented. Hence no blinking colon.
    But after 4 days of testing with this code (#18) everything seems to be fine.
    Could the blinking colon code have caused the problem?
    To blink the colon, i used to check a critical time keeping variable (bres_hi) of the 24 bit counter. I think if bres_hi was being read when an interrupt occured and the ISR tried to update the register, it got corrupted. Can this happen?
    Last edited by shahidali55; - 19th June 2008 at 18:46.

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


    Did you find this post helpful? Yes | No

    Default

    It is pretty neat isn't it? I'm actually thinking about hanging it on the wall just like it is.

    It's still happily keeping time. No glitches so far.
    I can't image that the blinking colon would have made any difference, but I'll uncomment it just for diligence sake.

    Yup, I saw the animation. That's cute. Also saw the upside down digits that I can see in your previous pictures, were mounted that way. Accidental??
    I commented out the extra Lookup and IF statement.

    Still haven't found the 628A, but I don't think there's enough difference to matter.
    I suppose I should put a battery in there and run it at lower voltages too.
    <br>
    DT

Similar Threads

  1. COUNT is not counting again
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 19th June 2009, 04:52
  2. TMR0 interrupt and HSERIN
    By boban in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd September 2008, 11:48
  3. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10
  4. using TMR0 as a counter..
    By sirvo in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 28th July 2007, 02:56
  5. Strange behaviour from PIC16F877 on TMR0
    By mikebar in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 19th August 2006, 01:31

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