Timer2 Interrupt, 16F1823


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

    Default Timer2 Interrupt, 16F1823

    I'm using a Timer2 interrupt on the timer's value match to PR2. I would like to enable/disable the interrupt function during the course of my program. Is it better to enable/disable using global interrupt enable GIE (INTCON bit 7) or timer 2 interrupt enable TMR2IE (PIE1 bit1)?

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: Timer2 Interrupt, 16F1823

    If you also have other interrupt sources then clearing the GIE-bit will of course disable them too. Clearing TMR2IE will disable that interrupt only. If you're using DT-INTS then you can use @ INT_DISABLE TMR2_INT.

    /Henrik.

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Timer2 Interrupt, 16F1823

    Henrick,
    Clearing TMR2IE is working .. just tried it. I only have one interrupt source so clearing GIE would probably also work. I'm not using DT_INT, not needed with the 16F1823 family.

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: Timer2 Interrupt, 16F1823

    Great!
    So you're writing the interrupt service routine all in ASM then? Well that's is indeed the best way but also the hardest - at least for me, because I suck at it :-(

    /Henrik.

  5. #5
    Join Date
    Sep 2013
    Location
    Dhaka, Bangladesh
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Timer2 Interrupt, 16F1823

    How to setup Timer2 interrupt????????

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,598


    Did you find this post helpful? Yes | No

    Default Re: Timer2 Interrupt, 16F1823

    16F PICs:
    http://www.darreltaylor.com/DT_INTS-14/intro.html

    18F PICs:
    http://darreltaylor.com/DT_INTS-18/home.html

    Then search the forums for examples.

    Robert

Similar Threads

  1. Replies: 5
    Last Post: - 18th March 2012, 21:40
  2. LAB-X1 Timer2 Clock
    By Bruce in forum Code Examples
    Replies: 0
    Last Post: - 25th July 2010, 02:03
  3. Timer1 and Timer2 interrupts, Darrel Taylor
    By ronbowalker in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th December 2009, 18:38
  4. PWM pic16f873a(can i use timer2?)
    By Jadavjd in forum General
    Replies: 3
    Last Post: - 3rd April 2007, 20:44
  5. Timer2
    By swordman in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th September 2004, 12:50

Members who have read this thread : 2

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