At 08:33 PM 3/1/2005, Jesse Lackey wrote: >Some ICs I've used have configuration pins that can be tied high, low, or >floating, to select three different modes. >It would be handy to be able to do this with a microcontroller. > >Now, if 'tied' means thru a resistor, the one way I came up with is to: >1. read value high/low >2. switch pin to output >3. set it to opposite of what was read on #1 >4. switch pin to input >5. read value high/low > >if done quickly, if the value at step #5 is different from the value at >step #1, then it is floating. (You read back the tiny parasitic >capacitance the pin has that was charged in step #3). > >I haven't tried this, tho it would obviously be an easy test. > >But. This does not strike me as reliable. And it really has to be >reliable, as reliable as using normal set the pin high or low configuration. I normally do this with a resistor tied to the pin; the resistor is driven from some other known signal that the micro either generates or can sample. Standard setup for me is where I use a bussed SIP network feeding all the input pins on a shift register - this gives me 8 trinary inputs. If you want to sample a single pin, I might try something like a 10n capacitor in series with a 470R resistor tied to the PIC pin; other side of cap is grounded. Your jumper pins connect the junction of the capacitor & resistor to Vdd, Vss or nothing. This should be reliable. Choose your sample period to be at least 4 or 5 time-constants. dwayne -- Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 21 years of Engineering Innovation (1984 - 2005) .-. .-. .-. .-. .-. .-. .-. .-. .-. .- `-' `-' `-' `-' `-' `-' `-' `-' `-' Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist