I don't know what MCU chip you are using but if it has and A/D capability PORT A starts up in Analog mode. If this is the case you can fix the problem by:

1. Avoiding PORTA or

2. Looking up the A/D info in the MCU spec. This is often in the ADCON1 register and PORTA made digital by putting something like

ADCON1 = %00001111

near the beginning of your code. Good luck

Regards Bill Legge