My TMR1_INT Blinky is not blinking


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    May 2013
    Location
    australia
    Posts
    2,680


    Did you find this post helpful? Yes | No

    Default Re: My TMR1_INT Blinky is not blinking

    dt ints will not enable intcon PEIE you need to
    yes with the newer chips some interrupt enable bits and flags have been relocated from INTCON reg into PIEx/PIRx regs
    I'm not convinced dt-ints14 will always set the PEIE bit in INTCON when needed in all cases so i do it manually.
    to set PEIE WITH GIE use
    INTCON=$C0



    for this chip and timer1 interrupts its not necessary dt-ints will set PEIE for you but this has no relationship with PIE4.0, i have no idea how you made that inference



    just how does PIE4.0 = 0 stop the timer ?

    writing to the timer like this when its still running is a very bad idea
    TMR1H = 60 : TMR1L = 176 ' 50msec interval (32MHz, 16bit, 1:8)
    Warning I'm not a teacher

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: My TMR1_INT Blinky is not blinking

    Quote Originally Posted by richard View Post
    ...for this chip and timer1 interrupts its not necessary dt-ints will set PEIE for you but this has no relationship with PIE4.0, i have no idea how you made that inference...
    I think I got that originally from the datasheet:
    (16F18877 p.138)

    Note: Bit PEIE of the INTCON register must be set to enable any peripheral interrupt controlled by registers PIE1-PIE8.

    It looks to me like INTCOM is a master breaker; shutting that down shuts all interrupts.

    And individual interrupts can be managed via their PIE registers (ie: PIE4 alone manages 6 timers)
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: My TMR1_INT Blinky is not blinking

    Quote Originally Posted by richard View Post
    ...just how does PIE4.0 = 0 stop the timer ?...
    (also p.138)

    bit 0 TMR1IE: Timer1 Overflow Interrupt Enable bit

    1 = Enables the Timer1 overflow interrupt
    0 = Enables the Timer1 overflow interrupt
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,680


    Did you find this post helpful? Yes | No

    Default Re: My TMR1_INT Blinky is not blinking

    pic16 's have one level of interrupt , therefore an interrupt can never be interrupted

    disabling the timer1 interrupt inside an interrupt is a pointless exercises that accomplishes exactly nothing
    except to waste machine cycles

    disabling the timer1 interrupt does not in any way shape or form stop the timer from running.

    the only way to stop the timer is to either turn it off or stop its clock signal.
    Warning I'm not a teacher

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: My TMR1_INT Blinky is not blinking

    Quote Originally Posted by richard View Post
    pic16 's have one level of interrupt , therefore an interrupt can never be interrupted ...
    No, but any interrupt triggered while an ISR is running will be handled once the ISR finishes.

    (p.129 16F18877)

    Note

    1: Individual interrupt flag bits are set, regardless of the state of any other enable bits.

    2: All interrupts will be ignored while the GIE bit is cleared. Any interrupt occurring while the GIE bit is clear will be serviced when the GIE bit is set again.
    So you can have multiple Timers running at the same time (including USART interrupts and others).

    No...?
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,680


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: My TMR1_INT Blinky is not blinking

    So you can have multiple Timers running at the same time (including USART interrupts and others).
    of course you can, as many enabled as you see fit

    but one and only one can be serviced at a time, and it cannot be interrupted. first come first served.
    additional interrupts are serviced sequentially, one and only one at a time in the order the interrupt handler runs them.
    hence keep isr's short
    Warning I'm not a teacher

Similar Threads

  1. Replies: 3
    Last Post: - 15th April 2015, 04:58
  2. MIBAM blinky on 16f628
    By ShoKre in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th December 2013, 08:58
  3. Replies: 6
    Last Post: - 25th April 2010, 04:45
  4. Blinky not working with TOGGLE
    By AndrewC in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd November 2008, 08:45
  5. My first Blinky!
    By nomad in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 25th September 2007, 17:29

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