Not sure I understand exactly what you're trying to do. Are you trying to record sound with the on chip analog to digital converter and store that, in real time, in EEPROM on a 16F877?

First, the WRITE command is self timed and, according to the manual, takes up to 10ms. You're doing two of those so ~20ms or a whopping sample rate of 50Hz - not that great for audio. Second, the EEPROM on that device is only 256 bytes, since each of your samples are two bytes you can save 128 samples. Even at the not usable 50Hz sample rate that's only ~2.5 seconds. To get anything usable for speach I'd say you need a sample rate of 8kHz which would give you a whopping storage of 16ms.

Maby you can use WRITECODE and store it in the FLASH instead of in EEPROM but your best bet would be to get somekind of external memory device.

/Henrik.