I'm building a midi keyboard, the program is nothing fancy mostly a series of if then statements checking for key presses. I tried compiling the program on the bs2, but I ran out of space in the EEPROM. I have a BS2sx in the mail currently so that I can take advantage of the 8 memory slots for my code. Could anyone tell me how variables are moved from slot to slot? I plan on simply going from slot 0 to the next until I have all my code in the EEPROM. Will the variable values storing key presses be carried over from slot 0 to slot 1 or no? Just to give you an idea some of my code follows:

Ideally all my IO pins would not change, would I have to redefine these as well as my variables in the beginning of another program slot? The program will check keys 1-22 in slot 0 23-40 in slot 1 and so on until I send it back to slot 0. It's important that the variables playx, which tell whether a note is already playing be unchanged when I switch. Without playx when you hold down a key it will repeatedly play the note instead of just once. Any help would be greatly appreciated.

erco

09-05-2008, 01:04 PM

See http://forums.parallax.com/showthread.php?p=748201

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."

allanlane5

09-05-2008, 08:53 PM

Bottom line -- there's only ONE set of "Variables", kept in registers on the CPU. You CAN use multiple 'memory slots' using the "RUN" command, but it's more complicated than a simple GOSUB call. Follow the links in the postings before this one to find the method.