Hopperla.
..Config Portd = &B11101111 ..
Du brauchst ja für den HC165:
Config Portd = &B11011111
(3 u 4 Output, 5 Input)