DT-INTs What's legal in an INT handler?


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156

    Default DT-INTs What's legal in an INT handler?

    My program spends most of it's time in a loop waiting for an interrupt (button presses). Once received, I need to decode 24 buttons and execute the right commands.

    My present interrupt handler has a SELECT CASE function in it, with a GOSUB in every case to execute the functions. Is this legit? What are the specifics and restrictions in an interrupt handler?

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


    Did you find this post helpful? Yes | No

    Default

    With DT_INTS using a PBP type interrupt, pretty much anything goes. I.E. use as many
    PBP instructions as you like in the int handler.

    That's the really cool part of using DTs' int program. He's done all the work for you.

    Just don't GOSUB outside the interrupt handler - or it will go-like-splat...
    Last edited by Bruce; - 29th January 2010 at 01:54.
    Regards,

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

  3. #3
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    Thanks Bruce. The issue that led me to this question is obviously something else.

    I'm using LONG variables for the first time, and have an issue where a bit in a 24-bit LONG is being changed/corrupted by me TOGGLEING another, unrelated BIT variable! I figured the problem is me MISDECLARING my variables OR my interrupt handler. Bit 14 of the LONG variable GRN is being corrupted when I toggle the bit variable SOLO. (If I don't use interrupts, the problem goes away).

    My variable declarations are:

    Code:
    RED         VAR     LONG                  
    GRN         VAR     LONG                  
    BUTTONS     VAR     LONG                  
    X           VAR     LONG                   
    Y           VAR     BYTE                    
    Z           VAR     BYTE                    
    RED0        VAR     RED.BYTE0
    RED1        VAR     RED.BYTE1
    RED2        VAR     RED.BYTE2
    GRN0        VAR     GRN.BYTE0
    GRN1        VAR     GRN.BYTE1
    GRN2        VAR     GRN.BYTE2                
    BU0         VAR     BUTTONS.BYTE0           
    BU1         VAR     BUTTONS.BYTE1         
    BU2         VAR     BUTTONS.BYTE2           
    LCD         VAR     BYTE[80]            
    COUNTER     VAR     BYTE                   
    VOL         VAR     BYTE                   
    SOLO        VAR     BIT
    Thanks.

  4. #4
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Bruce, could you please explain your comment to me? I would think that PBP knows what bank it is in, and keeps track of that - even in an interrupt handler. Is that not true?
    And what constitutes "outside the interrupt handler"? Must all the handler code be placed between the INT entry point and the INT_RETURN?
    I have to admit, I have violated your "rule" and it hasn't caused problems. Am I lucky?
    Please explain.
    Charles Linquist

  5. #5


    Did you find this post helpful? Yes | No

    Default

    ? toggle command is only good for port pins ?

  6. #6
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Smile

    Oh my gosh, you're right! I don't know why I thought that would work for a bit. That fixed it.

    THANKS Michael.

Similar Threads

  1. DT instant int error
    By mel4853 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th January 2010, 16:12
  2. Quick thoughts: DT Ints with encoders
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 7th January 2010, 01:01
  3. DT Ints work around for IOCA Register?
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th January 2010, 01:20
  4. Problem with Dt Ints Interrupts
    By Quin in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th July 2008, 19:21
  5. Replies: 1
    Last Post: - 2nd November 2006, 23:24

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