You are setting ADCON1 = 7. This sets PortA to analog.

I would be setting ADCON1 = %00001111 in order to make PortA all digital.

This has changed froom the PIC16F877 series.

HTH
Brian