Int Interrupt question


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1
    Join Date
    Sep 2006
    Posts
    747

    Default Int Interrupt question

    I am using P16f88, I read in Dogim Ibrahim book on picbasic that I can use the int interrupt, or external interrupt. I would like to see example of such interrupts. I keep finding ASM, timer interrupt, but no external interrupts in picbasic pro
    Last edited by lerameur; - 25th November 2010 at 18:02.

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Here is what I think are the best interrupts to use with PicBasic. They are called instant interrupts, or DT Interrupts. Here is a link and a few examples that should work with your chip, with possibly some minor adjustments.

    http://darreltaylor.com/DT_INTS-14/intro.html
    http://www.scalerobotics.com

  3. #3
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Ok ok I found lots of stuff, RB0 seems to be the pin of choice for most Pic's. Just that in most example they are showing ONE mainloop, and say after the interrupt sequence is finish, the program return to the mainloop. Does it go to the mainloop, or does it go back where it left like a sub routine.. ???

    K
    PS I was making a while loop to go to a special menu. The while loop was looking for a external pin being activated. implementing that while loop everywhere made it nasty. I think as far as I can read, this is the best choice, external interrupt ! as soon the user pushes the button it goes to a menu. My only concern is, can I do anything in an interrupt ?, meaning I2C reading, looping, pausing, observing other pin values. Meaning can I use interrupt routine like I would a subroutine ???
    Last edited by lerameur; - 25th November 2010 at 18:15.

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    The
    Code:
    @ INT_RETURN
    at the end of the interrupt routine sends the code back to what it was doing when the interrupt was triggered.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    My only concern is, can I do anything in an interrupt ?
    Yes and no...
    It is normally best to get in and out of an interrupt as quick as possible.
    Set a flag or increment a variable that will then be acted upon in the main program after the interrupt is finished.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    eee ook, you mean something like:
    /
    RBO = 1 ' call interrupt

    myInterrupt:
    Gosub Display_menu
    @int interrupt

    Display_menu:
    'display result on LCD....
    return
    /

    WIll the return go back to the interrupt or back to where interrupt has left the main program ??

    K

  7. #7
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Here is exactly what I need.. I think
    The programs records a multitude of time from an external timer.
    When the user push Pushes Button-A (RB0), it will go to a menu where the user can see all the times. The user can push Again button-A, to see the next time, Pushes again for the following time until it reaches the end. If the Button-A is not press for 10 seconds, the menu exit and return to where it left off. Is this Clear ?? sometime it is clear to me but not to others

    K

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by lerameur View Post
    eee ook, you mean something like:
    /
    RBO = 1 ' call interrupt


    K
    Hi Ken,
    not exactly, when RB0 does = 1 it sets a flag bit and that bit stays set even if RB0 goes back to zero, your program does something of your choosing as a result and then it clears that flag bit before it resumes, assuming you write the code properly.
    WIll the return go back to the interrupt or back to where interrupt has left the main program ??
    It returns to the next line normally.
    Last edited by Archangel; - 25th November 2010 at 23:52.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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