I have written some code (My main file is about 250 lines long) and I have been trying to test it. If I comment all except the first little bit of my code, it performs exactly as I expect when I test it on the LCD and keypad. Naturally then I uncomment a little bit more, and when I try to test it, part way through the operation, it reverts back to the beginning of the code.
I was thinking there was an error in the code I had written, so I tried debugging it in a number of different ways but I could not find any problem with it. So I instead tried commenting out the beginning part of my code, and then testing it and it performed perfectly. This led me to believe the problem was something to do with the length of my code. To test my theory I tried putting blank spaces or "nop's" into my code and as the code got longer, it reverted back to the first line of code earlier and earlier through operation (what I mean by earlier through operation is that since I am dealing with the user interface, I am progressing screen by screen as a user would. As I include more nop statements, it gets through less screens before jumping back to the first line [the standby screen]).