The switch points for ones and zeros for a (non Schmidt trigger) input is <=3D 1/3 VCC =3D 0 >=3D 2/3 VCC =3D 1 > 1/3 VCC and < 2/3 VCC =3D unknown The input could switch anywhere between 1/3 VCC and 2/3 VCC. For any=20 given input, however, it SHOULD switch at the same point each time. 1=20 to 0 might be different from 0 to 1. In the circuit shown, when switch 10 (top switch) is pushed, the=20 capacitor will charge up to 1/2 VCC! Therefor, there is a 50-50 chance=20 that the input will never reach the 0 to 1 switch point. You could fix this by tying Rcal to VCC instead of ground, at the cost=20 of having to do RC timing each time you check for a switch closure. Kerry YES NOPE9 wrote: > Here is the circuit....... > https://plus.google.com/u/0/photos/102396176247280453443/albums/590179856= 8029457921/5901798571057911522?pid=3D5901798571057911522&oid=3D102396176247= 280453443 > > There may be up to 10 pushbutton switches. Only one may be pressed at a = time. > Each of the resistors [ R0 thru Rn ] is 10K. C1 is 0.1 uf . Rcal is 100= K . > At startup the PIC configures a pin as an output and pulls C1 to a *one*. > Then the pin becomes an input and the PIC measures how long the capacitor= takes to become a *zero*. > This time is used as a calibration value. ( should be around .01 second= s ) > > Periodically the PIC looks at the pin. IF the pin has become a *one* the= PIC sets the pin to zero. > Then the pin becomes an input and the time to charge C1 to a *one* is mea= sured. > The time measured determines which button has been pressed. If the time = is 10% of calibrated time , then button nearest C1 has been pressed. A tim= e of 20% indicated the next button up. > > Is the zero/one voltages for the pin stable enough to do this ? Can I av= oid hysteresis ? Or is there a stable relationship between one to zero ..= .. and zero to one ? > > Perhaps I will have to measure three times to confirm the correct button = was determined. > > thanks for any comments ..... > > Gus > > > =20 --=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 .