When in doubt, use debug feature.
If you don't have a debug feature (using Wordpad instead of an IDE), then make one up. Just put in a bunch of LEDs on empty ports, and then make them blink different ways in different places in your code.
Or even better, get the easiest LCD on the market, the HD44780, and send debug messages (abbreviated syntax, just for example):
Code:
LCDOUT "Program start", var1, var2
Label_A:
LCDOUT "Label A", var1, var2
Program logic...
IF var1 < var2 then goto Label_A
Label_B:
LCDOUT "Label B", var1, var2
More program logic...
IF var1 < var2 then goto Label_B
LCDOUT "Program end", var1, var2
We do something similar as mainframe programmers; it's called using DISPLAY statements. There is no limit to what you can use as a debug feature. If it works for you, then it's perfect.
Bookmarks