Help...Hardware Interrupt


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Posts
    14

    Default Help...Hardware Interrupt

    hello
    I make a simple program with hardware interrupt on portb.5. The program works well, but the return from the interrupt takes 67 seconds !! why?
    How can I reduce that time to return immediately from the interrupt to main program ??

    this is my code:

    DEVICE 16F628a
    ON_INTERRUPT GOTO Flash
    CONFIG INTRC_OSC_NOCLKOUT, WDT_OFF, PWRTE_ON, BODEN_OFF, MCLRE_OFF,lvp_off

    SYMBOL RBIE = INTCON.3
    SYMBOL RBIF = INTCON.0
    SYMBOL GIE = INTCON.7

    SYMBOL Output0 = PORTb.7 ;13
    SYMBOL Output1 = PORTb.4 ;10
    SYMBOL Output2 = PORTa.1 ;18
    SYMBOL Output3 = PORTb.6 ;12

    SYMBOL LED = PORTa.0 ;17
    SYMBOL prog_sw = PORTb.5 ;11

    GOTO Over_interrupt


    Flash:


    OUTPUT0=1
    DELAYMS 2000
    OUTPUT0=0
    RBIF = 0
    CONTEXT RESTORE

    Over_interrupt:
    TRISB = 0
    TRISA=0
    INPUT PROG_SW
    PORTB = 0
    PORTA=0

    OUTPUT0=1
    OUTPUT1=1
    OUTPUT2=1
    OUTPUT3=1
    DELAYMS 1000
    OUTPUT0=0
    OUTPUT1=0
    OUTPUT2=0
    OUTPUT3=0

    ' Initiate the interrupt
    GIE = 0
    RBIE = 1
    GIE = 1
    Inf:
    LOW LED
    DELAYMS 500
    HIGH LED
    DELAYMS 500
    GOTO Inf

    END

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Seems to be on the wrong forum!

    ------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Default

    Hi, Tohu

    As Sayzer says ( LOL ! ) this is not the ... wich compiler ? forum ...

    But your answer, wether the compiler, is the same, USE ASM INTERRUPTS !!! ...

    PbP does better here ... but it's PbP !!!

    Good luck

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 09:00
  2. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 02:35
  3. Help with Analog Interrupt
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 18:14
  4. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 02:59
  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