My first issue is related to the program, which I think is due to a GOSUB where a GOTO should have been placed:
Code:
Q3:
GOSUB ALL_LEDS_OFF
LCDOUT $FE,128,"WHAT COLOR IS GOLD?"
LCDOUT $FE,192,"A: BLACK"
LCDOUT $FE,148,"B: SILVER"
LCDOUT $FE,212,"C: AMBER"
FOR X=1 TO 160
PAUSE 125
IF A=0 OR B=0 OR C=0 THEN
GOSUB CLEAR_SCREEN
IF C=0 THEN
GOSUB CORRECT_ANSWER
GOTO DONE_Q3
ELSE
GOSUB INCORRECT_ANSWER
GOSUB Q3 <------ Will this cause problems with the code?
ENDIF
ENDIF
NEXT X
DONE_Q3:
WRITE 16, 4
RETURN
Before the code arrived at Q3, it came from a GOSUB and that's covered with a RETURN at the end. When checking what button "C" is, if the answer is incorrect I had a GOSUB but no RETURN for that GOSUB (the one with the arrow pointing to it). I believe it should be the same as the correct answer. I can't try this fix until tonight but can someone tell me if that GOSUB will cause my code to do strange things?
My other question is about how to shut off the OLED screen. According to the datasheet, I need to zero everything out and then pull DB7 high. At least that's that way I think it should be done but it's not working. I'd like to shut off the LCD screen and clear it using the table shown below. Is there anything I'm missing?
Bookmarks