Hi,
One possible cause is that when you read PortA inside the WHILE-WEND loop PortA.1 is not read properly since you make it an output before entering the loop. If you're going to read the pins they need to be inputs.

/Henrik.