Simple number counter - PIC16F877A microcontroller problem
Port D0 and Port D1 should be an input.
If you write:

TRISD = 1;


you only make PortD.1 an input.

Maybe ist clearer if you think in binary:

TRISD = 1:


is simular to:

TRISD = 0b00000001;


which writes 1 only to Port D.0 and put all other Pin of D to 0. So write:

TRISD = 0b00000011;