Using both hardware int and Timer Int together?


Closed Thread
Results 1 to 4 of 4

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Thanks Bruce

    I am using PBP ON INTERRUPT for the PORTB.0 interrupt

    Would this work?



    ON INTERRUPT GOTO myint ' Define interrupt handler

    INTCON = %10110000 ' enable both RB0 and Timer 0 INTS

    loop:
    Goto loop ' Normal program would be here


    DISABLE ' No interrupts past this point

    myint:

    IF INTCON.1 = 1 THEN RB0_INT 'Go to the PORTB.0 Int Routine


    '********************
    '''' THE TIMER INTERRUPT ROUTINE WOULD BE HERE
    '''''''''''''''''''''

    GOTO INTDONE
    '*****************************


    RB0_INT:
    ''''' NORMAL PORTB.0 ROUTINE
    ''''

    INTDONE:

    INTCON.1 = 0 ' Clear interrupt flag
    INTCON.2 = 0 'Clear Timer 0 overflow

    RESUME ' Return to main program
    ENABLE

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


    Did you find this post helpful? Yes | No

    Default

    Hi Ken,

    Looks fine to me.
    Regards,

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

Similar Threads

  1. Understanding timer issues
    By boroko in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th April 2009, 03:56
  2. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 16:10
  3. Newb timer problems
    By George in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 7th November 2007, 02:48
  4. Interrupt/timer not really interrupting...
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 22nd May 2005, 23:05
  5. Timer Accuracy
    By GEEZER in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 31st March 2005, 06:26

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