Shop OBEX P1 Docs P2 Docs Learn Events
__PARAMCNT during interrupt; use of __INTPARAMFSR — Parallax Forums

__PARAMCNT during interrupt; use of __INTPARAMFSR

ZootZoot Posts: 2,227
edited 2008-05-22 13:54 in General Discussion
On my ISR-based SX projects, I generally use a NOPRESERVE for the ISR and assembly code for most of the ISR itself.

However, I have one project where I want to use the param registers in both the ISR and the mainline program.

In looking over the source code generated by SX/B, I noticed a few things that I need clarification on:

1. it appears that only PARAM1 - PARAM4 are preserved in the INTPARAMFSR registers; PARAM5 (aka __PARAMCNT) does NOT appear to be preserved. Since it seems to be common practice in SX/B to use __PARAMCNT, it would seem that if an interrupt occurs during the first few lines of something like the following, then you could be trouble. Or am I missing something? I generally use ASM and do not use the param registers in my ISRs, but still...

SomeSub:
   IF __PARAMCNT = 1 THEN
     tmpW1 = __PARAM1 ' if interrupt occurs here, and paramcnt is used by SX/B operations in the ISR, then it could get mucked up ????
   ELSEIF __PARAMCNT = 2 THEN
     tmpW1 = __PARAMW12
   ENDIF




2. since PARAMS are "preserved" in the __INTPARAMFSR registers during an interrupt, IF I AM DECLARING NOPRESERVE, it looks like I could claim back these registers for my own purposes? It appears (in my generated .src output anyway) that __INTPARAMFSR is declared and the var space is assigned whether or not is used?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST

1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php

Comments

  • BeanBean Posts: 8,129
    edited 2008-05-22 13:54
    Zoot,
    1) I think you are correct. __PARAM5 should be preserved as well. I'll look at the current beta to see if it is.

    2) If you are using NOPRESERVE then you could use the locations at __INTPARAMFSR for you own use.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?

    www.iElectronicDesigns.com

    ·
Sign In or Register to comment.