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


    Did you find this post helpful? Yes | No

    Default

    I wanted to clarify a point just to possibly help somebody else...

    Unfortunately, TOGGLE does work to change the state of a BIT variable, even though this is an incorrect use of the command! It also quite possibly clobbers some other unsuspecting variable, in this case a LONG. It would be nice if the compiler would flag it, but it doesn't so BEWARE!!

    Thanks again, Michael.

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


    Did you find this post helpful? Yes | No

    Default

    Hi Charles,

    What I meant was -- you don't want to jump outside an interrupt handler routine - without
    returning to it.

    I.E. if you GOSUB outside the interrupt routine, and don't re-enter it before your return, you might
    experience major problems.

    DT_INTS needs to exit from DT_INTS. If you jump outside of this routine, and try to return
    from the interrupt on-your-own, you're going to have a problem.

    Exit from an interruppt requires a lot of regitsers to be restored.

    If you jump outside of the int routine, and return on-your-own, you will for sure see a problem.
    Last edited by Bruce; - 29th January 2010 at 08:00.
    Regards,

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

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I.E. if you GOSUB outside the interrupt routine, and don't re-enter it before your return, you might
    experience major problems.

    Code:
    ------------ DT Interrupt handler --------
    Get_Byte:
    
    do something here
    
    If black then gosub apples
    If withe then gosub peach
    
    @ return
    
    
    apples:
    do something
    return
    
    peach:
    do something
    return
    Bruce, can you please explain better your statement? from what you said, I understand that the above example code could give problems, while I am using this type of jump out of the interrupt handler, quite often and I never experienced any problem.

    Al.
    Last edited by aratti; - 29th January 2010 at 08:24.
    All progress began with an idea

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


    Did you find this post helpful? Yes | No

    Default

    Hi Al,

    No problem at all with your code. You GOSUB outside the int handler, and you RETURN right back to it, so this isn't a problem.

    The problem is only when you GOTO (or GOSUB) to another routine, outside an interrupt handler, and you do NOT return to it where it restores saved registers, and issues a RETFIE command.

    You show a DT Interrupt handler. You may not see it, but i guarantee theres a lot of code on exit from a DT interrupt routine
    that's restoring system file registers.
    Last edited by Bruce; - 29th January 2010 at 08:50.
    Regards,

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

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


    Did you find this post helpful? Yes | No

    Default

    I feel better now! I haven't broken any laws.
    Charles Linquist

  6. #6
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Bruce, tank you for the explanation.

    Al.
    All progress began with an idea

Similar Threads

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

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