Shop OBEX P1 Docs P2 Docs Learn Events
EEPROM Full? Error message help! — Parallax Forums

EEPROM Full? Error message help!

SabbobotSabbobot Posts: 3
edited 2014-05-16 01:52 in BASIC Stamp
I have written a code for my BASIC Stamp Boe-Bot to roam on its own, detect corners and escape from them, and detect traps (meaning that the Boe-Bot is going back and forth between two parallel walls like a ping-pong ball) and escape from them. When I try to download the code to my Boe-Bot — or check the syntax — I get an error message telling me that EEPROM is apparently full? It highlights the word GOSUB when I try on my mac, sometimes it highlights the word TO inside one of the subroutines when I check the syntax on my windows computer. I have used EEPROM a little bit so I have a general idea of what it is and how it works but this particular code doesn't try to access EEPROM (at least not like with a READ... SELECT... ENDSELECT command type thing). What causes the is problem with EEPROM and how do I fix it so I can get back to testing my program? Oh and one last note the code is not commented very much or explained a lot, this is on purpose. I am still debugging it and trying to see if it even works (hence all of the DEBUG commands). This EEPROM issue is just stopping me from doing that. There might be a chance that the code itself is still wrong/buggy and therefore causing the EEPROM problem?
[COLOR=#00B200][FONT=Menlo]'-----[ Title ]-------------------------------------------------------------------------------------[/FONT][/COLOR]
[COLOR=#00B200][FONT=Menlo]' Whisker Roaming Dual Escapes. The Boe-Bot will navigate on its own, detect corners/parallel wall traps, and escape from them.[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[COLOR=#00B200][FONT=Menlo]' {$STAMP BS2}[/FONT][/COLOR]
[COLOR=#00B200][FONT=Menlo]' {$PBASIC 2.5}[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[FONT=Menlo][COLOR=#0433ff][B]DEBUG[/B][/COLOR] " Program Running! " ,[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]
[/FONT]
[COLOR=#00B200][FONT=Menlo]'-----[Variables]------------------------------------------------------------------------------------[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[FONT=Menlo][COLOR=#0433ff][B]DEBUG[/B][/COLOR] " Creating variables. " ,[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]pulseCount     [COLOR=#0433ff][B]VAR[/B][/COLOR]  [COLOR=#0433ff][B]BYTE[/B][/COLOR]                      [COLOR=#00b200]' FOR...NEXT loop counter.[/COLOR][/FONT]
[COLOR=#00B200][FONT=Menlo][COLOR=#000000]cornercounter  [/COLOR][COLOR=#0433ff][B]VAR[/B][/COLOR][COLOR=#000000]  [/COLOR][COLOR=#0433ff][B]NIB[/B][/COLOR][COLOR=#000000]                       [/COLOR]' Counts alternate single whisker presses[/FONT][/COLOR]
[COLOR=#00B200][FONT=Menlo][COLOR=#000000]trapcounter    [/COLOR][COLOR=#0433ff][B]VAR[/B][/COLOR][COLOR=#000000]  [/COLOR][COLOR=#0433ff][B]NIB[/B][/COLOR][COLOR=#000000]                       [/COLOR]' Counts conseutive double whisker presses[/FONT][/COLOR]
[COLOR=#00B200][FONT=Menlo][COLOR=#000000]counter        [/COLOR][COLOR=#0433ff][B]VAR[/B][/COLOR][COLOR=#000000]  [/COLOR][COLOR=#0433ff][B]NIB[/B][/COLOR][COLOR=#000000]                       [/COLOR]' Counts the number of times to run the loop in the Corner_Beep_Flash and Trap_Beep_Flash subrountines[/FONT][/COLOR]
[FONT=Menlo]old7           [COLOR=#0433ff][B]VAR[/B][/COLOR]  [COLOR=#0433ff][B]BIT[/B][/COLOR]                       [COLOR=#00b200]' Stores previous IN7[/COLOR][/FONT]
[FONT=Menlo]old5           [COLOR=#0433ff][B]VAR[/B][/COLOR]  [COLOR=#0433ff][B]BIT[/B][/COLOR]                       [COLOR=#00b200]' Stores previous IN5[/COLOR][/FONT]
[FONT=Menlo]
[/FONT]
[COLOR=#00B200][FONT=Menlo]'-----[ Initialization ]-----------------------------------------------------------------------------[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[FONT=Menlo][COLOR=#0433ff][B]DEBUG[/B][/COLOR] " Initialization routine in process. " ,[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[COLOR=#00B200][FONT=Menlo][COLOR=#0433ff][B]FREQOUT[/B][/COLOR][COLOR=#000000] 4, 3000, 1000                         [/COLOR]' Brownout and program start/reset indicator[/FONT][/COLOR]
[FONT=Menlo]counter = 1[/FONT]
[COLOR=#00B200][FONT=Menlo][COLOR=#000000]cornercounter = 1                             [/COLOR]' Set to 1 so that the FOR ... NEXT loop can run[/FONT][/COLOR]
[COLOR=#00B200][FONT=Menlo][COLOR=#000000]trapcounter = 1                               [/COLOR]' Set to 1 so that the FOR ... NEXT loop can run[/FONT][/COLOR]
[FONT=Menlo]old7 = 0[/FONT]
[FONT=Menlo]old5 = 1[/FONT]
[FONT=Menlo]
[/FONT]
[COLOR=#00B200][FONT=Menlo]'-----[ Main Routine ]-------------------------------------------------------------------------------[/FONT][/COLOR]
[FONT=Menlo][COLOR=#0433ff][B]DEBUG[/B][/COLOR] " Main routine in process. " ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]DO[/FONT]
[COLOR=#0433FF][FONT=Menlo][B]IF[/B][COLOR=#000000] ([/COLOR][B]IN7[/B][COLOR=#000000] <> [/COLOR][B]IN5[/B][COLOR=#000000]) [/COLOR][B]THEN[/B][/FONT][/COLOR]
[FONT=Menlo]  [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN7 <> IN5) " ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]  [COLOR=#0433ff][B]IF[/B][/COLOR] (old7 <> [COLOR=#0433ff][B]IN7[/B][/COLOR]) [COLOR=#0433ff][B]AND[/B][/COLOR] (old5 <> [COLOR=#0433ff][B]IN5[/B][/COLOR]) [COLOR=#0433ff][B]THEN[/B][/COLOR][/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN7 <> IN5) AND (old7 <> IN7) AND (old5 <> IN5). Increasing counter. Remembering press. " ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Corner_Beep_Flash[/FONT]
[FONT=Menlo]    cornercounter = cornercounter + 1[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Remember_Press[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]IF[/B][/COLOR] (cornercounter > 4) [COLOR=#0433ff][B]THEN[/B][/COLOR][/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN7 <> IN5) AND (old7 <> IN7) AND (old5 <> IN5) AND (cornercounter > 4). Resetting counter. Escaping corner. " ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]      cornercounter = 1[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 2500[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]HIGH[/B][/COLOR] 10[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]HIGH[/B][/COLOR] 1[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Back_Up[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Turn_Left[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Turn_Left[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 2500[/FONT]
[FONT=Menlo]    ELSEIF ([COLOR=#0433ff][B]IN5[/B][/COLOR] = 0) [COLOR=#0433ff][B]THEN[/B][/COLOR][/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN7 <> IN5) AND (old7 <> IN7) AND (old5 <> IN5) AND (IN5 = 0). Turning right. " ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3000[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]HIGH[/B][/COLOR] 1[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Back_Up[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Turn_Right[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3000[/FONT]
[FONT=Menlo]    ELSEIF ([COLOR=#0433ff][B]IN7[/B][/COLOR] = 0) [COLOR=#0433ff][B]THEN[/B][/COLOR][/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN7 <> IN5) AND (old7 <> IN7) AND (old5 <> IN5) AND (IN7 = 0). Turning left. " ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3000[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]HIGH[/B][/COLOR] 10[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Back_Up[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Turn_Left[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3000[/FONT]
[FONT=Menlo]    ENDIF[/FONT]
[FONT=Menlo]  ELSE[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]IF[/B][/COLOR] ([COLOR=#0433ff][B]IN5[/B][/COLOR] = 0) [COLOR=#0433ff][B]THEN[/B][/COLOR][/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN7 <> IN5) BUT (old7 = IN7) OR (ol5 = IN5) AND (IN5 = 0). Turning right. " ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3000[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]HIGH[/B][/COLOR] 1[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Back_Up[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Turn_Right[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3000[/FONT]
[FONT=Menlo]    ELSEIF ([COLOR=#0433ff][B]IN7[/B][/COLOR] = 0) [COLOR=#0433ff][B]THEN[/B][/COLOR][/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN7 <> IN5) BUT (old7 = IN7) OR (ol5 = IN5) AND (IN7 = 0). Turning left. " ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3000[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]HIGH[/B][/COLOR] 10[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Back_Up[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Turn_Left[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3000[/FONT]
[FONT=Menlo]    ENDIF[/FONT]
[FONT=Menlo]  ENDIF[/FONT]
[FONT=Menlo]ELSE[/FONT]
[FONT=Menlo]  [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN7 = IN5). Resetting counter. Remembering press. " ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]  cornercounter = 1[/FONT]
[FONT=Menlo]  [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Remember_Press[/FONT]
[FONT=Menlo]  [COLOR=#0433ff][B]LOW[/B][/COLOR] 1[/FONT]
[FONT=Menlo]  [COLOR=#0433ff][B]LOW[/B][/COLOR] 10[/FONT]
[FONT=Menlo]ENDIF[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo][COLOR=#0433ff][B]IF[/B][/COLOR] ([COLOR=#0433ff][B]IN5[/B][/COLOR] = 0) [COLOR=#0433ff][B]AND[/B][/COLOR] ([COLOR=#0433ff][B]IN7[/B][/COLOR] = 0) [COLOR=#0433ff][B]THEN[/B][/COLOR][/FONT]
[FONT=Menlo]  [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN5 = 0) AND (IN7 = 0) "  ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]  [COLOR=#0433ff][B]IF[/B][/COLOR] (old5 = [COLOR=#0433ff][B]IN5[/B][/COLOR]) [COLOR=#0433ff][B]AND[/B][/COLOR] (old7 = [COLOR=#0433ff][B]IN7[/B][/COLOR]) [COLOR=#0433ff][B]THEN[/B][/COLOR][/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN5 = 0) AND (IN7 = 0) AND (old5 = IN5) AND (old7 = IN7) " ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]IF[/B][/COLOR] (trapcounter > 3) [COLOR=#0433ff][B]THEN[/B][/COLOR][/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN5 = 0) AND (IN7 = 0) AND (old5 = IN5) AND (old7 = IN7) AND (trapcounter > 3) " ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]      trapcounter = 1[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3500[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]HIGH[/B][/COLOR] 1[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Back_Up[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Turn_Left[/FONT]
[FONT=Menlo]      [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3500[/FONT]
[FONT=Menlo]    ELSE[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN5 = 0) AND (IN7 = 0) AND (old5 = IN5) AND (old7 = IN7) BUT (trapcounter < 3) " ,CR,CR[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Trap_Beep_Flash[/FONT]
[FONT=Menlo]    trapcounter = trapcounter + 1[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Remember_Press[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3000[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]HIGH[/B][/COLOR] 10[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]HIGH[/B][/COLOR] 1[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Back_Up[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Turn_Left[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Turn_Left[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3000[/FONT]
[FONT=Menlo]    ENDIF[/FONT]
[FONT=Menlo]  ELSE[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]DEBUG[/B][/COLOR] " (IN5 = 0) AND (IN7 = 0) BUT (old5 <> IN5) OR (old7 <> IN7) " ,[COLOR=#0433ff][B]CR[/B][/COLOR],[COLOR=#0433ff][B]CR[/B][/COLOR][/FONT]
[FONT=Menlo]    trapcounter = 1[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Remember_Press[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3000[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]HIGH[/B][/COLOR] 10[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]HIGH[/B][/COLOR] 1[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Back_Up[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Turn_Left[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Turn_Left[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 1250, 3000[/FONT]
[FONT=Menlo]  ENDIF[/FONT]
[FONT=Menlo]ELSE[/FONT]
[FONT=Menlo]  [COLOR=#0433ff][B]GOSUB[/B][/COLOR] Forward_Pulse[/FONT]
[FONT=Menlo]  [COLOR=#0433ff][B]LOW[/B][/COLOR] 10[/FONT]
[FONT=Menlo]  [COLOR=#0433ff][B]LOW[/B][/COLOR] 1[/FONT]
[FONT=Menlo]ENDIF[/FONT]
[FONT=Menlo]
[/FONT]
[FONT=Menlo]LOOP[/FONT]
[FONT=Menlo]
[/FONT]
[COLOR=#00B200][FONT=Menlo]'-----[ Subroutines ] -------------------------------------------------------------------------------[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[COLOR=#FF2600][FONT=Menlo][B]Forward_Pulse:[/B][/FONT][/COLOR]
[FONT=Menlo]  [COLOR=#0433ff][B]PULSOUT[/B][/COLOR] 13, 850[/FONT]
[FONT=Menlo]  [COLOR=#0433ff][B]PULSOUT[/B][/COLOR] 12, 655[/FONT]
[FONT=Menlo]  [COLOR=#0433ff][B]PAUSE[/B][/COLOR] 20[/FONT]
[COLOR=#0433FF][FONT=Menlo][COLOR=#000000]  [/COLOR][B]RETURN[/B][/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[COLOR=#FF2600][FONT=Menlo][B]Turn_Left:[/B][/FONT][/COLOR]
[FONT=Menlo]  [COLOR=#0433ff][B]FOR[/B][/COLOR] pulseCount = 0 [COLOR=#0433ff][B]TO[/B][/COLOR] 19[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]PULSOUT[/B][/COLOR] 13, 666[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]PULSOUT[/B][/COLOR] 12, 655[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]PAUSE[/B][/COLOR] 20[/FONT]
[COLOR=#0433FF][FONT=Menlo][COLOR=#000000]  [/COLOR][B]NEXT[/B][/FONT][/COLOR]
[COLOR=#0433FF][FONT=Menlo][COLOR=#000000]  [/COLOR][B]RETURN[/B][/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[COLOR=#FF2600][FONT=Menlo][B]Turn_Right:[/B][/FONT][/COLOR]
[FONT=Menlo]  [COLOR=#0433ff][B]FOR[/B][/COLOR] pulseCount = 0 [COLOR=#0433ff][B]TO[/B][/COLOR] 19[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]PULSOUT[/B][/COLOR] 13, 850[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]PULSOUT[/B][/COLOR] 12, 850[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]PAUSE[/B][/COLOR] 20[/FONT]
[COLOR=#0433FF][FONT=Menlo][COLOR=#000000]  [/COLOR][B]NEXT[/B][/FONT][/COLOR]
[COLOR=#0433FF][FONT=Menlo][COLOR=#000000]  [/COLOR][B]RETURN[/B][/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[COLOR=#FF2600][FONT=Menlo][B]Back_Up:[/B][/FONT][/COLOR]
[FONT=Menlo]  [COLOR=#0433ff][B]FOR[/B][/COLOR] pulseCount = 0 [COLOR=#0433ff][B]TO[/B][/COLOR] 40[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]PULSOUT[/B][/COLOR] 13, 666[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]PULSOUT[/B][/COLOR] 12, 850[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]PAUSE[/B][/COLOR] 20[/FONT]
[COLOR=#0433FF][FONT=Menlo][COLOR=#000000]  [/COLOR][B]NEXT[/B][/FONT][/COLOR]
[COLOR=#0433FF][FONT=Menlo][COLOR=#000000]  [/COLOR][B]RETURN[/B][/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[COLOR=#FF2600][FONT=Menlo][B]Corner_Beep_Flash:[/B][/FONT][/COLOR]
[FONT=Menlo]  [COLOR=#0433ff][B]FOR[/B][/COLOR] counter = 1 [COLOR=#0433ff][B]TO[/B][/COLOR] trapcounter[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 750, 4500[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]HIGH[/B][/COLOR] 10[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]HIGH[/B][/COLOR] 1[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]PAUSE[/B][/COLOR] 400[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]LOW[/B][/COLOR] 10[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]LOW[/B][/COLOR] 1[/FONT]
[COLOR=#0433FF][FONT=Menlo][COLOR=#000000]  [/COLOR][B]NEXT[/B][/FONT][/COLOR]
[COLOR=#0433FF][FONT=Menlo][COLOR=#000000]  [/COLOR][B]RETURN[/B][/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[COLOR=#FF2600][FONT=Menlo][B]Trap_Beep_Flash:[/B][/FONT][/COLOR]
[FONT=Menlo]  [COLOR=#0433ff][B]FOR[/B][/COLOR] counter = 1 [COLOR=#0433ff][B]TO[/B][/COLOR] trapcounter[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]FREQOUT[/B][/COLOR] 4, 750, 5500[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]HIGH[/B][/COLOR] 10[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]HIGH[/B][/COLOR] 1[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]PAUSE[/B][/COLOR] 400[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]LOW[/B][/COLOR] 10[/FONT]
[FONT=Menlo]    [COLOR=#0433ff][B]LOW[/B][/COLOR] 1[/FONT]
[COLOR=#0433FF][FONT=Menlo][COLOR=#000000]  [/COLOR][B]NEXT[/B][/FONT][/COLOR]
[COLOR=#0433FF][FONT=Menlo][COLOR=#000000]  [/COLOR][B]RETURN[/B][/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[COLOR=#FF2600][FONT=Menlo][B]Remember_Press:[/B][/FONT][/COLOR]
[FONT=Menlo]  old7 = [COLOR=#0433ff][B]IN7[/B][/COLOR][/FONT]
[FONT=Menlo]  old5 = [COLOR=#0433ff][B]IN5[/B][/COLOR][/FONT]
[COLOR=#0433FF][FONT=Menlo][B]RETURN[/B][/FONT][/COLOR]

Comments

  • Mike GMike G Posts: 2,702
    edited 2014-05-15 06:36
    BS2 programs are stored in EEPROM. Try commenting the debug statements...there are a lot of bytes being used by DEBUG, about 70% of the program is DEBUG text.

    Take a look at DEBUG in the STAMP manual. I'm sure you can refactor the debug code into a SUB while maintaining the current functionality.
  • davejamesdavejames Posts: 4,047
    edited 2014-05-15 09:58
    Sabbobot - following on Mike's response.

    It appears that each DEBUG statement uses 9 bytes of EEPROM, excluding any arguments but one.

    So the 17 (or so) DEBUG statements alone eat up 153 bytes. Add to that the amount taken by storing all the arguments and you end up with a respectable saving of memory.
  • GenetixGenetix Posts: 1,749
    edited 2014-05-15 15:05
    I believe it was Mike Green who suggested moving the text from the DEBUG statements to DATA statements.
  • Mike GreenMike Green Posts: 23,101
    edited 2014-05-15 19:23
    Moving DEBUG text into DATA statements only works if you have a multi-slot Stamp like the BS2p/pe/px where you can put DATA statements in another slot and reference that data from the main slot's program. Without that, you don't save much. The text takes the same amount of space whether it's in a DATA statement or a DEBUG statement.
  • GenetixGenetix Posts: 1,749
    edited 2014-05-16 01:52
    I notice that portions of the DEBUG statements are repetitive so some of those parts could be moved to subroutines.
Sign In or Register to comment.