> Interesting thing - if I run a simple program that configures > portb as outputs but doesn't write anything to them, and > then reconfigure as inputs and read the switches, I get all > 1's. If I don't configure portb as outputs first but rather > initially as inputs, it reads the switches fine You've reminded me of something I saw on an F452. This is part of a post I made on 18/12/04. No explanation was offered from the list or Microchip so I never did get to the bottom of it. Sound kinda similar, seeing as it was with the upper nybble of PortB ? ================================= I've had this problem with a 452 which stumped me for some time. I still don't know why the PIC should do this. I've checked manuals and errata but find no mention of a connection between ADCON1 and PortB. Tried this on four 452s and three LCDs, same thing A 4-bit LCD is on PortB<4:7> and 1 analogue i/p on PortA. No inputs are floating, no shorts, no nothing. Once code is running properly everything works as expected If ADCON1 is set (to 0x07 digitals) before TRISB, no problem. ADC and LCD work fine together. If ADCON1 is set after TRISB, the code hangs in the Busy routine and flow never returns from LCD initialisation -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist