An issue with the stack maybe?
MarkCrCo
Posts: 89
in BASIC Stamp
I have encountered a problem that appears like it might be related to the stack if the basic stamp uses a stack like I assume it does. I call this particular routine but it never returns and instead resets the stamp. “Found it” prints but neither “fell through” or “Back” does. This call to find_motion is the one and only call to that routine. Any Ideas?
GOSUB find_motion
DEBUG " Back ",CR
PAUSE 1400
'______________________________________________________________
find_motion:
''DEBUG "Finding Motion", CR
GOSUB Sweep_find
Whereisit = 0
...
...
...
LOW 8
LOW 0
LOW 1
DEBUG "found it",CR
'PAUSE 2000
SLEEP 1
RETURN
DEBUG "fell through"
GOSUB find_motion
DEBUG " Back ",CR
PAUSE 1400
'______________________________________________________________
find_motion:
''DEBUG "Finding Motion", CR
GOSUB Sweep_find
Whereisit = 0
...
...
...
LOW 8
LOW 0
LOW 1
DEBUG "found it",CR
'PAUSE 2000
SLEEP 1
RETURN
DEBUG "fell through"
Comments
The BS2 is limited in how many GOSUBs that can be nested. (GOSUB does a GOSUB which does a GOSUB, etc.)
I think the limit is 8 but it's mentioned in the BASIC Stamp Manual.