I was playing around with using multiple program slots, on the 40X2, for the first time last night.
I have a program that includes a main menu for me to enter and adjust several settings.
The main menu took up half of the memory on slot 0, so I saved the menu into a different file
and loaded it into slot 1.
My slot 0 program now looks something like this:
DO
IF button1 is pressed, THEN do something written in slot 0
IF button2 is pressed, THEN do something else written in slot 0
IF button3 is pressed, THEN RUN 1 'goes to the main menu
LOOP
My slot 0 program runs great, but when it jumps over to slot 1, the Picaxe locks up on me.
Sometimes it doesn't lock up, sometimes it does. I figured out that it is freezing up on me
because I added the following to the very beginning of the slot 1 program in order to verify:
HIGH led_1
PAUSE 1000
LOW led_1.
When I jump to slot 1 from slot 0, sometimes I'll see the light come on, then go off 1 sec later
and then my main menu will run fine. However, more often than not, I'll see one of the
following results:
1. The LED fails to turn on, but I can no longer operate slot 0. (Picaxe freezes immediately upon Run1 command)
2. The LED turns on, but does not turn off, and I can not operate the slot 0 or 1 program.
(Picaxe freezes immediately after the HIGH led_1 command, or somewhere in the middle of the PAUSE command.
Everytime I've seen the LED turn off, the program seems to run fine without locking up on me.
It seems to want to lock up only during the first few commands of the slot 1 program.
Could it have something to do with the internal timer getting messed up or out of sync? I am not using an
external resonator. I am running the SERVo command in slot 0, which uses the internal timer.
Both slot 0 and 1 programs are downloaded in to the 40X2 using the 40X2 settings. If I combine the two
programs into one long program and redownload it to the chip, everything works great. It seems to be that
the problem comes from jumping from one slot to another.
Any help?
Thanks.
I have a program that includes a main menu for me to enter and adjust several settings.
The main menu took up half of the memory on slot 0, so I saved the menu into a different file
and loaded it into slot 1.
My slot 0 program now looks something like this:
DO
IF button1 is pressed, THEN do something written in slot 0
IF button2 is pressed, THEN do something else written in slot 0
IF button3 is pressed, THEN RUN 1 'goes to the main menu
LOOP
My slot 0 program runs great, but when it jumps over to slot 1, the Picaxe locks up on me.
Sometimes it doesn't lock up, sometimes it does. I figured out that it is freezing up on me
because I added the following to the very beginning of the slot 1 program in order to verify:
HIGH led_1
PAUSE 1000
LOW led_1.
When I jump to slot 1 from slot 0, sometimes I'll see the light come on, then go off 1 sec later
and then my main menu will run fine. However, more often than not, I'll see one of the
following results:
1. The LED fails to turn on, but I can no longer operate slot 0. (Picaxe freezes immediately upon Run1 command)
2. The LED turns on, but does not turn off, and I can not operate the slot 0 or 1 program.
(Picaxe freezes immediately after the HIGH led_1 command, or somewhere in the middle of the PAUSE command.
Everytime I've seen the LED turn off, the program seems to run fine without locking up on me.
It seems to want to lock up only during the first few commands of the slot 1 program.
Could it have something to do with the internal timer getting messed up or out of sync? I am not using an
external resonator. I am running the SERVo command in slot 0, which uses the internal timer.
Both slot 0 and 1 programs are downloaded in to the 40X2 using the 40X2 settings. If I combine the two
programs into one long program and redownload it to the chip, everything works great. It seems to be that
the problem comes from jumping from one slot to another.
Any help?
Thanks.