Debugging :
0. Make sure your port is working fine...!!! (very common mistake). Put some leds on your port and turn them on and off. In PIC16f877a whole PORTA is an analog input and NOT DIGITAL I/O !!!
1. Turn Off all the unused peripherals of microcontroller which are not in use...LIKE ADC, Timer...etc (Some are ON by default in PIC micros....like ADC)
2. Checking the contrast pin, (it should be set with the pot) on extremes LCD shows nothing...
3. In program you should give appropriate delays between various instructions for LCD...(less delay creates problem while interfacing in real life)
If nothing helps...increase the delay to 1s between each data going to LCD and PUT LEDs on the port and check that desired data is going out of the PIC....