See section 2.2.2.2 of the 16F876 data sheet (this is a must read)

Just add

OPTION_REG.7 = 0 'turns on weak pull-ups

or

OPTION_REG.7 = 1 ' turns off weak pull-ups


near the top of your code.

OPTION_REG is one of many Special Function Registers that can be accessed directly. Do not leave home without the PBP manual and the data sheet for your PIC!

Good Luck,

Paul Borgmeier
Salt Lake City, Utah
USA