Hi,
I don't see how the WaitForRelease routines is supposed to wait for the button to actually BE released.

Yes, at the point of entering the routine it does check if the button IS released but then it GOTOs main no matter what. So, the only way to have LEDState set to the correct state is if the button is already released at the time the program enters the routine. If the button is NOT released when the program enters the routine it'll just skip what's inside the IF/ENDIF block and go right to the GOTO main.

/Henrik.