TMR0 interupt bit


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default

    Ok, added the option_reg to set up the counter to count ra4, low to high, WDT with a 1:1 prescale.
    Removed the count = display. Display should now increment? I can then use the value in display and send it out to the digits?

    What I was trying to do there was have display = count so that display would continue being incremented and I could do all the math and segment work with count word. This is becuase I need to count 21600 interupts, and them send that out as a 1 to the 7 segments. Sort of like a custom interupt postscaler I guess.

    Thanks for your help and insight everyone. Dave I already owe you one!

    display var word


    OPTION_REG = %11101000
    INTCON = %10100000

    display = 0 ' set initial value of counter display (This should appear on the 7 seg displays.)
    TMR0 = $00 ' set timer value to 0
    on interrupt goto setdisplay

    disable
    setdisplay:
    display = display + 1

    INTCON.2 = 0 ' clear overflow flag
    TMR0 = $00 ' reload TMR0
    resume
    enable

  2. #2
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default

    I think a light just came on!!

    Am I correct in thinking that you cant directly assign a word to the overflow flag, but when it interupts, your word can be embedded in the subroutine that you run on interupt? So the above code example would prove this by now having the display word being incremented whenever the timer overflows and provides the interupt.
    Its all semantics!!

  3. #3
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello JM,

    Jm>> So the above code example would prove this by now having the display word being incremented whenever the timer overflows and provides the interupt.<<

    That is correct...


    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  4. #4
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default

    DEFINE OSC 10

    OPTION_REG = %11101000
    INTCON = %10100000

    Display var word


    TMR0 = $00 ' set timer value to 0
    on interrupt goto setdisplay


    disable
    setdisplay:
    display = display + 1
    write 100,display
    INTCON.2 = 0 ' clear overflow flag
    TMR0 = $00 ' reload TMR0
    resume
    enable

    This will increment the value in location 5 which is great. However, when I add this line........


    data @0,192,249,164,176,153,146,130,248,128,144 ' 0-9 segment data


    .....location 100 will no longer store any value. What am I missing?
    Last edited by jmgelba; - 21st April 2005 at 14:09.

  5. #5
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default

    Any thoughts on this?

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. COUNT is not counting again
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 33
    Last Post: - 19th June 2009, 04:52
  3. Sleep Mode
    By Pesticida in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th March 2008, 10:31
  4. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 00:55
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

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