??? 11/14/05 06:59 Read: times |
#103669 - Stack pointer causing code to loop? |
http://rafb.net/paste/results/6yyAaI34.html
The code runs fine through the menu system, buttons pressed under the LCD switch through the various menus. On lines 63-65, you will see that I print a msg on the LCD saying I am querying the SD card, then a delay, then routine INIT_CARD is run, followed by routine PRINTRESPONSE. Idea being the values clocked in from the card should appear as characters on the LCD in PRINTRESPONSE sub. Using the P1.0 LED on the SBC, and moving the command through the INIT_CARD loops, I was able to determine that the program not getting stuck inside the routine. It returns to run printresponse. However, on the LCD, when it gets to this routine, the LCD resets and clears, and again the messages appear on the screen. It is if the PRINTRESPONSE was somehow triggering a reset. I haven't done anything with the watchdog timer so it should be disabled by default, the only thing else I have done tonight that I've not done before is messing with the stack. I did check through the code and I am never more than 4 CALLs deep, although I do hit 4 a few times; can the stack and using PUSH/PULL with lots of RETs cause this type of behavior? Any suggestions? |
Topic | Author | Date |
Stack pointer causing code to loop? | 01/01/70 00:00 | |
Try using a simulator | 01/01/70 00:00 | |
declaring variables | 01/01/70 00:00 | |
careful | 01/01/70 00:00 | |
push and pull | 01/01/70 00:00 | |
Correct | 01/01/70 00:00 | |
ah.. so if I change... | 01/01/70 00:00 | |
Uh, no | 01/01/70 00:00 | |
in same sub | 01/01/70 00:00 | |
Try a Ring Buffer | 01/01/70 00:00 | |
code changed so push/pops in same sub![]() | 01/01/70 00:00 |