I'm having so much trouble with reading input on my 16f887. I have the following code and fuses...I run it and it just does not turn on the LED even when the pin is given a high.
void main() {
ANSELH = 0; //Turn off analog
ANSEL = 0;
PORTD = 0; // Clear PORT D
PORTB = 0; // Clear PORT B
TRISD = 0; // make PORT D output
TRISB = 0xff; // Make PORT B input
while (1) {
if (PORTB,7==1) { // check if RB7 is high
PORTD = 0X01; // if yes, turn on RD0
}else{
PORTD = 0; // else turn off RD0
}
}
}