__remainder
What is __REMAINDER?
Reading chapter 11 of "Practical SX/B", I come across an undeclared variable called __REMAINDER.
Say,
potVal = 125
digit = potVal / 100
newVal = __REMAINDER
At this point, does newVal equal to 25?
What other hiddent niceties similar to __REMAINDER are there?
Thanks.
Reading chapter 11 of "Practical SX/B", I come across an undeclared variable called __REMAINDER.
Say,
potVal = 125
digit = potVal / 100
newVal = __REMAINDER
At this point, does newVal equal to 25?
What other hiddent niceties similar to __REMAINDER are there?
Thanks.
Comments
There is also __WREMAINDER for division of WORD variables.
Note that __REMAINDER is stored in temporary RAM space. So it should be assigned immediately after the division operation.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"A government big enough to give you everything you want, is big enough to take away everything you·have."·· Thomas Jefferson
"It is our choices, Harry, that show what we truly are, far more than our abilities."·Dumbledore from Harry Potter
www.iElectronicDesigns.com
·
What other things such as __REMAINDER are there and where can I learn about them?
Thanks.
If memory serves (I don't have docs w/me right now), __REMAINDER is also __PARAMCNT is also __PARAM5, which is why you need to grab it right away if you want it.
There are also some other *hidden* registers assigned by SX/B that you can use to extend variable space *if you know what you're doing*. For example a number of bytes are assigned at __INTPARAMFSR (five bytes in SX/B 1.51.03 and six bytes in SX/B 2.0) -- these are used for saving and retrieving the M, __PARAM1, __PARAM2, __PARAM3, __PARAM4, and __PARAMCNT registers during interrupts (SX/B 1.51.03 does not preserve __PARAMCNT btw, but SX/B 2.0 will).
If you have NOPRESERVE set for your ISR, then you free up these bytes. I generally set NOPRESERVE, but use the first __INTPARAMFSR register (by hand) to save/restore the M register (otherwise any TRIS work you do in the ISR will muck up TRIS work in the mainline and vice versa), leaving me some extra bytes to play with.
e.g., with NOPRESERVE on, I get another 4 bytes in 1.51.03, and I put this at the top of my ISR:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
Post Edited (Zoot) : 8/20/2008 7:51:17 PM GMT