Instant Interrupt Error


+ Reply to Thread
Results 1 to 3 of 3
  1. #1

    Exclamation Instant Interrupt Error

    Hi,

    I recently got Darrel Taylor's 'Instant Interrupt' program to work and was trying to integrate into my main program. However, I get the error below:

    "Temp variables exceeding T4"

    I looked in ReEnterPBP.bas and found that it was the file that was reporting back the error (see the relevant section of code below).

    I do use a lot of variables in my program, but the total is 110 bytes, far from the 368 bytes on the 16F877a.

    Does anyone know of a way to modify the ReEnterPBP code so that it is able to save more variables (I should have the RAM space...)?


    From ReEnterPBP.bas:


    ASM
    ifdef RS1
    MOVE?BB _RS1_Save, RS1
    endif
    ifdef RS2
    MOVE?BB _RS2_Save, RS2
    endif
    ifdef T1
    MOVE?WW _T1_Save, T1
    endif
    ifdef T2
    MOVE?WW _T2_Save, T2
    endif
    ifdef T3
    MOVE?WW _T3_Save, T3
    endif
    ifdef T4
    MOVE?WW _T4_Save, T4
    endif
    ifdef T5
    ERROR "Temp variables exceeding T4"
    endif
    ENDASM

    Thanks!!
    Justin

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Hi Justin,

    PBP creates temporary variables as needed to handle complex formula's.

    <pre>x =((x*2)+3) + (y*2+1)/$4+(z+1)*2+(d*/250*2)+m dig 2</pre>For the above formula, PBP will need 5 temporary vars. (T1-T5) The more complex the formula, the more temp vars that are needed.

    Correcting the problem can be done 2 different ways.

    <hr>1. Break the formula into smaller sections. Changing the above formula to something like this ...<pre>x =((x*2)+3) + (y*2+1)/$4+(z+1)*2<br>x = x +(d*/250*2)+m dig 2</pre>will reduce the number of temp vars required to 3, which will fit into the existing program.

    <hr>2. Modify the ReEnterPBP file to handle more Temp vars.

    For each additional temp variable, create a new place to save it..
    <pre> T5_Save VAR WORD</pre>In the SavePBP: routine, add a condition to save the variable.<pre> ifdef T5<br> MOVE?WW T5, _T5_Save<br> endif</pre>And in the RestorePBP: routine, add a condition to restore the variable.<pre> ifdef T5<br> MOVE?WW _T5_Save, T5<br> endif</pre>Then adjust the error message to trigger at a higher number.<pre> ifdef T6<br> ERROR "Temp variables exceeding T5"<br> endif</pre>Repeat, untill you no longer get an error.

    HTH,
    Darrel

  3. #3

    Thumbs up Thanks Darrel!

    Darrel,

    It works great now - thanks as always for your contributions to the PBP community!

    Justin

Similar Threads

  1. Instant Interrupts - Revisited
    By Darrel Taylor in forum Code Examples
    Replies: 772
    Last Post: - 17th February 2016, 23:14
  2. darrel taylor's instant interrupt compiler error
    By delta_boogie in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 20th October 2009, 20:07
  3. Optimizing DIV
    By skimask in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 22nd September 2008, 05:58
  4. Replies: 1
    Last Post: - 3rd November 2006, 00:24
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 02:07

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts