Confusing since it worked on the 18 pin but I would also try configuring in the order shown in Example 10-2 of the data sheet:
Code:
PORTA = %00000000       ' Turn off all PORTA 
PORTB = %00000000       ' Turn off all PORTB
ADCON1 = %01111000
ADCON2 = %10000111
TRISA = %11100111
TRISB = %11000011