Jan-Erik Soderholm wrote: >>> Something my professor tried to get through my old, thick skull: You WRITE >>> to the LATCH and READ from the PIN. >>> >>> You wrote a high to the LATCH on RB5, which was then latched to the RB5 pin. >>> You next read the PIN, which is still latched high. >>> >>> It seems as though you are correct that you have to set that pin low (clear >>> it) before making it a switch input if you expect it to be low when you read >>> it (switch not pressed). >>> >>> Please see section 9, specifically section 9.10.2, Successive Operations on >>> an I/O Port, in the PICMicro Mid-Range MCU Family Reference Manual for more >>> information. >> Thanks for the information! > > Which was in part wrong. > > This part : > > > you have to set that pin low (clear it) before making it > > a switch input if you expect it to be low when you read > > it (switch not pressed). > > Is nothing but plain wrong. > > A read from an *input* I/O-pin will read whatever > is on the *pin*, *not* the internal latch. > > Jan-Erik. Thanks for the clarification. I knew the latch was disconnected from the pin when it was changed to an input, and I assumed he meant that the pin would stay high unless something pulled it low, which is basically what that section of the manual says. I think that's what happened in my case. Unless I pull the pin low before I change it to an input the line stays high - I guess due to the board traces and maybe the switch acting as a capacitor and storing a charge. What did you mean by open inputs? A pin tied to nothing and set as an input? Moses -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist