can't get PORTB value in pic18f2550
According to the datasheet, on start-up RB4:RB0 are configured as analog inputs and will read as zero.

You need to make them digital inputs instead during initialisation, for example:

ADCON1 = 0x0E;


Alternatively, you can clear the PBADEN bit in the CONFIG3H register by changing your configuration settings.