If you're really worried about abusing the output, you can connect a resistor (100 ohm or so) between the pin and the switch and put a small capacitor accross the switch. Then allow a small delay between setting the pin high and turning it back into an input and reading it again. If the switch is open, the capacitor will hold a charge and the pin will read high, if the switch is closed, the capacitor won't charge and the pin reads low. Only small (10-100pF) caps are needed and they provide a degree of immunity to RF as well. RP On 19 October 2016 at 05:41, wrote: >> > There is another way of doing it that removes the need for any pullups= .. >> > >> > Set the pins as outputs. Set the outputs to all ones. Now read them >> > and see which ones are high and which are low, and save the states. >> > >> > Now set all the pins as 0. Again read all the pins and compare the >> > states to the previous read. If the state has changed the output is >> > not connected to anything. If the state doesn't change the output is >> > shorted to somewhere by the dip switch. >> > >> > >> It is really abusive to short digital outputs high or low like this. Man= y parts will >> withstand it, but it almost certainly exceeds the absmax ratings on the = port >> outputs. > > Abusive for a handful of microseconds (unless using an extremely slow clo= ck) > > In reality the abuse the output transistors will see is the short circuit= current specified in the data sheet for a very short time (unless the code= is badly written). I wonder how that 'abuse' differs from the current glit= ch the same transistor would see driving a reasonable frequency signal (i.e= .. non-steady state). That is likely to be charging and discharging a capaci= tor at a rate that will cause a reasonable amount of 'abuse' to the transis= tor. > > > > > > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .