variable transfer from bank0 to bank1
djgilmo32
Posts: 10
I am running a program in a BS2P40 and using multiple banks. I am having trouble finding out why an integer variable declared in memory bank0 changes when it arrives in bank1.
EX.···························· bank0················· bank1
keypad input 01··=·········· 8, 9···················· 1, 0
keypad input 02··=·········· 8, 0·····················2, 0
etc.
anyone that can help is welcome to view my code and see whats going on. I'm tearing my hair out trying to figure this out.
EX.···························· bank0················· bank1
keypad input 01··=·········· 8, 9···················· 1, 0
keypad input 02··=·········· 8, 0·····················2, 0
etc.
anyone that can help is welcome to view my code and see whats going on. I'm tearing my hair out trying to figure this out.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
keycursor·········· VAR····· Byte
inkey1············· VAR····· Byte ' first keypad character
inkey2············· VAR····· Byte ' second keypad character
found·············· VAR····· Byte
... and this in the other:
inkey1············· VAR····· Byte ' first keypad character
inkey2············· VAR····· Byte ' second keypad character
found·············· VAR····· Byte
So, in program #1, keycursor is in location 8, inkey1 in location 9, and inkey2 in location 10 -- but in program #2 inkey1 is in location 8 and inkey2 is in location 9; your variables have been skewed because keycursor is not defined in the second program.
Back to the original suggestion: make your declarations in program #1 and then copy-and-paste them (without changes) to program #2.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
·· Once again you do not have your variables delcared the same in both slots.· You are declaring a variable named, "temp" in slot 0 as a NIB.· This doesn't appear in your slot 1 program.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Then you don't have to declare exactly the same variables in all Program Slots.
(We all know that we should be careful about defining too many variables lest we run out of space for them... )
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't visit my new website...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
This bit is repeated several times...
SUB IT!
Sections like this just screams for optimisation...
(Someone else is bound to tell you exactly how, though)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't visit my new website...