Chris McSweeny wrote : > I presume that if I use a 12f683 where the latches are > set to low be default according to the datasheet, I will be > safe in simply switching from input to output,... Not at all. Besides of never trusting "defaults", the problem is this : Say you want pin-1 to be OC with an external pullup. You set pin-1 "low" and then "toggle" tris-1. All is fine so far, if there wasn't any other pins used ! Now say you also have another pin-2 that is an output. What will happen is that when tris-1 is "input" the pin-1 will be pulled high by the external pullup. As expected and by design when using an "open collector bus". Now if you bcf/bsf to pin-2, you have an R-M-W operation. The whole GPIO will be read (incl pin-1 that now will be read as "high"), pin-2 is set according to the bcf/bsf and finaly the whole GPIO is written back. This will now set pin-1 "high" !!! So the solution ot to always set pin-1 "low" right before setting tris-1 as an output. This gets a little more complicated if you have multiple OC pins with external pullup's, but in general it=E4s the same. Jan-Erik. -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist