I'm not sure what your input is, are you saying with no key pressed you have between 0,5 and 4 volts, but with key pressed you get a solid 0V?

If so, then you need to use the analog to digital input feature. Unfortunately, the 16f872 only has 5 such inputs, and you need 7 inputs.